Scan for \r in addition to \n when reading shbang lines

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
This commit is contained in:
Peter Harris
2008-03-02 16:30:29 -05:00
committed by Steffen Prohaska
parent f01c16a4bb
commit 3ad18f2446

View File

@@ -448,8 +448,8 @@ static const char *parse_interpreter(const char *cmd)
if (buf[0] != '#' || buf[1] != '!')
return NULL;
buf[n] = '\0';
p = strchr(buf, '\n');
if (!p)
p = buf + strcspn(buf, "\r\n");
if (!*p)
return NULL;
*p = '\0';