diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-02-12 14:49:32 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2012-02-13 19:58:23 +0100 |
commit | e71ac0c6fad6643ad99b5cf6f1d566dfb79990d2 (patch) | |
tree | a4355609e84b3ce6a7e7621684bf3e9c75540a82 /src/tool_paramhlp.c | |
parent | 7ed25fcc5c89c135bac3120b5efd820649dc9083 (diff) | |
download | curl-e71ac0c6fad6643ad99b5cf6f1d566dfb79990d2.tar.gz |
curl tool: allow negative numbers as option values
Fix the str2num() function to not check if the input string starts with a
digit, since strtol() supports numbers prepended with '-' (and '+') too.
This makes the --max-redirs option work as documented.
Diffstat (limited to 'src/tool_paramhlp.c')
-rw-r--r-- | src/tool_paramhlp.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index adb12ce70..2d8e7f0d6 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -151,8 +151,6 @@ void cleanarg(char *str) * Parse the string and write the integer in the given address. Return * non-zero on failure, zero on success. * - * The string must start with a digit to be valid. - * * Since this function gets called with the 'nextarg' pointer from within the * getparameter a lot, we must check it for NULL before accessing the str * data. @@ -160,7 +158,7 @@ void cleanarg(char *str) int str2num(long *val, const char *str) { - if(str && ISDIGIT(*str)) { + if(str) { char *endptr; long num = strtol(str, &endptr, 10); if((endptr != str) && (endptr == str + strlen(str))) { |