Author: jilles
Date: Sat Nov 22 23:28:41 2014
New Revision: 274899
URL: https://svnweb.freebsd.org/changeset/base/274899

Log:
  sh: Prepend "$0: " to error messages if there is no command name.

Modified:
  head/bin/sh/error.c
  head/bin/sh/parser.c

Modified: head/bin/sh/error.c
==============================================================================
--- head/bin/sh/error.c Sat Nov 22 23:04:33 2014        (r274898)
+++ head/bin/sh/error.c Sat Nov 22 23:28:41 2014        (r274899)
@@ -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");
 }

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c        Sat Nov 22 23:04:33 2014        (r274898)
+++ head/bin/sh/parser.c        Sat Nov 22 23:28:41 2014        (r274899)
@@ -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);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to