summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-10-16 16:17:57 +0000
committerjilles <jilles@FreeBSD.org>2009-10-16 16:17:57 +0000
commit52bf80a1c9ceda3e118d67b2683cdb3b402a1a18 (patch)
treede2d1d134529fc0c0ad3613b8e6416af7d0a7121 /bin
parent4fa5145d521ff32cf1d613f40125397082bf2ac9 (diff)
downloadFreeBSD-src-52bf80a1c9ceda3e118d67b2683cdb3b402a1a18.zip
FreeBSD-src-52bf80a1c9ceda3e118d67b2683cdb3b402a1a18.tar.gz
sh: Show more information about syntax errors in command substitution:
the line number where the command substitution started. This applies to both the $() and `` forms but is most useful for `` because the other line number is relative to the enclosed text there. (For older versions, -v can be used as a workaround.)
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/parser.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 9e86162..8dd1e7a 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -1308,11 +1308,16 @@ parsebackq: {
struct jmploc *const savehandler = handler;
int savelen;
int saveprompt;
+ const int bq_startlinno = plinno;
if (setjmp(jmploc.loc)) {
if (str)
ckfree(str);
handler = savehandler;
+ if (exception == EXERROR) {
+ startlinno = bq_startlinno;
+ synerror("Error in command substitution");
+ }
longjmp(handler->loc, 1);
}
INTOFF;
OpenPOWER on IntegriCloud