From c715fa0b60c86449e09b313245de621b32e329d2 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Fri, 27 Feb 2015 20:48:38 +0000 Subject: 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. --- src/tool_cb_dbg.c | 4 ++-- src/tool_cb_hdr.c | 5 +++-- src/tool_cb_wrt.c | 16 ++++++++-------- src/tool_easysrc.c | 4 ++-- src/tool_formparse.c | 21 ++++++++++----------- src/tool_getparam.c | 38 +++++++++++++++++++------------------- src/tool_helpers.c | 6 ++++-- src/tool_msgs.c | 14 +++++++------- src/tool_msgs.h | 4 ++-- src/tool_operate.c | 24 +++++++++++------------- src/tool_paramhlp.c | 19 ++++++++++++++----- src/tool_parsecfg.c | 8 ++++---- 12 files changed, 86 insertions(+), 77 deletions(-) (limited to 'src') diff --git a/src/tool_cb_dbg.c b/src/tool_cb_dbg.c index 4add67c55..0fe0f1347 100644 --- a/src/tool_cb_dbg.c +++ b/src/tool_cb_dbg.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * 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; if(!output) { - warnf(operation, "Failed to create/open output"); + warnf(config, "Failed to create/open output"); return 0; } diff --git a/src/tool_cb_hdr.c b/src/tool_cb_hdr.c index ef340f798..af9bb87ea 100644 --- a/src/tool_cb_hdr.c +++ b/src/tool_cb_hdr.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * 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 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; } #endif diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c index dfbf95cc6..918391ad0 100644 --- a/src/tool_cb_wrt.c +++ b/src/tool_cb_wrt.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * 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 if(config->include_headers) { 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; } } else { 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; } } @@ -90,7 +91,7 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata) check_fails = TRUE; } 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; } } @@ -100,7 +101,7 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata) FILE *file; if(!outs->filename || !*outs->filename) { - warnf(config, "Remote filename has no length!\n"); + warnf(config->global, "Remote filename has no length!\n"); 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"); if(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)); 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 */ file = fopen(outs->filename, "wb"); 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)); return failure; } @@ -149,4 +150,3 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata) return rc; } - diff --git a/src/tool_easysrc.c b/src/tool_easysrc.c index 3db27bb5a..e1336c3d9 100644 --- a/src/tool_easysrc.c +++ b/src/tool_easysrc.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -182,7 +182,7 @@ void dumpeasysrc(struct GlobalConfig *config) else out = stdout; 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 { int i; const char *c; diff --git a/src/tool_formparse.c b/src/tool_formparse.c index 1dcd897e6..8b3c39d27 100644 --- a/src/tool_formparse.c +++ b/src/tool_formparse.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * 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 */ if(2 != sscanf(type, "%127[^/]/%127[^;,\n]", type_major, type_minor)) { - warnf(config, "Illegally formatted content-type field!\n"); + warnf(config->global, "Illegally formatted content-type field!\n"); Curl_safefree(contents); FreeMultiInfo(&multi_start, &multi_current); return 2; /* illegal content-type syntax! */ @@ -246,7 +246,7 @@ int formparse(struct OperationConfig *config, semicolon = (';' == *ptr) ? TRUE : FALSE; if(*unknown) { *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, &multi_current)) { - warnf(config, "Error building form post!\n"); + warnf(config->global, "Error building form post!\n"); Curl_safefree(contents); FreeMultiInfo(&multi_start, &multi_current); return 3; @@ -291,7 +291,7 @@ int formparse(struct OperationConfig *config, if(curl_formadd(httppost, last_post, CURLFORM_COPYNAME, name, CURLFORM_ARRAY, forms, CURLFORM_END) != 0) { - warnf(config, "curl_formadd failed!\n"); + warnf(config->global, "curl_formadd failed!\n"); Curl_safefree(forms); Curl_safefree(contents); return 5; @@ -323,8 +323,8 @@ int formparse(struct OperationConfig *config, if(curl_formadd(httppost, last_post, CURLFORM_ARRAY, info, CURLFORM_END ) != 0) { - warnf(config, "curl_formadd failed, possibly the file %s is bad!\n", - contp+1); + warnf(config->global, "curl_formadd failed, possibly the file %s is " + "bad!\n", contp + 1); Curl_safefree(contents); return 6; } @@ -332,7 +332,7 @@ int formparse(struct OperationConfig *config, else { #ifdef CURL_DOES_CONVERSIONS if(convert_to_network(contp, strlen(contp))) { - warnf(config, "curl_formadd failed!\n"); + warnf(config->global, "curl_formadd failed!\n"); Curl_safefree(contents); return 7; } @@ -343,7 +343,7 @@ int formparse(struct OperationConfig *config, info[i].option = CURLFORM_END; if(curl_formadd(httppost, last_post, CURLFORM_ARRAY, info, CURLFORM_END) != 0) { - warnf(config, "curl_formadd failed!\n"); + warnf(config->global, "curl_formadd failed!\n"); Curl_safefree(contents); return 8; } @@ -352,10 +352,9 @@ int formparse(struct OperationConfig *config, } else { - warnf(config, "Illegally formatted input field!\n"); + warnf(config->global, "Illegally formatted input field!\n"); return 1; } Curl_safefree(contents); return 0; } - diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 5b60c9c2a..b7c88d881 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -523,7 +523,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ case 'g': /* --trace */ GetStr(&global->trace_dump, nextarg); 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; break; case 'G': /* --npn */ @@ -532,7 +532,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ case 'h': /* --trace-ascii */ GetStr(&global->trace_dump, nextarg); if(global->tracetype && (global->tracetype != TRACE_ASCII)) - warnf(config, + warnf(global, "--trace-ascii overrides an earlier trace/verbose option\n"); global->tracetype = TRACE_ASCII; break; @@ -568,7 +568,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ /* for plain bytes, leave as-is */ break; 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; } config->recvpersecond = value; @@ -678,7 +678,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ if(strcmp(nextarg, "-")) { FILE *newfile = fopen(nextarg, "wt"); if(!newfile) - warnf(config, "Failed to open %s!\n", nextarg); + warnf(global, "Failed to open %s!\n", nextarg); else { if(global->errors_fopened) fclose(global->errors); @@ -830,7 +830,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ else { config->localportrange -= config->localport; if(config->localportrange < 1) { - warnf(config, "bad range input\n"); + warnf(global, "bad range input\n"); return PARAM_BAD_USE; } } @@ -862,7 +862,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'z': /* --libcurl */ #ifdef CURL_DISABLE_LIBCURL_OPTION - warnf(config, + warnf(global, "--libcurl option was disabled at build-time!\n"); return PARAM_OPTION_UNKNOWN; #else @@ -950,7 +950,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ int mlmaj, mlmin, mlpatch; metalink_get_version(&mlmaj, &mlmin, &mlpatch); if((mlmaj*10000)+(mlmin*100)+mlpatch < CURL_REQ_LIBMETALINK_VERS) { - warnf(config, + warnf(global, "--metalink option cannot be used because the version of " "the linked libmetalink library is too old. " "Required: %d.%d.%d, found %d.%d.%d\n", @@ -963,7 +963,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ else config->use_metalink = toggle; #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"); #endif break; @@ -975,7 +975,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ #ifdef CURLDEBUG config->test_event_based = toggle; #else - warnf(config, "--test-event is ignored unless a debug build!\n"); + warnf(global, "--test-event is ignored unless a debug build!\n"); #endif break; case 'M': /* --unix-socket */ @@ -1127,7 +1127,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ else { file = fopen(p, "rb"); if(!file) - warnf(config, + warnf(global, "Couldn't read data from file \"%s\", this makes " "an empty POST.\n", nextarg); } @@ -1193,7 +1193,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ else { file = fopen(nextarg, "rb"); 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); } @@ -1441,7 +1441,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'J': /* --remote-header-name */ if(config->include_headers) { - warnf(config, + warnf(global, "--include and --remote-header-name cannot be combined.\n"); return PARAM_BAD_USE; } @@ -1452,7 +1452,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'K': /* parse config file */ 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); break; case 'l': @@ -1479,7 +1479,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ #ifdef USE_MANUAL return PARAM_MANUAL_REQUESTED; #else - warnf(config, + warnf(global, "built-in manual was disabled at build-time!\n"); return PARAM_OPTION_UNKNOWN; #endif @@ -1598,7 +1598,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ if(ISDIGIT(*nextarg) && !strchr(nextarg, '-')) { char buffer[32]; curl_off_t off; - warnf(config, + warnf(global, "A specified range MUST include at least one dash (-). " "Appending one for you!\n"); off = curlx_strtoofft(nextarg, NULL, 10); @@ -1614,7 +1614,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ tmp_range = nextarg; while(*tmp_range != '\0') { 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 " "\'start\'-\'stop\'. The server's response to this " "request is uncertain.\n"); @@ -1703,7 +1703,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ if(!global->trace_dump) return PARAM_NO_MEM; if(global->tracetype && (global->tracetype != TRACE_PLAIN)) - warnf(config, + warnf(global, "-v, --verbose overrides an earlier trace/verbose option\n"); global->tracetype = TRACE_PLAIN; } @@ -1738,7 +1738,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ if(err) return err; if(!config->writeout) - warnf(config, "Failed to read %s", fname); + warnf(global, "Failed to read %s", fname); } else GetStr(&config->writeout, nextarg); @@ -1796,7 +1796,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ if(-1 == stat(nextarg, &statbuf)) { /* failed, remove time condition */ config->timecond = CURL_TIMECOND_NONE; - warnf(config, + warnf(global, "Illegal date format for -z, --timecond (and not " "a file name). Disabling time condition. " "See curl_getdate(3) for valid date syntax.\n"); diff --git a/src/tool_helpers.c b/src/tool_helpers.c index dbf32f8bd..5479a1c03 100644 --- a/src/tool_helpers.c +++ b/src/tool_helpers.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * 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; 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; } diff --git a/src/tool_msgs.c b/src/tool_msgs.c index 3311b55f5..38de977aa 100644 --- a/src/tool_msgs.c +++ b/src/tool_msgs.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -38,9 +38,9 @@ * 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; int len; char *ptr; @@ -52,7 +52,7 @@ void warnf(struct OperationConfig *config, const char *fmt, ...) ptr = print_buffer; while(len > 0) { - fputs(WARN_PREFIX, config->global->errors); + fputs(WARN_PREFIX, config->errors); if(len > (int)WARN_TEXTWIDTH) { int cut = WARN_TEXTWIDTH-1; @@ -65,13 +65,13 @@ void warnf(struct OperationConfig *config, const char *fmt, ...) max text width then! */ cut = WARN_TEXTWIDTH-1; - (void)fwrite(ptr, cut + 1, 1, config->global->errors); - fputs("\n", config->global->errors); + (void)fwrite(ptr, cut + 1, 1, config->errors); + fputs("\n", config->errors); ptr += cut+1; /* skip the space too */ len -= cut; } else { - fputs(ptr, config->global->errors); + fputs(ptr, config->errors); len = 0; } } diff --git a/src/tool_msgs.h b/src/tool_msgs.h index 15754690f..bf97bfba7 100644 --- a/src/tool_msgs.h +++ b/src/tool_msgs.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -23,7 +23,7 @@ ***************************************************************************/ #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, ...); diff --git a/src/tool_operate.c b/src/tool_operate.c index 35a0dd390..a875f8d4c 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -320,7 +320,7 @@ static CURLcode operate_do(struct GlobalConfig *global, if(!curlx_strequal(config->headerfile, "-")) { FILE *newfile = fopen(config->headerfile, "wb"); 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; goto quit_curl; } @@ -565,7 +565,7 @@ static CURLcode operate_do(struct GlobalConfig *global, Curl_safefree(storefile); if(result) { /* bad globbing */ - warnf(config, "bad output glob!\n"); + warnf(config->global, "bad output glob!\n"); goto quit_urls; } } @@ -710,7 +710,7 @@ static CURLcode operate_do(struct GlobalConfig *global, * we should warn him/her. */ if(config->proxyanyauth || (authbits>1)) { - warnf(config, + warnf(config->global, "Using --anyauth or --proxy-anyauth with upload from stdin" " involves a big risk of it not working. Use a temporary" " file or a fixed auth type instead!\n"); @@ -722,7 +722,7 @@ static CURLcode operate_do(struct GlobalConfig *global, set_binmode(stdin); if(curlx_strequal(uploadfile, ".")) { if(curlx_nonblock((curl_socket_t)infd, TRUE) < 0) - warnf(config, + warnf(config->global, "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); #else if(config->cookie || config->cookiefile || config->cookiejar) { - warnf(config, "cookie option(s) used even though cookie support " - "is disabled!\n"); + warnf(config->global, "cookie option(s) used even though cookie " + "support is disabled!\n"); return CURLE_NOT_BUILT_IN; } #endif @@ -1250,8 +1250,8 @@ static CURLcode operate_do(struct GlobalConfig *global, my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); if(config->alivetime != 0) { #if !defined(TCP_KEEPIDLE) || !defined(TCP_KEEPINTVL) - warnf(config, "Keep-alive functionality somewhat crippled due to " - "missing support in your operating system!\n"); + warnf(config->global, "Keep-alive functionality somewhat crippled " + "due to missing support in your operating system!\n"); #endif my_setopt(curl, CURLOPT_TCP_KEEPIDLE, 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[]={ NULL, "timeout", "HTTP error", "FTP error" }; - warnf(config, "Transient problem: %s " + + warnf(config->global, "Transient problem: %s " "Will retry in %ld seconds. " "%ld retries left.\n", 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) { int rc = fwrite_xattr(curl, fileno(outs.stream)); if(rc) - warnf(config, "Error setting extended attributes: %s\n", + warnf(config->global, "Error setting extended attributes: %s\n", strerror(errno)); } @@ -1856,9 +1857,6 @@ CURLcode operate(struct GlobalConfig *config, int argc, argv_item_t argv[]) /* Cleanup the libcurl source output */ easysrc_cleanup(); - /* set current back to first so that isn't NULL */ - config->current = config->first; - /* Dump the libcurl code if previously enabled */ dumpeasysrc(config); #endif diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index 0e05184c3..d4b96e76d 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * 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(action == set) *val = 0; - warnf(config, "unrecognized protocol '%s'\n", token); + warnf(config->global, "unrecognized protocol '%s'\n", token); } } Curl_safefree(buffer); @@ -449,7 +449,10 @@ int ftpfilemethod(struct OperationConfig *config, const char *str) return CURLFTPMETHOD_NOCWD; if(curlx_raw_equal("multicwd", str)) 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; } @@ -459,7 +462,10 @@ int ftpcccmethod(struct OperationConfig *config, const char *str) return CURLFTPSSL_CCC_PASSIVE; if(curlx_raw_equal("active", str)) 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; } @@ -471,7 +477,10 @@ long delegation(struct OperationConfig *config, char *str) return CURLGSSAPI_DELEGATION_POLICY_FLAG; if(curlx_raw_equal("always", str)) 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; } diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c index c5d390b7a..33c45ed84 100644 --- a/src/tool_parsecfg.c +++ b/src/tool_parsecfg.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * 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 */ break; default: - warnf(operation, "%s:%d: warning: '%s' uses unquoted white space in" - " the line that may cause side-effects!\n", + warnf(operation->global, "%s:%d: warning: '%s' uses unquoted white " + "space in the line that may cause side-effects!\n", filename, lineno, option); } } @@ -261,7 +261,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global) res != PARAM_VERSION_INFO_REQUESTED && res != PARAM_ENGINES_REQUESTED) { 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); } } -- cgit v1.2.3