summaryrefslogtreecommitdiffstats
path: root/usr.bin/look
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2014-08-19 06:50:54 +0000
committersjg <sjg@FreeBSD.org>2014-08-19 06:50:54 +0000
commitd7cd1d425cc1ea9451fa235e3af9b6625c3e0de2 (patch)
treeb04f4bd7cd887f50e7d98af35f46b9834ff86c80 /usr.bin/look
parent3c8e37b1d04827f33c0c9a7594bd1b1ef7cdb3d3 (diff)
parent4fbde208c6460d576f64d6dc3cdc6cab085a4283 (diff)
downloadFreeBSD-src-d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2.zip
FreeBSD-src-d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2.tar.gz
Merge head from 7/28
Diffstat (limited to 'usr.bin/look')
-rw-r--r--usr.bin/look/look.112
-rw-r--r--usr.bin/look/look.c14
2 files changed, 22 insertions, 4 deletions
diff --git a/usr.bin/look/look.1 b/usr.bin/look/look.1
index e9498bb..e6f70bb 100644
--- a/usr.bin/look/look.1
+++ b/usr.bin/look/look.1
@@ -63,12 +63,12 @@ alphabetic characters is ignored.
.Pp
The following options are available:
.Bl -tag -width indent
-.It Fl d
+.It Fl d , -alphanum
Dictionary character set and order, i.e., only alphanumeric characters
are compared.
-.It Fl f
+.It Fl f , -ignore-case
Ignore the case of alphabetic characters.
-.It Fl t
+.It Fl t , -terminate Ar termchar
Specify a string termination character, i.e., only the characters
in
.Ar string
@@ -103,6 +103,12 @@ in comparisons when the
option was specified.
This was incorrect and the current man page matches the historic
implementation.
+.Pp
+The
+.Fl a
+and
+.Fl -alternative
+flags are ignored for compability.
.Sh SEE ALSO
.Xr grep 1 ,
.Xr sort 1
diff --git a/usr.bin/look/look.c b/usr.bin/look/look.c
index e77a216..ada6e25 100644
--- a/usr.bin/look/look.c
+++ b/usr.bin/look/look.c
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <getopt.h>
#include <limits.h>
#include <locale.h>
#include <stdint.h>
@@ -88,6 +89,14 @@ static void print_from(wchar_t *, unsigned char *, unsigned char *);
static void usage(void);
+static struct option longopts[] = {
+ { "alternative",no_argument, NULL, 'a' },
+ { "alphanum", no_argument, NULL, 'd' },
+ { "ignore-case",no_argument, NULL, 'i' },
+ { "terminate", required_argument, NULL, 't'},
+ { NULL, 0, NULL, 0 },
+};
+
int
main(int argc, char *argv[])
{
@@ -102,8 +111,11 @@ main(int argc, char *argv[])
file = _path_words;
termchar = L'\0';
- while ((ch = getopt(argc, argv, "dft:")) != -1)
+ while ((ch = getopt_long(argc, argv, "+adft:", longopts, NULL)) != -1)
switch(ch) {
+ case 'a':
+ /* COMPATIBILITY */
+ break;
case 'd':
dflag = 1;
break;
OpenPOWER on IntegriCloud