diff options
author | Ron Yorston <rmy@pobox.com> | 2012-05-03 14:51:59 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-05-03 14:51:59 +0100 |
commit | 0d6ddf59775b4e1e3a1f5e78490c5c2acf46a986 (patch) | |
tree | 83942902ff32afc35f26b740a2b55fca48061b67 | |
parent | 3e34bceed6955d6107af0f26924f0c389078c23b (diff) | |
download | busybox-w32-0d6ddf59775b4e1e3a1f5e78490c5c2acf46a986.tar.gz busybox-w32-0d6ddf59775b4e1e3a1f5e78490c5c2acf46a986.tar.bz2 busybox-w32-0d6ddf59775b4e1e3a1f5e78490c5c2acf46a986.zip |
mingw32: allow whitespace after '#!' in shell scripts
-rw-r--r-- | win32/process.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/win32/process.c b/win32/process.c index b95e173e1..0db1a455a 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -57,6 +57,10 @@ parse_interpreter(const char *cmd, char ***opts, int *nopts) | |||
57 | if (n < 4) /* at least '#!/x' and not error */ | 57 | if (n < 4) /* at least '#!/x' and not error */ |
58 | return NULL; | 58 | return NULL; |
59 | 59 | ||
60 | /* | ||
61 | * See http://www.in-ulm.de/~mascheck/various/shebang/ for trivia | ||
62 | * relating to '#!'. | ||
63 | */ | ||
60 | if (buf[0] != '#' || buf[1] != '!') | 64 | if (buf[0] != '#' || buf[1] != '!') |
61 | return NULL; | 65 | return NULL; |
62 | buf[n] = '\0'; | 66 | buf[n] = '\0'; |
@@ -70,8 +74,12 @@ parse_interpreter(const char *cmd, char ***opts, int *nopts) | |||
70 | *p = '\0'; | 74 | *p = '\0'; |
71 | } | 75 | } |
72 | 76 | ||
77 | /* skip whitespace after '#!' */ | ||
78 | for ( s=buf+2; *s && isspace(*s); ++s ) { | ||
79 | } | ||
80 | |||
73 | /* move to end of interpreter path (which may not contain spaces) */ | 81 | /* move to end of interpreter path (which may not contain spaces) */ |
74 | for ( s=buf+2; *s && !isspace(*s); ++s ) { | 82 | for ( ; *s && !isspace(*s); ++s ) { |
75 | } | 83 | } |
76 | 84 | ||
77 | n = 0; | 85 | n = 0; |