From af449f7fef559d2fb8dea7de7864944f5c7b09c9 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sat, 4 Jun 2011 22:19:00 +0000 Subject: [PATCH] sh: Improve error message if the script cannot be opened. Avoid ": cannot open : ...". --- bin/sh/options.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/sh/options.c b/bin/sh/options.c index a99fe818d831..60c885284f75 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)