summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2014-11-22 23:28:41 +0000
committerjilles <jilles@FreeBSD.org>2014-11-22 23:28:41 +0000
commit6c8ea83ec558fc24d94e27f2623cdb9f1f16402a (patch)
tree673c2a4fa95dcf1d96ac37f731d07568798d8e81 /bin
parentabfc69102bd74f26f145800e55f2511c69558425 (diff)
downloadFreeBSD-src-6c8ea83ec558fc24d94e27f2623cdb9f1f16402a.zip
FreeBSD-src-6c8ea83ec558fc24d94e27f2623cdb9f1f16402a.tar.gz
sh: Prepend "$0: " to error messages if there is no command name.
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/error.c2
-rw-r--r--bin/sh/parser.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/bin/sh/error.c b/bin/sh/error.c
index c76a9dc..96a0092 100644
--- a/bin/sh/error.c
+++ b/bin/sh/error.c
@@ -139,6 +139,8 @@ vwarning(const char *msg, va_list ap)
{
if (commandname)
outfmt(out2, "%s: ", commandname);
+ else if (arg0)
+ outfmt(out2, "%s: ", arg0);
doformat(out2, msg, ap);
out2fmt_flush("\n");
}
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 7fae29e..0048314 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -1879,6 +1879,8 @@ synerror(const char *msg)
{
if (commandname)
outfmt(out2, "%s: %d: ", commandname, startlinno);
+ else if (arg0)
+ outfmt(out2, "%s: ", arg0);
outfmt(out2, "Syntax error: %s\n", msg);
error((char *)NULL);
}
OpenPOWER on IntegriCloud