sh: Improve error message if the script cannot be opened.

Avoid "<nosuchfile>: cannot open <nosuchfile>: ...".
This commit is contained in:
Jilles Tjoelker 2011-06-04 22:19:00 +00:00
parent 535d7745a8
commit af449f7fef
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=222699

View File

@ -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)