From 8739e1c2985dae8977130f605fecefaeeb320594 Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Wed, 3 Nov 2004 22:16:18 +0000 Subject: [PATCH] Allow 'unsigned' integers. --- src/iocsh/iocsh.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/iocsh/iocsh.cpp b/src/iocsh/iocsh.cpp index afb8ed5d7..e6601aacb 100644 --- a/src/iocsh/iocsh.cpp +++ b/src/iocsh/iocsh.cpp @@ -239,7 +239,16 @@ cvtArg (const char *filename, int lineno, char *arg, iocshArgBuf *argBuf, const switch (piocshArg->type) { case iocshArgInt: if (arg && *arg) { + errno = 0; argBuf->ival = strtol (arg, &endp, 0); + if (errno == ERANGE) { + errno = 0; + argBuf->ival = strtoul (arg, &endp, 0); + if (errno == ERANGE) { + showError (filename, lineno, "Integer `%s' out of range", arg); + return 0; + } + } if (*endp) { showError (filename, lineno, "Illegal integer `%s'", arg); return 0;