Allow comments in interpreter specification lines as in

#! /bin/sh # -*- perl -*-

This is simply "delete everything after the next '#', not counting the
first char in the line". No effort has been made to allow quoting,
backslash escaping or '#' in interpreter names.

The complies to POSIX 1003.2 in that Posix says the implementation is
free to choose whatever it likes.

PR:		bin/16393
This commit is contained in:
Martin Cracauer 2000-02-15 08:49:57 +00:00
parent c11e75cfcf
commit 30de91e8b8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57226

View File

@ -76,7 +76,7 @@ exec_shell_imgact(imgp)
/*
* Find end of line; return if the line > MAXSHELLCMDLEN long.
*/
for (ihp = &image_header[2]; *ihp != '\n'; ++ihp) {
for (ihp = &image_header[2]; *ihp != '\n' && *ihp != '#'; ++ihp) {
if (ihp >= &image_header[MAXSHELLCMDLEN])
return(ENOEXEC);
}