summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-06-04 22:19:00 +0000
committerjilles <jilles@FreeBSD.org>2011-06-04 22:19:00 +0000
commitb6c58c05a42eb4e491ef68746c57324ac602ebe0 (patch)
tree18019207881439ffabc4e16fa460f4520d523dd4 /bin
parent786c89f781c52e7423abdc562256ef0830f60be6 (diff)
downloadFreeBSD-src-b6c58c05a42eb4e491ef68746c57324ac602ebe0.zip
FreeBSD-src-b6c58c05a42eb4e491ef68746c57324ac602ebe0.tar.gz
sh: Improve error message if the script cannot be opened.
Avoid "<nosuchfile>: cannot open <nosuchfile>: ...".
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/options.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c
index a99fe81..60c8852 100644
--- a/bin/sh/options.c
+++ b/bin/sh/options.c
@@ -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)
OpenPOWER on IntegriCloud