On 7/26/19 4:32 PM, enh via Toybox wrote: You didn't include a test and I didn't know what you were trying to fix, so it took me a while to figure out that (long) instead of (unsigned long) was the actual _bug_, and the rest of the patch is unrelated. (I was going "l<0" is _supposed_ to be a signed test?)
As for cleanups, I'm once again leaning towards an xgetline() and xgetdelim() that just always allocate: char *xgetline(FILE *fp, int *optional_len); char *xgetdelim(FILE *fp, char delim, int *optional_len); So the "I don't care what the length is, just gimme a line" use would be: char *s = xgetline(stdin, 0); And then s = NULL means end of input (check errno if you care _why_, we can zero errno before calling getdelim() so it's always 0 when nothing bad happened). And that can be a wrapper around xgetdelim_raw() that doesn't remove the Rob P.S. I need to give a talk at ELC on August 22, and I want toysh reasonably working by then, which means cutting a release shortly before the conference. (Ok, shortly before the talk. I know me.) I've been head down trying to get that to work by deadline, but a release generally has more than one thing in it. :) P.P.S. After that, I have to wander back into $DAYJOB land and not having time for toybox again for a while. Blame capitalism. I'm very grateful to my patreon supporters, but it doesn't pay my health insurance, let alone mortgage... _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
