summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorMark Lumsden <lum@cvs.openbsd.org>2021-05-07 08:29:31 +0000
committerMark Lumsden <lum@cvs.openbsd.org>2021-05-07 08:29:31 +0000
commiteda77235ada3db8b7cc75dd60efbe25ad07207e7 (patch)
tree2ec36a1a33813217c0fca6ebc8956df4536193cb /usr.bin/mg
parent51eeaca1a4966666f5b5a0479ce6f03c2f5d2450 (diff)
Give an error if quoted string is found as first non-white char after
'('.
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/interpreter.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/mg/interpreter.c b/usr.bin/mg/interpreter.c
index 8c5e5af784d..823a45122f9 100644
--- a/usr.bin/mg/interpreter.c
+++ b/usr.bin/mg/interpreter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interpreter.c,v 1.28 2021/05/07 07:42:20 lum Exp $ */
+/* $OpenBSD: interpreter.c,v 1.29 2021/05/07 08:29:30 lum Exp $ */
/*
* This file is in the public domain.
*
@@ -224,8 +224,12 @@ foundparen(char *funstr, int llen, int lnum)
}
esc = spc = 0;
} else if (*p != ' ' && *p != '\t') {
- if (begp == NULL)
+ if (begp == NULL) {
begp = p;
+ if (*begp == '"')
+ return(dobeep_num("First char of "\
+ "expression error line:", lnm));
+ }
if (*p == '"') {
if (inquote == 0 && esc == 0) {
if (*prechr != ' ' && *prechr != '\t')