summaryrefslogtreecommitdiffstats
path: root/usr.bin/tail/tail.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tail/tail.c')
-rw-r--r--usr.bin/tail/tail.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/tail/tail.c b/usr.bin/tail/tail.c
index e5566cb..97f8371 100644
--- a/usr.bin/tail/tail.c
+++ b/usr.bin/tail/tail.c
@@ -49,6 +49,7 @@ static const char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93";
#include <err.h>
#include <errno.h>
+#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -63,6 +64,14 @@ static file_info_t *files;
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[])
{
@@ -111,7 +120,8 @@ main(int argc, char *argv[])
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;
OpenPOWER on IntegriCloud