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

\r is common on Windows, so we should handle it gracefully.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Peter Harris 2009-05-23 10:04:47 +02:00 committed by Junio C Hamano
parent 7f5a68ad4d
commit bedc4279a8

View File

@ -525,8 +525,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';