Nicholas Clark wrote: > On Mon, Aug 25, 2008 at 10:47:31AM +0200, Rene Bcker wrote: > >> Make perl recognize additional switches when more than one space is used... >> > > Do you have an example of what this is solving? It seems a logical change to > make, but I'm guessing as to what the problem is. > Attached is a small script. Without this patch it just recognizes the -s switch but not the -w switch. > >> --- perl.c.old 2008-08-25 10:35:38.000000000 +0200 >> +++ perl.c 2008-08-25 10:26:22.000000000 +0200 >> @@ -3370,8 +3370,10 @@ >> return s; >> case '*': >> case ' ': >> - if (s[1] == '-') /* Additional switches on #! line. */ >> - return s+2; >> + while( *s && isSPACE(*s) ) >> + ++s; >> > > That can be > > while( isSPACE(*s) ) > ++s; > > because isSPACE('\0') is going to be false. > > > But is using isSPACE() correct, given that '\r', '\n' and particularly '\t' > are handled differently in code below? > (And no, I'm not intimately familiar with what it is doing, or why) > So this should be rewritten as while( *s && ( s[0] == ' ' ) ) ++s; > > Nicholas Clark > > > ReneeThread Previous | Thread Next