aboutsummaryrefslogtreecommitdiff
path: root/cli/cli.h
diff options
context:
space:
mode:
Diffstat (limited to 'cli/cli.h')
-rw-r--r--cli/cli.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/cli/cli.h b/cli/cli.h
index 4b9a8ae..1116595 100644
--- a/cli/cli.h
+++ b/cli/cli.h
@@ -104,8 +104,9 @@ int cli_opt_long_set(struct cli_opt *self, const char *val)
struct cli_opt_long *opt = container_of(self, struct cli_opt_long, opt);
errno = 0;
- opt->value = strtol(val, NULL, 0);
- if (errno != 0)
+ char *endptr;
+ opt->value = strtol(val, &endptr, 0);
+ if (errno != 0 || *endptr != '\0')
return CLI_RC_BAD_ARGS;
return CLI_RC_OK;
@@ -133,8 +134,9 @@ int cli_opt_ulong_set(struct cli_opt *self, const char *val)
struct cli_opt_ulong *opt = container_of(self, struct cli_opt_ulong, opt);
errno = 0;
- opt->value = strtoul(val, NULL, 0);
- if (errno != 0)
+ char *endptr;
+ opt->value = strtoul(val, &endptr, 0);
+ if (errno != 0 || *endptr != '\0')
return CLI_RC_BAD_ARGS;
return CLI_RC_OK;