Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Jun 2011 22:19:01 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222699 - head/bin/sh
Message-ID:  <201106042219.p54MJ1kw028534@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sat Jun  4 22:19:00 2011
New Revision: 222699
URL: http://svn.freebsd.org/changeset/base/222699

Log:
  sh: Improve error message if the script cannot be opened.
  
  Avoid "<nosuchfile>: cannot open <nosuchfile>: ...".

Modified:
  head/bin/sh/options.c

Modified: head/bin/sh/options.c
==============================================================================
--- head/bin/sh/options.c	Sat Jun  4 22:05:20 2011	(r222698)
+++ head/bin/sh/options.c	Sat Jun  4 22:19:00 2011	(r222699)
@@ -83,6 +83,7 @@ void
 procargs(int argc, char **argv)
 {
 	int i;
+	char *scriptname;
 
 	argptr = argv;
 	if (argc > 0)
@@ -105,8 +106,9 @@ procargs(int argc, char **argv)
 			optlist[i].val = 0;
 	arg0 = argv[0];
 	if (sflag == 0 && minusc == NULL) {
-		commandname = arg0 = *argptr++;
-		setinputfile(commandname, 0);
+		scriptname = *argptr++;
+		setinputfile(scriptname, 0);
+		commandname = arg0 = scriptname;
 	}
 	/* POSIX 1003.2: first arg after -c cmd is $0, remainder $1... */
 	if (argptr && minusc && *argptr)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106042219.p54MJ1kw028534>