diff options
author | Alessandro Ghedini <alessandro@ghedini.me> | 2015-04-22 10:25:34 +0200 |
---|---|---|
committer | Alessandro Ghedini <alessandro@ghedini.me> | 2015-04-22 10:25:34 +0200 |
commit | 7b1fa5a0c5daf3831b9857c8fa678aaa6679d618 (patch) | |
tree | fd89ac2d30f1dcf60c769ec994177e1ae09fa3fa /src/tool_parsecfg.c | |
parent | a8501fab9f2f579a6951c1cfcbc8f60b3d39af7f (diff) |
Imported Upstream version 7.42.0
Diffstat (limited to 'src/tool_parsecfg.c')
-rw-r--r-- | src/tool_parsecfg.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c index 7a161c3b..4c25ddbd 100644 --- a/src/tool_parsecfg.c +++ b/src/tool_parsecfg.c @@ -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 * you should have received as part of this distribution. The terms @@ -114,7 +114,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global) #endif } - if(strcmp(filename,"-")) + if(strcmp(filename, "-")) file = fopen(filename, "r"); else file = stdin; @@ -187,28 +187,31 @@ int parseconfig(const char *filename, struct GlobalConfig *global) param = line; /* parameter starts here */ while(*line && !ISSPACE(*line)) line++; - *line = '\0'; /* zero terminate */ - /* to detect mistakes better, see if there's data following */ - line++; - /* pass all spaces */ - while(*line && ISSPACE(*line)) - line++; + if(*line) { + *line = '\0'; /* zero terminate */ - switch(*line) { - case '\0': - case '\r': - case '\n': - case '#': /* comment */ - break; - default: - warnf(operation, "%s:%d: warning: '%s' uses unquoted white space in" - " the line that may cause side-effects!\n", - filename, lineno, option); + /* to detect mistakes better, see if there's data following */ + line++; + /* pass all spaces */ + while(*line && ISSPACE(*line)) + line++; + + switch(*line) { + case '\0': + case '\r': + case '\n': + case '#': /* comment */ + break; + default: + warnf(operation->global, "%s:%d: warning: '%s' uses unquoted " + "white space in the line that may cause side-effects!\n", + filename, lineno, option); + } } } - if(param && !*param) { + if(!*param) { /* do this so getparameter can check for required parameters. Otherwise it always thinks there's a parameter. */ if(alloced_param) @@ -261,7 +264,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); } } |