mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 16:18:48 -05:00
tool: Updated the warnf() function to use the GlobalConfig structure
As the 'error' and 'mute' options are now part of the GlobalConfig, rather than per Operation, updated the warnf() function to use this structure rather than the OperationConfig.
This commit is contained in:
parent
adf27bf60f
commit
c715fa0b60
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -88,7 +88,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
|
|||||||
output = config->trace_stream;
|
output = config->trace_stream;
|
||||||
|
|
||||||
if(!output) {
|
if(!output) {
|
||||||
warnf(operation, "Failed to create/open output");
|
warnf(config, "Failed to create/open output");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -61,7 +61,8 @@ size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
|
|||||||
|
|
||||||
#ifdef DEBUGBUILD
|
#ifdef DEBUGBUILD
|
||||||
if(size * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {
|
if(size * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {
|
||||||
warnf(heads->config, "Header data exceeds single call write limit!\n");
|
warnf(heads->config->global, "Header data exceeds single call write "
|
||||||
|
"limit!\n");
|
||||||
return failure;
|
return failure;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -55,13 +55,14 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)
|
|||||||
#ifdef DEBUGBUILD
|
#ifdef DEBUGBUILD
|
||||||
if(config->include_headers) {
|
if(config->include_headers) {
|
||||||
if(sz * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {
|
if(sz * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {
|
||||||
warnf(config, "Header data size exceeds single call write limit!\n");
|
warnf(config->global, "Header data size exceeds single call write "
|
||||||
|
"limit!\n");
|
||||||
return failure;
|
return failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(sz * nmemb > (size_t)CURL_MAX_WRITE_SIZE) {
|
if(sz * nmemb > (size_t)CURL_MAX_WRITE_SIZE) {
|
||||||
warnf(config, "Data size exceeds single call write limit!\n");
|
warnf(config->global, "Data size exceeds single call write limit!\n");
|
||||||
return failure;
|
return failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +91,7 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)
|
|||||||
check_fails = TRUE;
|
check_fails = TRUE;
|
||||||
}
|
}
|
||||||
if(check_fails) {
|
if(check_fails) {
|
||||||
warnf(config, "Invalid output struct data for write callback\n");
|
warnf(config->global, "Invalid output struct data for write callback\n");
|
||||||
return failure;
|
return failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +101,7 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)
|
|||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
if(!outs->filename || !*outs->filename) {
|
if(!outs->filename || !*outs->filename) {
|
||||||
warnf(config, "Remote filename has no length!\n");
|
warnf(config->global, "Remote filename has no length!\n");
|
||||||
return failure;
|
return failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)
|
|||||||
file = fopen(outs->filename, "rb");
|
file = fopen(outs->filename, "rb");
|
||||||
if(file) {
|
if(file) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
warnf(config, "Refusing to overwrite %s: %s\n", outs->filename,
|
warnf(config->global, "Refusing to overwrite %s: %s\n", outs->filename,
|
||||||
strerror(EEXIST));
|
strerror(EEXIST));
|
||||||
return failure;
|
return failure;
|
||||||
}
|
}
|
||||||
@ -118,7 +119,7 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)
|
|||||||
/* open file for writing */
|
/* open file for writing */
|
||||||
file = fopen(outs->filename, "wb");
|
file = fopen(outs->filename, "wb");
|
||||||
if(!file) {
|
if(!file) {
|
||||||
warnf(config, "Failed to create the file %s: %s\n", outs->filename,
|
warnf(config->global, "Failed to create the file %s: %s\n", outs->filename,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return failure;
|
return failure;
|
||||||
}
|
}
|
||||||
@ -149,4 +150,3 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)
|
|||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -182,7 +182,7 @@ void dumpeasysrc(struct GlobalConfig *config)
|
|||||||
else
|
else
|
||||||
out = stdout;
|
out = stdout;
|
||||||
if(!out)
|
if(!out)
|
||||||
warnf(config->current, "Failed to open %s to write libcurl code!\n", o);
|
warnf(config, "Failed to open %s to write libcurl code!\n", o);
|
||||||
else {
|
else {
|
||||||
int i;
|
int i;
|
||||||
const char *c;
|
const char *c;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -206,7 +206,7 @@ int formparse(struct OperationConfig *config,
|
|||||||
/* verify that this is a fine type specifier */
|
/* verify that this is a fine type specifier */
|
||||||
if(2 != sscanf(type, "%127[^/]/%127[^;,\n]",
|
if(2 != sscanf(type, "%127[^/]/%127[^;,\n]",
|
||||||
type_major, type_minor)) {
|
type_major, type_minor)) {
|
||||||
warnf(config, "Illegally formatted content-type field!\n");
|
warnf(config->global, "Illegally formatted content-type field!\n");
|
||||||
Curl_safefree(contents);
|
Curl_safefree(contents);
|
||||||
FreeMultiInfo(&multi_start, &multi_current);
|
FreeMultiInfo(&multi_start, &multi_current);
|
||||||
return 2; /* illegal content-type syntax! */
|
return 2; /* illegal content-type syntax! */
|
||||||
@ -246,7 +246,7 @@ int formparse(struct OperationConfig *config,
|
|||||||
semicolon = (';' == *ptr) ? TRUE : FALSE;
|
semicolon = (';' == *ptr) ? TRUE : FALSE;
|
||||||
if(*unknown) {
|
if(*unknown) {
|
||||||
*word_end = '\0';
|
*word_end = '\0';
|
||||||
warnf(config, "skip unknown form field: %s\n", unknown);
|
warnf(config->global, "skip unknown form field: %s\n", unknown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ int formparse(struct OperationConfig *config,
|
|||||||
|
|
||||||
if(*contp && !AddMultiFiles(contp, type, filename, &multi_start,
|
if(*contp && !AddMultiFiles(contp, type, filename, &multi_start,
|
||||||
&multi_current)) {
|
&multi_current)) {
|
||||||
warnf(config, "Error building form post!\n");
|
warnf(config->global, "Error building form post!\n");
|
||||||
Curl_safefree(contents);
|
Curl_safefree(contents);
|
||||||
FreeMultiInfo(&multi_start, &multi_current);
|
FreeMultiInfo(&multi_start, &multi_current);
|
||||||
return 3;
|
return 3;
|
||||||
@ -291,7 +291,7 @@ int formparse(struct OperationConfig *config,
|
|||||||
if(curl_formadd(httppost, last_post,
|
if(curl_formadd(httppost, last_post,
|
||||||
CURLFORM_COPYNAME, name,
|
CURLFORM_COPYNAME, name,
|
||||||
CURLFORM_ARRAY, forms, CURLFORM_END) != 0) {
|
CURLFORM_ARRAY, forms, CURLFORM_END) != 0) {
|
||||||
warnf(config, "curl_formadd failed!\n");
|
warnf(config->global, "curl_formadd failed!\n");
|
||||||
Curl_safefree(forms);
|
Curl_safefree(forms);
|
||||||
Curl_safefree(contents);
|
Curl_safefree(contents);
|
||||||
return 5;
|
return 5;
|
||||||
@ -323,8 +323,8 @@ int formparse(struct OperationConfig *config,
|
|||||||
|
|
||||||
if(curl_formadd(httppost, last_post,
|
if(curl_formadd(httppost, last_post,
|
||||||
CURLFORM_ARRAY, info, CURLFORM_END ) != 0) {
|
CURLFORM_ARRAY, info, CURLFORM_END ) != 0) {
|
||||||
warnf(config, "curl_formadd failed, possibly the file %s is bad!\n",
|
warnf(config->global, "curl_formadd failed, possibly the file %s is "
|
||||||
contp+1);
|
"bad!\n", contp + 1);
|
||||||
Curl_safefree(contents);
|
Curl_safefree(contents);
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ int formparse(struct OperationConfig *config,
|
|||||||
else {
|
else {
|
||||||
#ifdef CURL_DOES_CONVERSIONS
|
#ifdef CURL_DOES_CONVERSIONS
|
||||||
if(convert_to_network(contp, strlen(contp))) {
|
if(convert_to_network(contp, strlen(contp))) {
|
||||||
warnf(config, "curl_formadd failed!\n");
|
warnf(config->global, "curl_formadd failed!\n");
|
||||||
Curl_safefree(contents);
|
Curl_safefree(contents);
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
@ -343,7 +343,7 @@ int formparse(struct OperationConfig *config,
|
|||||||
info[i].option = CURLFORM_END;
|
info[i].option = CURLFORM_END;
|
||||||
if(curl_formadd(httppost, last_post,
|
if(curl_formadd(httppost, last_post,
|
||||||
CURLFORM_ARRAY, info, CURLFORM_END) != 0) {
|
CURLFORM_ARRAY, info, CURLFORM_END) != 0) {
|
||||||
warnf(config, "curl_formadd failed!\n");
|
warnf(config->global, "curl_formadd failed!\n");
|
||||||
Curl_safefree(contents);
|
Curl_safefree(contents);
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
@ -352,10 +352,9 @@ int formparse(struct OperationConfig *config,
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
warnf(config, "Illegally formatted input field!\n");
|
warnf(config->global, "Illegally formatted input field!\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Curl_safefree(contents);
|
Curl_safefree(contents);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
case 'g': /* --trace */
|
case 'g': /* --trace */
|
||||||
GetStr(&global->trace_dump, nextarg);
|
GetStr(&global->trace_dump, nextarg);
|
||||||
if(global->tracetype && (global->tracetype != TRACE_BIN))
|
if(global->tracetype && (global->tracetype != TRACE_BIN))
|
||||||
warnf(config, "--trace overrides an earlier trace/verbose option\n");
|
warnf(global, "--trace overrides an earlier trace/verbose option\n");
|
||||||
global->tracetype = TRACE_BIN;
|
global->tracetype = TRACE_BIN;
|
||||||
break;
|
break;
|
||||||
case 'G': /* --npn */
|
case 'G': /* --npn */
|
||||||
@ -532,7 +532,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
case 'h': /* --trace-ascii */
|
case 'h': /* --trace-ascii */
|
||||||
GetStr(&global->trace_dump, nextarg);
|
GetStr(&global->trace_dump, nextarg);
|
||||||
if(global->tracetype && (global->tracetype != TRACE_ASCII))
|
if(global->tracetype && (global->tracetype != TRACE_ASCII))
|
||||||
warnf(config,
|
warnf(global,
|
||||||
"--trace-ascii overrides an earlier trace/verbose option\n");
|
"--trace-ascii overrides an earlier trace/verbose option\n");
|
||||||
global->tracetype = TRACE_ASCII;
|
global->tracetype = TRACE_ASCII;
|
||||||
break;
|
break;
|
||||||
@ -568,7 +568,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
/* for plain bytes, leave as-is */
|
/* for plain bytes, leave as-is */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
warnf(config, "unsupported rate unit. Use G, M, K or B!\n");
|
warnf(global, "unsupported rate unit. Use G, M, K or B!\n");
|
||||||
return PARAM_BAD_USE;
|
return PARAM_BAD_USE;
|
||||||
}
|
}
|
||||||
config->recvpersecond = value;
|
config->recvpersecond = value;
|
||||||
@ -678,7 +678,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
if(strcmp(nextarg, "-")) {
|
if(strcmp(nextarg, "-")) {
|
||||||
FILE *newfile = fopen(nextarg, "wt");
|
FILE *newfile = fopen(nextarg, "wt");
|
||||||
if(!newfile)
|
if(!newfile)
|
||||||
warnf(config, "Failed to open %s!\n", nextarg);
|
warnf(global, "Failed to open %s!\n", nextarg);
|
||||||
else {
|
else {
|
||||||
if(global->errors_fopened)
|
if(global->errors_fopened)
|
||||||
fclose(global->errors);
|
fclose(global->errors);
|
||||||
@ -830,7 +830,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
else {
|
else {
|
||||||
config->localportrange -= config->localport;
|
config->localportrange -= config->localport;
|
||||||
if(config->localportrange < 1) {
|
if(config->localportrange < 1) {
|
||||||
warnf(config, "bad range input\n");
|
warnf(global, "bad range input\n");
|
||||||
return PARAM_BAD_USE;
|
return PARAM_BAD_USE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -862,7 +862,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
break;
|
break;
|
||||||
case 'z': /* --libcurl */
|
case 'z': /* --libcurl */
|
||||||
#ifdef CURL_DISABLE_LIBCURL_OPTION
|
#ifdef CURL_DISABLE_LIBCURL_OPTION
|
||||||
warnf(config,
|
warnf(global,
|
||||||
"--libcurl option was disabled at build-time!\n");
|
"--libcurl option was disabled at build-time!\n");
|
||||||
return PARAM_OPTION_UNKNOWN;
|
return PARAM_OPTION_UNKNOWN;
|
||||||
#else
|
#else
|
||||||
@ -950,7 +950,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
int mlmaj, mlmin, mlpatch;
|
int mlmaj, mlmin, mlpatch;
|
||||||
metalink_get_version(&mlmaj, &mlmin, &mlpatch);
|
metalink_get_version(&mlmaj, &mlmin, &mlpatch);
|
||||||
if((mlmaj*10000)+(mlmin*100)+mlpatch < CURL_REQ_LIBMETALINK_VERS) {
|
if((mlmaj*10000)+(mlmin*100)+mlpatch < CURL_REQ_LIBMETALINK_VERS) {
|
||||||
warnf(config,
|
warnf(global,
|
||||||
"--metalink option cannot be used because the version of "
|
"--metalink option cannot be used because the version of "
|
||||||
"the linked libmetalink library is too old. "
|
"the linked libmetalink library is too old. "
|
||||||
"Required: %d.%d.%d, found %d.%d.%d\n",
|
"Required: %d.%d.%d, found %d.%d.%d\n",
|
||||||
@ -963,7 +963,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
else
|
else
|
||||||
config->use_metalink = toggle;
|
config->use_metalink = toggle;
|
||||||
#else
|
#else
|
||||||
warnf(config, "--metalink option is ignored because the binary is "
|
warnf(global, "--metalink option is ignored because the binary is "
|
||||||
"built without the Metalink support.\n");
|
"built without the Metalink support.\n");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@ -975,7 +975,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
#ifdef CURLDEBUG
|
#ifdef CURLDEBUG
|
||||||
config->test_event_based = toggle;
|
config->test_event_based = toggle;
|
||||||
#else
|
#else
|
||||||
warnf(config, "--test-event is ignored unless a debug build!\n");
|
warnf(global, "--test-event is ignored unless a debug build!\n");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'M': /* --unix-socket */
|
case 'M': /* --unix-socket */
|
||||||
@ -1127,7 +1127,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
else {
|
else {
|
||||||
file = fopen(p, "rb");
|
file = fopen(p, "rb");
|
||||||
if(!file)
|
if(!file)
|
||||||
warnf(config,
|
warnf(global,
|
||||||
"Couldn't read data from file \"%s\", this makes "
|
"Couldn't read data from file \"%s\", this makes "
|
||||||
"an empty POST.\n", nextarg);
|
"an empty POST.\n", nextarg);
|
||||||
}
|
}
|
||||||
@ -1193,7 +1193,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
else {
|
else {
|
||||||
file = fopen(nextarg, "rb");
|
file = fopen(nextarg, "rb");
|
||||||
if(!file)
|
if(!file)
|
||||||
warnf(config, "Couldn't read data from file \"%s\", this makes "
|
warnf(global, "Couldn't read data from file \"%s\", this makes "
|
||||||
"an empty POST.\n", nextarg);
|
"an empty POST.\n", nextarg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1441,7 +1441,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
break;
|
break;
|
||||||
case 'J': /* --remote-header-name */
|
case 'J': /* --remote-header-name */
|
||||||
if(config->include_headers) {
|
if(config->include_headers) {
|
||||||
warnf(config,
|
warnf(global,
|
||||||
"--include and --remote-header-name cannot be combined.\n");
|
"--include and --remote-header-name cannot be combined.\n");
|
||||||
return PARAM_BAD_USE;
|
return PARAM_BAD_USE;
|
||||||
}
|
}
|
||||||
@ -1452,7 +1452,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
break;
|
break;
|
||||||
case 'K': /* parse config file */
|
case 'K': /* parse config file */
|
||||||
if(parseconfig(nextarg, global))
|
if(parseconfig(nextarg, global))
|
||||||
warnf(config, "error trying read config from the '%s' file\n",
|
warnf(global, "error trying read config from the '%s' file\n",
|
||||||
nextarg);
|
nextarg);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
@ -1479,7 +1479,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
#ifdef USE_MANUAL
|
#ifdef USE_MANUAL
|
||||||
return PARAM_MANUAL_REQUESTED;
|
return PARAM_MANUAL_REQUESTED;
|
||||||
#else
|
#else
|
||||||
warnf(config,
|
warnf(global,
|
||||||
"built-in manual was disabled at build-time!\n");
|
"built-in manual was disabled at build-time!\n");
|
||||||
return PARAM_OPTION_UNKNOWN;
|
return PARAM_OPTION_UNKNOWN;
|
||||||
#endif
|
#endif
|
||||||
@ -1598,7 +1598,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
if(ISDIGIT(*nextarg) && !strchr(nextarg, '-')) {
|
if(ISDIGIT(*nextarg) && !strchr(nextarg, '-')) {
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
curl_off_t off;
|
curl_off_t off;
|
||||||
warnf(config,
|
warnf(global,
|
||||||
"A specified range MUST include at least one dash (-). "
|
"A specified range MUST include at least one dash (-). "
|
||||||
"Appending one for you!\n");
|
"Appending one for you!\n");
|
||||||
off = curlx_strtoofft(nextarg, NULL, 10);
|
off = curlx_strtoofft(nextarg, NULL, 10);
|
||||||
@ -1614,7 +1614,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
tmp_range = nextarg;
|
tmp_range = nextarg;
|
||||||
while(*tmp_range != '\0') {
|
while(*tmp_range != '\0') {
|
||||||
if(!ISDIGIT(*tmp_range) && *tmp_range != '-' && *tmp_range != ',') {
|
if(!ISDIGIT(*tmp_range) && *tmp_range != '-' && *tmp_range != ',') {
|
||||||
warnf(config,"Invalid character is found in given range. "
|
warnf(global, "Invalid character is found in given range. "
|
||||||
"A specified range MUST have only digits in "
|
"A specified range MUST have only digits in "
|
||||||
"\'start\'-\'stop\'. The server's response to this "
|
"\'start\'-\'stop\'. The server's response to this "
|
||||||
"request is uncertain.\n");
|
"request is uncertain.\n");
|
||||||
@ -1703,7 +1703,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
if(!global->trace_dump)
|
if(!global->trace_dump)
|
||||||
return PARAM_NO_MEM;
|
return PARAM_NO_MEM;
|
||||||
if(global->tracetype && (global->tracetype != TRACE_PLAIN))
|
if(global->tracetype && (global->tracetype != TRACE_PLAIN))
|
||||||
warnf(config,
|
warnf(global,
|
||||||
"-v, --verbose overrides an earlier trace/verbose option\n");
|
"-v, --verbose overrides an earlier trace/verbose option\n");
|
||||||
global->tracetype = TRACE_PLAIN;
|
global->tracetype = TRACE_PLAIN;
|
||||||
}
|
}
|
||||||
@ -1738,7 +1738,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
if(err)
|
if(err)
|
||||||
return err;
|
return err;
|
||||||
if(!config->writeout)
|
if(!config->writeout)
|
||||||
warnf(config, "Failed to read %s", fname);
|
warnf(global, "Failed to read %s", fname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
GetStr(&config->writeout, nextarg);
|
GetStr(&config->writeout, nextarg);
|
||||||
@ -1796,7 +1796,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
if(-1 == stat(nextarg, &statbuf)) {
|
if(-1 == stat(nextarg, &statbuf)) {
|
||||||
/* failed, remove time condition */
|
/* failed, remove time condition */
|
||||||
config->timecond = CURL_TIMECOND_NONE;
|
config->timecond = CURL_TIMECOND_NONE;
|
||||||
warnf(config,
|
warnf(global,
|
||||||
"Illegal date format for -z, --timecond (and not "
|
"Illegal date format for -z, --timecond (and not "
|
||||||
"a file name). Disabling time condition. "
|
"a file name). Disabling time condition. "
|
||||||
"See curl_getdate(3) for valid date syntax.\n");
|
"See curl_getdate(3) for valid date syntax.\n");
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -72,6 +72,8 @@ int SetHTTPrequest(struct OperationConfig *config, HttpReq req, HttpReq *store)
|
|||||||
*store = req;
|
*store = req;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
warnf(config, "You can only select one HTTP request!\n");
|
|
||||||
|
warnf(config->global, "You can only select one HTTP request!\n");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -38,9 +38,9 @@
|
|||||||
* mute (--silent) was selected.
|
* mute (--silent) was selected.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void warnf(struct OperationConfig *config, const char *fmt, ...)
|
void warnf(struct GlobalConfig *config, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
if(!config->global->mute) {
|
if(!config->mute) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int len;
|
int len;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -52,7 +52,7 @@ void warnf(struct OperationConfig *config, const char *fmt, ...)
|
|||||||
|
|
||||||
ptr = print_buffer;
|
ptr = print_buffer;
|
||||||
while(len > 0) {
|
while(len > 0) {
|
||||||
fputs(WARN_PREFIX, config->global->errors);
|
fputs(WARN_PREFIX, config->errors);
|
||||||
|
|
||||||
if(len > (int)WARN_TEXTWIDTH) {
|
if(len > (int)WARN_TEXTWIDTH) {
|
||||||
int cut = WARN_TEXTWIDTH-1;
|
int cut = WARN_TEXTWIDTH-1;
|
||||||
@ -65,13 +65,13 @@ void warnf(struct OperationConfig *config, const char *fmt, ...)
|
|||||||
max text width then! */
|
max text width then! */
|
||||||
cut = WARN_TEXTWIDTH-1;
|
cut = WARN_TEXTWIDTH-1;
|
||||||
|
|
||||||
(void)fwrite(ptr, cut + 1, 1, config->global->errors);
|
(void)fwrite(ptr, cut + 1, 1, config->errors);
|
||||||
fputs("\n", config->global->errors);
|
fputs("\n", config->errors);
|
||||||
ptr += cut+1; /* skip the space too */
|
ptr += cut+1; /* skip the space too */
|
||||||
len -= cut;
|
len -= cut;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fputs(ptr, config->global->errors);
|
fputs(ptr, config->errors);
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -23,7 +23,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "tool_setup.h"
|
#include "tool_setup.h"
|
||||||
|
|
||||||
void warnf(struct OperationConfig *config, const char *fmt, ...);
|
void warnf(struct GlobalConfig *config, const char *fmt, ...);
|
||||||
|
|
||||||
void helpf(FILE *errors, const char *fmt, ...);
|
void helpf(FILE *errors, const char *fmt, ...);
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
if(!curlx_strequal(config->headerfile, "-")) {
|
if(!curlx_strequal(config->headerfile, "-")) {
|
||||||
FILE *newfile = fopen(config->headerfile, "wb");
|
FILE *newfile = fopen(config->headerfile, "wb");
|
||||||
if(!newfile) {
|
if(!newfile) {
|
||||||
warnf(config, "Failed to open %s\n", config->headerfile);
|
warnf(config->global, "Failed to open %s\n", config->headerfile);
|
||||||
result = CURLE_WRITE_ERROR;
|
result = CURLE_WRITE_ERROR;
|
||||||
goto quit_curl;
|
goto quit_curl;
|
||||||
}
|
}
|
||||||
@ -565,7 +565,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
Curl_safefree(storefile);
|
Curl_safefree(storefile);
|
||||||
if(result) {
|
if(result) {
|
||||||
/* bad globbing */
|
/* bad globbing */
|
||||||
warnf(config, "bad output glob!\n");
|
warnf(config->global, "bad output glob!\n");
|
||||||
goto quit_urls;
|
goto quit_urls;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -710,7 +710,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
* we should warn him/her.
|
* we should warn him/her.
|
||||||
*/
|
*/
|
||||||
if(config->proxyanyauth || (authbits>1)) {
|
if(config->proxyanyauth || (authbits>1)) {
|
||||||
warnf(config,
|
warnf(config->global,
|
||||||
"Using --anyauth or --proxy-anyauth with upload from stdin"
|
"Using --anyauth or --proxy-anyauth with upload from stdin"
|
||||||
" involves a big risk of it not working. Use a temporary"
|
" involves a big risk of it not working. Use a temporary"
|
||||||
" file or a fixed auth type instead!\n");
|
" file or a fixed auth type instead!\n");
|
||||||
@ -722,7 +722,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
set_binmode(stdin);
|
set_binmode(stdin);
|
||||||
if(curlx_strequal(uploadfile, ".")) {
|
if(curlx_strequal(uploadfile, ".")) {
|
||||||
if(curlx_nonblock((curl_socket_t)infd, TRUE) < 0)
|
if(curlx_nonblock((curl_socket_t)infd, TRUE) < 0)
|
||||||
warnf(config,
|
warnf(config->global,
|
||||||
"fcntl failed on fd=%d: %s\n", infd, strerror(errno));
|
"fcntl failed on fd=%d: %s\n", infd, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1091,8 +1091,8 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession?1L:0L);
|
my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession?1L:0L);
|
||||||
#else
|
#else
|
||||||
if(config->cookie || config->cookiefile || config->cookiejar) {
|
if(config->cookie || config->cookiefile || config->cookiejar) {
|
||||||
warnf(config, "cookie option(s) used even though cookie support "
|
warnf(config->global, "cookie option(s) used even though cookie "
|
||||||
"is disabled!\n");
|
"support is disabled!\n");
|
||||||
return CURLE_NOT_BUILT_IN;
|
return CURLE_NOT_BUILT_IN;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1250,8 +1250,8 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
|
my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||||
if(config->alivetime != 0) {
|
if(config->alivetime != 0) {
|
||||||
#if !defined(TCP_KEEPIDLE) || !defined(TCP_KEEPINTVL)
|
#if !defined(TCP_KEEPIDLE) || !defined(TCP_KEEPINTVL)
|
||||||
warnf(config, "Keep-alive functionality somewhat crippled due to "
|
warnf(config->global, "Keep-alive functionality somewhat crippled "
|
||||||
"missing support in your operating system!\n");
|
"due to missing support in your operating system!\n");
|
||||||
#endif
|
#endif
|
||||||
my_setopt(curl, CURLOPT_TCP_KEEPIDLE, config->alivetime);
|
my_setopt(curl, CURLOPT_TCP_KEEPIDLE, config->alivetime);
|
||||||
my_setopt(curl, CURLOPT_TCP_KEEPINTVL, config->alivetime);
|
my_setopt(curl, CURLOPT_TCP_KEEPINTVL, config->alivetime);
|
||||||
@ -1454,7 +1454,8 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
static const char * const m[]={
|
static const char * const m[]={
|
||||||
NULL, "timeout", "HTTP error", "FTP error"
|
NULL, "timeout", "HTTP error", "FTP error"
|
||||||
};
|
};
|
||||||
warnf(config, "Transient problem: %s "
|
|
||||||
|
warnf(config->global, "Transient problem: %s "
|
||||||
"Will retry in %ld seconds. "
|
"Will retry in %ld seconds. "
|
||||||
"%ld retries left.\n",
|
"%ld retries left.\n",
|
||||||
m[retry], retry_sleep/1000L, retry_numretries);
|
m[retry], retry_sleep/1000L, retry_numretries);
|
||||||
@ -1597,7 +1598,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
if(!result && config->xattr && outs.fopened && outs.stream) {
|
if(!result && config->xattr && outs.fopened && outs.stream) {
|
||||||
int rc = fwrite_xattr(curl, fileno(outs.stream));
|
int rc = fwrite_xattr(curl, fileno(outs.stream));
|
||||||
if(rc)
|
if(rc)
|
||||||
warnf(config, "Error setting extended attributes: %s\n",
|
warnf(config->global, "Error setting extended attributes: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1856,9 +1857,6 @@ CURLcode operate(struct GlobalConfig *config, int argc, argv_item_t argv[])
|
|||||||
/* Cleanup the libcurl source output */
|
/* Cleanup the libcurl source output */
|
||||||
easysrc_cleanup();
|
easysrc_cleanup();
|
||||||
|
|
||||||
/* set current back to first so that isn't NULL */
|
|
||||||
config->current = config->first;
|
|
||||||
|
|
||||||
/* Dump the libcurl code if previously enabled */
|
/* Dump the libcurl code if previously enabled */
|
||||||
dumpeasysrc(config);
|
dumpeasysrc(config);
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -331,7 +331,7 @@ long proto2num(struct OperationConfig *config, long *val, const char *str)
|
|||||||
if no protocols are allowed */
|
if no protocols are allowed */
|
||||||
if(action == set)
|
if(action == set)
|
||||||
*val = 0;
|
*val = 0;
|
||||||
warnf(config, "unrecognized protocol '%s'\n", token);
|
warnf(config->global, "unrecognized protocol '%s'\n", token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Curl_safefree(buffer);
|
Curl_safefree(buffer);
|
||||||
@ -449,7 +449,10 @@ int ftpfilemethod(struct OperationConfig *config, const char *str)
|
|||||||
return CURLFTPMETHOD_NOCWD;
|
return CURLFTPMETHOD_NOCWD;
|
||||||
if(curlx_raw_equal("multicwd", str))
|
if(curlx_raw_equal("multicwd", str))
|
||||||
return CURLFTPMETHOD_MULTICWD;
|
return CURLFTPMETHOD_MULTICWD;
|
||||||
warnf(config, "unrecognized ftp file method '%s', using default\n", str);
|
|
||||||
|
warnf(config->global, "unrecognized ftp file method '%s', using default\n",
|
||||||
|
str);
|
||||||
|
|
||||||
return CURLFTPMETHOD_MULTICWD;
|
return CURLFTPMETHOD_MULTICWD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,7 +462,10 @@ int ftpcccmethod(struct OperationConfig *config, const char *str)
|
|||||||
return CURLFTPSSL_CCC_PASSIVE;
|
return CURLFTPSSL_CCC_PASSIVE;
|
||||||
if(curlx_raw_equal("active", str))
|
if(curlx_raw_equal("active", str))
|
||||||
return CURLFTPSSL_CCC_ACTIVE;
|
return CURLFTPSSL_CCC_ACTIVE;
|
||||||
warnf(config, "unrecognized ftp CCC method '%s', using default\n", str);
|
|
||||||
|
warnf(config->global, "unrecognized ftp CCC method '%s', using default\n",
|
||||||
|
str);
|
||||||
|
|
||||||
return CURLFTPSSL_CCC_PASSIVE;
|
return CURLFTPSSL_CCC_PASSIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +477,10 @@ long delegation(struct OperationConfig *config, char *str)
|
|||||||
return CURLGSSAPI_DELEGATION_POLICY_FLAG;
|
return CURLGSSAPI_DELEGATION_POLICY_FLAG;
|
||||||
if(curlx_raw_equal("always", str))
|
if(curlx_raw_equal("always", str))
|
||||||
return CURLGSSAPI_DELEGATION_FLAG;
|
return CURLGSSAPI_DELEGATION_FLAG;
|
||||||
warnf(config, "unrecognized delegation method '%s', using none\n", str);
|
|
||||||
|
warnf(config->global, "unrecognized delegation method '%s', using none\n",
|
||||||
|
str);
|
||||||
|
|
||||||
return CURLGSSAPI_DELEGATION_NONE;
|
return CURLGSSAPI_DELEGATION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -202,8 +202,8 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
|
|||||||
case '#': /* comment */
|
case '#': /* comment */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
warnf(operation, "%s:%d: warning: '%s' uses unquoted white space in"
|
warnf(operation->global, "%s:%d: warning: '%s' uses unquoted white "
|
||||||
" the line that may cause side-effects!\n",
|
"space in the line that may cause side-effects!\n",
|
||||||
filename, lineno, option);
|
filename, lineno, option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,7 +261,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
|
|||||||
res != PARAM_VERSION_INFO_REQUESTED &&
|
res != PARAM_VERSION_INFO_REQUESTED &&
|
||||||
res != PARAM_ENGINES_REQUESTED) {
|
res != PARAM_ENGINES_REQUESTED) {
|
||||||
const char *reason = param2text(res);
|
const char *reason = param2text(res);
|
||||||
warnf(operation, "%s:%d: warning: '%s' %s\n",
|
warnf(operation->global, "%s:%d: warning: '%s' %s\n",
|
||||||
filename, lineno, option, reason);
|
filename, lineno, option, reason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user