[PATCH] Re: Sigh... Bumping the sed nul fix to 1.1.2.

Roberto A. Foglietta me at roberto.foglietta.name
Fri Mar 3 08:38:33 UTC 2006


Rob Landley wrote:
> 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");

because this ^^^ condition never happens so I cannot distinguish strings 
which end for an EOF or an \0;

> else printf("End of file.");
> 

anyway you are right, I do not need to know exactly the last char read 
but just to be acknoledged between '\n' and something else.



  Cheers,
-- 
Roberto A. Foglietta
http://roberto.foglietta.name
http://linux.genova.it
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sed_6-svn14360.patch
Type: text/x-patch
Size: 7415 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060303/92aaf67a/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sed_6-svn14360_norename.patch
Type: text/x-patch
Size: 4103 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060303/92aaf67a/attachment-0001.bin 


More information about the busybox mailing list