Index: tail.1 =================================================================== --- tail.1 +++ tail.1 @@ -31,7 +31,7 @@ .\" @(#)tail.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 16, 2013 +.Dd January 31, 2018 .Dt TAIL 1 .Os .Sh NAME @@ -73,11 +73,11 @@ .Pp The options are as follows: .Bl -tag -width indent -.It Fl b Ar number +.It Fl b Ar number , Fl -blocks Ns = Ns Ar number The location is .Ar number 512-byte blocks. -.It Fl c Ar number +.It Fl c Ar number , Fl -bytes Ns = Ns Ar number The location is .Ar number bytes. @@ -112,7 +112,7 @@ option is the same as the .Fl f option if reading from standard input rather than a file. -.It Fl n Ar number +.It Fl n Ar number, Fl -lines Ns = Ns Ar number The location is .Ar number lines. Index: tail.c =================================================================== --- tail.c +++ tail.c @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -65,6 +66,14 @@ static void obsolete(char **); static void usage(void); +static const struct option long_opts[] = +{ + {"blocks", required_argument, NULL, 'b'}, + {"bytes", required_argument, NULL, 'c'}, + {"lines", required_argument, NULL, 'n'}, + {NULL, no_argument, NULL, 0} +}; + int main(int argc, char *argv[]) { @@ -113,7 +122,8 @@ obsolete(argv); style = NOTSET; off = 0; - while ((ch = getopt(argc, argv, "Fb:c:fn:qr")) != -1) + while ((ch = getopt_long(argc, argv, "+Fb:c:fn:qr", long_opts, NULL)) != + -1) switch(ch) { case 'F': /* -F is superset of (and implies) -f */ Fflag = fflag = 1;