stop parsing if a digit is found as first character of an expression.
authorlum <lum@openbsd.org>
Sat, 8 May 2021 09:27:35 +0000 (09:27 +0000)
committerlum <lum@openbsd.org>
Sat, 8 May 2021 09:27:35 +0000 (09:27 +0000)
usr.bin/mg/interpreter.c

index 823a451..1996d81 100644 (file)
@@ -1,4 +1,4 @@
-/*      $OpenBSD: interpreter.c,v 1.29 2021/05/07 08:29:30 lum Exp $   */
+/*      $OpenBSD: interpreter.c,v 1.30 2021/05/08 09:27:35 lum Exp $   */
 /*
  * This file is in the public domain.
  *
@@ -54,6 +54,7 @@
  */
 #include <sys/queue.h>
 
+#include <ctype.h>
 #include <limits.h>
 #include <regex.h>
 #include <signal.h>
@@ -226,7 +227,7 @@ foundparen(char *funstr, int llen, int lnum)
                } else if (*p != ' ' && *p != '\t') {
                        if (begp == NULL) {
                                begp = p;
-                               if (*begp == '"')
+                               if (*begp == '"' || isdigit(*begp))
                                        return(dobeep_num("First char of "\
                                            "expression error line:", lnm));
                        }