rewriting config_*, xmalloc_fget*

Rich Felker dalias at aerifal.cx
Thu Jun 16 20:12:47 UTC 2011


On Thu, Jun 16, 2011 at 10:12:13PM +0200, Laurent Bercot wrote:
> > Sure -print0 required almost no change in the code for find, but it
> > requires significant change in any program using the output of find. I
> > maintain that shell quoting would have been a much better choice.
> 
>  And it would have made non-shell programs a lot more difficult to write.
> 
>  Parsing a sequence of null-terminated strings is trivial in C.

There's no point in C programs reading the output of find -print0.
It's trivial to call nftw yourself. It's also trivial with the shell
to transform shell-quoted form to null-delimited form:

eval "printf '%s\0' $quoted"

Transformation in the other direction is virtually impossible using
the shell and standard utilities - the only way would be to pipe
through "od" to transform the data to octal, fixup the \000's, and
then convert back with "printf", which would be incredibly
inefficient.

Rich


More information about the busybox mailing list