develooper Front page | perl.perl5.porters | Postings from August 2008

Re: [perl #30660][PATCH] Repeated spaces on shebang line stops option parsing

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
August 25, 2008 14:52
Subject:
Re: [perl #30660][PATCH] Repeated spaces on shebang line stops option parsing
Message ID:
20080825215220.GM75181@plum.flirble.org
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.

> --- 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)


Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About