[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [question] libbb/get_line_from_file.c : bb_get_chunk_from_file function meet the '\0', maybe not
From:       "dengke.du () windriver ! com" <dengke ! du () windriver ! com>
Date:       2016-09-26 1:40:55
Message-ID: 7491f06e-11eb-921d-a9b3-27d21678b8e0 () windriver ! com
[Download RAW message or body]

OK, the GNU sed didn't use the standard posix function, such as 
strlen(), regexec() and so on,

it used the function are non-standard, and implemented by gnulib, which 
they process the string

with an additional 'length' parameter, so the embedded NULs can be 
treated like other characters.

We can check it at the following link:

  http://lists.gnu.org/archive/html/sed-devel/2016-09/msg00010.html

In order to process the embedded NULs in busybox's sed, maybe we need to 
rewrite many function,

I was work on it.


Thanks

//dengke


On 2016年09月26日 04:31, Denys Vlasenko wrote:
> If you change something here, make sure to run testsuite
> and see whether something broke
>
> On Tue, Sep 6, 2016 at 9:20 AM, dengke.du@windriver.com
> <dengke.du@windriver.com> wrote:
>> Hi all
>>
>> In file ./libbb/get_line_from_file.c, function bb_get_chunk_from_file
>> contain the following:
>>
>>          while ((ch = getc(file)) != EOF) {
>>                  /* grow the line buffer as necessary */
>>                  if (!(idx & 0xff))
>>                          linebuf = xrealloc(linebuf, idx + 0x100);
>>                  linebuf[idx++] = (char) ch;
>>                  if (ch == '\0')
>>                          break;
>>                  if (end && ch == '\n')
>>                          break;
>>          }
>>
>> If we want to get a complete line, when it meets '\0', maybe not break,
>> should continue?
>>
>> Thanks
>>
>> //dengke
>> _______________________________________________
>> busybox mailing list
>> busybox@busybox.net
>> http://lists.busybox.net/mailman/listinfo/busybox

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic