Support NUL containing lines in head(1)
Very trivial this time.
This commit is contained in:
parent
886fca3fd6
commit
45b42516d4
2
README
2
README
|
@ -40,7 +40,7 @@ The following tools are implemented:
|
||||||
#*|o fold .
|
#*|o fold .
|
||||||
0=*|o getconf (-v)
|
0=*|o getconf (-v)
|
||||||
=*|o grep .
|
=*|o grep .
|
||||||
=*|o head .
|
0=*|o head .
|
||||||
0=*|x hostname .
|
0=*|x hostname .
|
||||||
0=*|x install .
|
0=*|x install .
|
||||||
=* o join .
|
=* o join .
|
||||||
|
|
2
head.c
2
head.c
|
@ -14,7 +14,7 @@ head(FILE *fp, const char *fname, size_t n)
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
while (i < n && (len = getline(&buf, &size, fp)) > 0) {
|
while (i < n && (len = getline(&buf, &size, fp)) > 0) {
|
||||||
fputs(buf, stdout);
|
fwrite(buf, 1, len, stdout);
|
||||||
i += (len && (buf[len - 1] == '\n'));
|
i += (len && (buf[len - 1] == '\n'));
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user