bjh 2003/03/31 04:39:51
Modified: threadproc/os2 proc.c
Log:
OS/2: when parsing #! line, adjust for the fact that apr_file_gets() no
longer removes CR characters.
Revision Changes Path
1.59 +7 -2 apr/threadproc/os2/proc.c
Index: proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/os2/proc.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- proc.c 24 Feb 2003 21:55:23 -0000 1.58
+++ proc.c 31 Mar 2003 12:39:51 -0000 1.59
@@ -380,8 +380,13 @@
if (status == APR_SUCCESS) {
if (interpreter[0] == '#' && interpreter[1] == '!') {
- /* delete newline */
- interpreter[strlen(interpreter) - 1] = '\0';
+ /* delete CR/LF & any other whitespace off the end */
+ int end = strlen(interpreter) - 1;
+
+ while (end >= 0 && apr_isspace(interpreter[end])) {
+ interpreter[end] = '\0';
+ end--;
+ }
if (interpreter[2] != '/' && interpreter[2] != '\\' &&
interpreter[3] != ':') {
char buffer[300];