tail: Fix operation with +n argument

POSIX says

  Copying shall begin at the point in the file indicated by the -c
  number or -n number options.

  The origin for counting shall be 1; that is, -c +1 represents the
  first byte of the file, -c -1 the last.

  The origin for counting shall be 1; that is, -n +1 represents the
  first line of the file, -n -1 the last.
This commit is contained in:
Michael Forney 2015-11-01 14:05:05 -08:00 committed by sin
parent 4859f4c825
commit 7604f99003

2
tail.c
View File

@ -18,7 +18,7 @@ dropinit(FILE *fp, const char *str, size_t n)
{ {
Rune r; Rune r;
char *buf = NULL; char *buf = NULL;
size_t size = 0, i = 0; size_t size = 0, i = 1;
ssize_t len; ssize_t len;
if (mode == 'n') { if (mode == 'n') {