diff options
author | Mark Lumsden <lum@cvs.openbsd.org> | 2021-03-23 15:22:26 +0000 |
---|---|---|
committer | Mark Lumsden <lum@cvs.openbsd.org> | 2021-03-23 15:22:26 +0000 |
commit | c33230947db244f9f06176e94ed222165246e3d5 (patch) | |
tree | 32b856cbe88171489d1ba4861873a87da50169bd /usr.bin/mg | |
parent | 8f7d4d26b6eabc2cc46268ce87a97a1ed9df7342 (diff) |
Make a parameter to an mg function not throw an error just
because it is numerical.
Diffstat (limited to 'usr.bin/mg')
-rw-r--r-- | usr.bin/mg/interpreter.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/mg/interpreter.c b/usr.bin/mg/interpreter.c index c47616ae893..d71ce4159f3 100644 --- a/usr.bin/mg/interpreter.c +++ b/usr.bin/mg/interpreter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interpreter.c,v 1.12 2021/03/22 09:26:23 lum Exp $ */ +/* $OpenBSD: interpreter.c,v 1.13 2021/03/23 15:22:25 lum Exp $ */ /* * This file is in the public domain. * @@ -43,6 +43,8 @@ * */ #include <sys/queue.h> + +#include <limits.h> #include <regex.h> #include <signal.h> #include <stdio.h> @@ -384,8 +386,15 @@ multiarg(char *funstr) spc = 1; fin = 0; continue; - } else - return (dobeep_msgs("Var not found:", argp)); + } else { + const char *errstr; + int iters; + + iters = strtonum(argp, 0, INT_MAX, &errstr); + if (errstr != NULL) + return (dobeep_msgs("Var not found:", + argp)); + } if (strlcpy(excbuf, cmdp, sizeof(excbuf)) >= sizeof(excbuf)) |