mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Made getdelim(3) follow POSIX-2008 a bit more closely.
It now reads lines that aren't delimited, but terminated by EOF.
This commit is contained in:
parent
3cc1f7a687
commit
d6f9505d3b
1 changed files with 4 additions and 1 deletions
|
@ -64,7 +64,10 @@ ssize_t getdelim(char** lineptr, size_t* n, int delim, FILE* fp)
|
||||||
int c;
|
int c;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ( (c = getc(fp)) == EOF ) { goto cleanup; }
|
if ( (c = getc(fp)) == EOF )
|
||||||
|
{
|
||||||
|
if ( written ) { break; } else { goto cleanup; }
|
||||||
|
}
|
||||||
if ( bufsize <= (size_t) written + 1UL )
|
if ( bufsize <= (size_t) written + 1UL )
|
||||||
{
|
{
|
||||||
size_t newbufsize = 2UL * bufsize;
|
size_t newbufsize = 2UL * bufsize;
|
||||||
|
|
Loading…
Reference in a new issue