tool_operate: warn if too many output arguments were found

More output instructions than URLs is likely a user error.

Add test case 371 to verify

Closes #8210
This commit is contained in:
Daniel Stenberg 2022-01-02 17:42:04 +01:00
parent c07aca3baa
commit ee2ca5826b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 72 additions and 4 deletions

View file

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -735,6 +735,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
}
while(config->state.urlnode) {
static bool warn_more_options = FALSE;
char *infiles; /* might be a glob pattern */
struct URLGlob *inglob = state->inglob;
urlnode = config->state.urlnode;
@ -749,6 +750,11 @@ static CURLcode single_transfer(struct GlobalConfig *global,
urlnode->flags = 0;
config->state.urlnode = urlnode->next;
state->up = 0;
if(!warn_more_options) {
/* only show this once */
warnf(config->global, "Got more output options than URLs\n");
warn_more_options = TRUE;
}
continue; /* next URL please */
}