[BusyBox 0000980]: patch to avoid "broadcast +" syntax

Rob Landley rob at landley.net
Tue Nov 28 12:16:16 PST 2006


On Tuesday 28 November 2006 2:25 pm, Paul Fox wrote:
>  > On Monday 27 November 2006 1:02 pm, Roberto A. Foglietta wrote:
>  > > argv is a vector which is not limited by argc so *++argv is always a
>  > > good pointer which could be randomly NULL or not.
>  > 
>  > No, argv[argc] should be NULL and none of the ones before it
>  > should be.  It's not random, argc is redundant and argv[] is a
>  > null terminated array of char pointers.
> 
> while that may be true for linux, and/or most unix
> implementations, harbison and steele say:  "The value of
> argv[argc] may be a null pointer, but is not so in all
> implementations."  (p. 372 of the 2nd edition)

This is like saying that char isn't necessarily a byte.  It is so on all 
modern implementations that I am aware of.  Notice that envp has no length 
and must be null terminated.  Notice that the arguments to execl() must be 
null terminated.  Notice that the sysv3 definition for getopt() mandates 
behavior for when argv[optind] is a NULL pointer...

Not that I care _that_ deeply about what non-Linux systems do. :)  But if 
somebody can come up with a counter-example, I'm interested in hearing about 
it.  (My first guess would be "cygwin"...)

Rob
-- 
"Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away." - Antoine de Saint-Exupery


More information about the busybox mailing list