Sigh... Bumping the sed nul fix to 1.1.2.

Rob Landley rob at landley.net
Thu Mar 2 13:13:07 PST 2006


On Thursday 02 March 2006 4:44 am, Roberto A. Foglietta wrote:
> http://bugs.busybox.net/view.php?id=615
>
> PATCH n.5 resolve the get_line_from_file.c reverted issue: it takes
> get_line_from_file.c as near as possible to the original one from svn 14360

Why does get_chunk_from_file() have to be modified at all?  If you call it:

int i;
char *c=bb_get_chunk_from_file(file,&i);

The i is the length of the chunk read and c is the data, and it ends at the 
first '\n' or '\0' it comes across.  The terminator is not stripped, you have 
to strip it yourself, and you have all the information necessary to determine 
all three potential cases:

if(c && c[i-1]=='\n') printf("Ended with newline");
else if(c && !c[i-1]) printf("Ended with null");
else printf("End of file.");

>   Cheers,

Rob
-- 
Never bet against the cheap plastic solution.


More information about the busybox mailing list