Sort rewrite to be SUSv3 compliant. New config option, updated help, and

a couple of infrastructure bits.
This commit is contained in:
Rob Landley
2005-01-24 07:00:02 +00:00
parent f4bb212d6c
commit c0dedd05e8
5 changed files with 352 additions and 71 deletions

View File

@ -44,7 +44,8 @@ static char *private_get_line_from_file(FILE *file, int c)
linebuf = xrealloc(linebuf, linebufsz += GROWBY);
}
linebuf[idx++] = (char)ch;
if (ch == '\n' || ch == '\0') {
if (!ch) return linebuf;
if (c<2 && ch == '\n') {
if (c) {
--idx;
}
@ -71,6 +72,11 @@ extern char *bb_get_chomped_line_from_file(FILE *file)
return private_get_line_from_file(file, 1);
}
extern char *bb_get_chunk_from_file(FILE *file)
{
return private_get_line_from_file(file, 2);
}
/* END CODE */
/*