diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index 97540d11b..d23245046 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -178,9 +178,13 @@ ParameterError str2num(long *val, const char *str) ParameterError str2unum(long *val, const char *str) { - if(str[0]=='-') - return PARAM_NEGATIVE_NUMERIC; /* badness */ - return str2num(val, str); + ParameterError result = str2num(val, str); + if(result != PARAM_OK) + return result; + if(*val < 0) + return PARAM_NEGATIVE_NUMERIC; + + return PARAM_OK; } /*