From f2b6ebed7bfcfcbe65bcadbce1c5ae7e6134c11e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 10 Jul 2012 23:11:30 +0200 Subject: cmdline: parse numerical options stricter 1 - str2offset() no longer accepts negative numbers since offsets are by nature positive. 2 - introduced str2unum() for the command line parser that accepts numericals which are not supposed to be negative, so that it will properly complain on apparent bad uses and mistakes. Bug: http://curl.haxx.se/mail/archive-2012-07/0013.html --- src/tool_helpers.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/tool_helpers.c') diff --git a/src/tool_helpers.c b/src/tool_helpers.c index 87d7c609d..ae8aaaf32 100644 --- a/src/tool_helpers.c +++ b/src/tool_helpers.c @@ -54,6 +54,8 @@ const char *param2text(int res) return "is badly used here"; case PARAM_BAD_NUMERIC: return "expected a proper numerical parameter"; + case PARAM_NEGATIVE_NUMERIC: + return "expected a positive numerical parameter"; case PARAM_LIBCURL_DOESNT_SUPPORT: return "the installed libcurl version doesn't support this"; case PARAM_NO_MEM: -- cgit v1.2.3