summaryrefslogtreecommitdiffstats
path: root/usr.bin/grep/grep.c
diff options
context:
space:
mode:
authorgabor <gabor@FreeBSD.org>2010-07-29 18:02:57 +0000
committergabor <gabor@FreeBSD.org>2010-07-29 18:02:57 +0000
commit32773dc6ee3f0d5e900ca06397917b0542c56d12 (patch)
treea2b75c216ccd1af2b496bc8500444d18da4b2b05 /usr.bin/grep/grep.c
parent7a37e08cf0fb6f58b3cde2d1bc1484799d821090 (diff)
downloadFreeBSD-src-32773dc6ee3f0d5e900ca06397917b0542c56d12.zip
FreeBSD-src-32773dc6ee3f0d5e900ca06397917b0542c56d12.tar.gz
- Some minor changes to the messages to increase usefulness of error msgs
Reviewed by: hrs (Japanese catalogs), pluknet <pluknet at gmail dot com> (Russian catalog) Approved by: delphij (mentor)
Diffstat (limited to 'usr.bin/grep/grep.c')
-rw-r--r--usr.bin/grep/grep.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 1de68d0..3dc1a1c 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -61,14 +61,13 @@ const char *errstr[] = {
"",
/* 1*/ "(standard input)",
/* 2*/ "cannot read bzip2 compressed file",
-/* 3*/ "unknown --color option",
+/* 3*/ "unknown %s option",
/* 4*/ "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n",
/* 5*/ "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n",
/* 6*/ "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n",
/* 7*/ "\t[--null] [pattern] [file ...]\n",
-/* 8*/ "unknown --binary-files option",
-/* 9*/ "Binary file %s matches\n",
-/*10*/ "%s (BSD grep) %s\n",
+/* 8*/ "Binary file %s matches\n",
+/* 9*/ "%s (BSD grep) %s\n",
};
/* Flags passed to regcomp() and regexec() */
@@ -445,10 +444,8 @@ main(int argc, char *argv[])
devbehave = DEV_SKIP;
else if (strcasecmp(optarg, "read") == 0)
devbehave = DEV_READ;
- else {
- errno = EINVAL;
- err(2, NULL);
- }
+ else
+ errx(2, getstr(3), "--devices");
break;
case 'd':
if (strcasecmp("recurse", optarg) == 0) {
@@ -458,10 +455,8 @@ main(int argc, char *argv[])
dirbehave = DIR_SKIP;
else if (strcasecmp("read", optarg) == 0)
dirbehave = DIR_READ;
- else {
- errno = EINVAL;
- err(2, NULL);
- }
+ else
+ errx(2, getstr(3), "--directories");
break;
case 'E':
grepbehave = GREP_EXTENDED;
@@ -552,7 +547,7 @@ main(int argc, char *argv[])
/* noop, compatibility */
break;
case 'V':
- printf(getstr(10), __progname, VERSION);
+ printf(getstr(9), __progname, VERSION);
exit(0);
case 'v':
vflag = true;
@@ -574,7 +569,7 @@ main(int argc, char *argv[])
else if (strcasecmp("text", optarg) == 0)
binbehave = BINFILE_TEXT;
else
- errx(2, "%s", getstr(8));
+ errx(2, getstr(3), "--binary-files");
break;
case COLOR_OPT:
color = NULL;
@@ -594,7 +589,7 @@ main(int argc, char *argv[])
} else if (strcasecmp("never", optarg) != 0 &&
strcasecmp("none", optarg) != 0 &&
strcasecmp("no", optarg) != 0)
- errx(2, "%s", getstr(3));
+ errx(2, getstr(3), "--color");
break;
case LABEL_OPT:
label = optarg;
OpenPOWER on IntegriCloud