summaryrefslogtreecommitdiff
path: root/lib/vty.h
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2015-11-23 18:05:03 +0000
committerDaniel Walton <dwalton@cumulusnetworks.com>2015-11-23 18:05:03 +0000
commit813d4307f91165d25588408cc1e8f1f729e3e24e (patch)
treef682c55cfd97b89071a2f0be9760b88f2419e2bf /lib/vty.h
parent1a1f4efab365954c7b0ab56e974c2d707c0923c5 (diff)
Should be able to "no" the full text of any config line
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-5816
Diffstat (limited to 'lib/vty.h')
-rw-r--r--lib/vty.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/lib/vty.h b/lib/vty.h
index e3ca3db038..3694106403 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -158,9 +158,19 @@ do { \
char *endptr = NULL; \
errno = 0; \
(V) = strtoul ((STR), &endptr, 10); \
- if (*(STR) == '-' || *endptr != '\0' || errno) \
+ if (*(STR) == '-') \
{ \
- vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
+ vty_out (vty, "%% Invalid %s value (dash)%s", NAME, VTY_NEWLINE); \
+ return CMD_WARNING; \
+ } \
+ if (*endptr != '\0') \
+ { \
+ vty_out (vty, "%% Invalid %s value (%s)%s", NAME, endptr, VTY_NEWLINE); \
+ return CMD_WARNING; \
+ } \
+ if (errno) \
+ { \
+ vty_out (vty, "%% Invalid %s value (error %d)%s", NAME, errno, VTY_NEWLINE); \
return CMD_WARNING; \
} \
} while (0)
@@ -171,9 +181,19 @@ do { \
char *endptr = NULL; \
errno = 0; \
(V) = strtoull ((STR), &endptr, 10); \
- if (*(STR) == '-' || *endptr != '\0' || errno) \
+ if (*(STR) == '-') \
+ { \
+ vty_out (vty, "%% Invalid %s value (dash)%s", NAME, VTY_NEWLINE); \
+ return CMD_WARNING; \
+ } \
+ if (*endptr != '\0') \
+ { \
+ vty_out (vty, "%% Invalid %s value (%s)%s", NAME, endptr, VTY_NEWLINE); \
+ return CMD_WARNING; \
+ } \
+ if (errno) \
{ \
- vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
+ vty_out (vty, "%% Invalid %s value (error %d)%s", NAME, errno, VTY_NEWLINE); \
return CMD_WARNING; \
} \
} while (0)