Audit head(1)

1) Use (s)size_t in head().
2) BUGFIX: only check buf[len - 1] when len > 0, else there would
   be an overflow when getline returns 0 (which can happen) and a
   very potential segmentation fault.
3) fix error-messages.
4) update usage().
5) argv-argc-style.
6) clear up the main loop with if (newline).
7) add newline before return.
This commit is contained in:
FRIGN
2015-03-05 00:58:12 +01:00
parent b7c199e050
commit 38066de8c2
2 changed files with 17 additions and 18 deletions

2
README
View File

@@ -35,7 +35,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
= find yes none
#* fold yes none
=* grep yes none
=* head yes none
=*| head yes none
=*| hostname non-posix none
=* kill yes none
=*| link yes none