int parse##name(const char *str, type *ul) \
{ \
if (!*str) \
- return ERROR_COMMAND_SYNTAX_ERROR; \
+ return ERROR_COMMAND_ARGUMENT_INVALID; \
char *end; \
*ul = func(str, &end, 0); \
if (*end) \
- return ERROR_COMMAND_SYNTAX_ERROR; \
- if (*ul == max || (min && min == *ul)) \
- return ERROR_COMMAND_SYNTAX_ERROR; \
+ return ERROR_COMMAND_ARGUMENT_INVALID; \
+ if (*ul == max) \
+ return ERROR_COMMAND_ARGUMENT_OVERFLOW; \
+ if (min && min == *ul) \
+ return ERROR_COMMAND_ARGUMENT_UNDERFLOW; \
return ERROR_OK; \
}
DEFINE_PARSE_NUM_TYPE(_ulong, unsigned long , strtoul, 0, ULONG_MAX)
if (ERROR_OK != retval) \
return retval; \
if (n > max) \
- return ERROR_COMMAND_SYNTAX_ERROR; \
+ return ERROR_COMMAND_ARGUMENT_OVERFLOW; \
if (min) \
- return ERROR_COMMAND_SYNTAX_ERROR; \
+ return ERROR_COMMAND_ARGUMENT_UNDERFLOW; \
*ul = n; \
return ERROR_OK; \
}
#define ERROR_COMMAND_CLOSE_CONNECTION (-600)
#define ERROR_COMMAND_SYNTAX_ERROR (-601)
#define ERROR_COMMAND_NOTFOUND (-602)
+#define ERROR_COMMAND_ARGUMENT_INVALID (-603)
+#define ERROR_COMMAND_ARGUMENT_OVERFLOW (-604)
+#define ERROR_COMMAND_ARGUMENT_UNDERFLOW (-605)
extern int fast_and_dangerous;