From 8fa758803dc2a7f8cb36e7f080e06be50718aea2 Mon Sep 17 00:00:00 2001 From: lum Date: Tue, 23 Mar 2021 15:22:25 +0000 Subject: [PATCH] Make a parameter to an mg function not throw an error just because it is numerical. --- usr.bin/mg/interpreter.c | 15 ++++++++++++--- 1 file 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 + +#include #include #include #include @@ -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)) -- 2.20.1