[BusyBox] cpio applet commited
Glenn McGrath
bug1 at optushome.com.au
Fri Jun 22 12:09:56 UTC 2001
Erik Andersen wrote:
>
>Just took a look at your fgets_str() func. With a bit of further thinking,
>I just realised that both get_line_from_file() and fgets_str() are subcases
>of the C library's getdelim() function. How about the following. Lets
>include a copy of getdelim() from uClibc/libc/stdio/getdelim.c (I am sure
>the author won't mind ;-) into libbb, stick some ifdefs on it so it won't
>be compiled in unless we are using libc5 (which doesn't include such a function),
>then reimplement get_line_from_file to use getdelim() -- something like
>(completely untested):
>
> char *get_line_from_file(FILE *file)
> {
> size_t *n;
> char **linebuf
> getdelim (linebuf, n, '\n', file);
> if (linebuf && *linebuf)
> return *linebuf;
> else
> return NULL;
> }
>
>and then I think for the dpkg case, you can either create a wrapper, or
>more likely, just use getdelim directly. Agreeable?
>
I hadnt ran across getdelim before, but yea, looks like a good plan.
Glenn
More information about the busybox
mailing list