aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMateusz Piotrowski <0mp@FreeBSD.org>2021-02-05 18:38:09 +0000
committerMateusz Piotrowski <0mp@FreeBSD.org>2021-04-17 20:35:15 +0000
commitbe6b8b7a3a18acb3b044e144d946392fca05e5d0 (patch)
treeab5003d3eaa0d2e736d2eb456521cc02d0a4ca4e /usr.bin
parentc0e41dff700cf8a4a06000f19bd2342cd6fe284d (diff)
downloadsrc-be6b8b7a3a18acb3b044e144d946392fca05e5d0.tar.gz
src-be6b8b7a3a18acb3b044e144d946392fca05e5d0.zip
grep: Fix an incorrect description of the -C flag
It seems that the number of lines is no longer an optional parameter to the -C flag. Document it accordingly both in the manual page and the usage message. Reviewed by: yuripv Approved by: yuripv MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28509
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/grep/grep.121
-rw-r--r--usr.bin/grep/grep.c4
2 files changed, 11 insertions, 14 deletions
diff --git a/usr.bin/grep/grep.1 b/usr.bin/grep/grep.1
index 338af7e6d454..5f314d0dff7c 100644
--- a/usr.bin/grep/grep.1
+++ b/usr.bin/grep/grep.1
@@ -30,7 +30,7 @@
.\"
.\" @(#)grep.1 8.3 (Berkeley) 4/18/94
.\"
-.Dd February 4, 2021
+.Dd April 17, 2021
.Dt GREP 1
.Os
.Sh NAME
@@ -45,13 +45,13 @@
.Op Fl abcdDEFGHhIiLlmnOopqRSsUVvwxz
.Op Fl A Ar num
.Op Fl B Ar num
-.Op Fl C Ns Op Ar num
+.Op Fl C Ar num
.Op Fl e Ar pattern
.Op Fl f Ar file
.Op Fl Fl binary-files= Ns Ar value
.Op Fl Fl color Ns Op Cm = Ns Ar when
.Op Fl Fl colour Ns Op Cm = Ns Ar when
-.Op Fl Fl context Ns Op Cm = Ns Ar num
+.Op Fl Fl context= Ns Ar num
.Op Fl Fl label
.Op Fl Fl line-buffered
.Op Fl Fl null
@@ -123,18 +123,15 @@ options.
.It Fl b , Fl Fl byte-offset
The offset in bytes of a matched pattern is
displayed in front of the respective matched line.
-.It Fl C Ns Oo Ar num Oc , Fl Fl context Ns Oo = Ns Ar num Oc
+.It Fl C Ar num , Fl Fl context= Ns Ar num
Print
.Ar num
lines of leading and trailing context surrounding each match.
-The default value of
-.Ar num
-is
-.Dq 2
-and is equivalent to
-.Dq Fl A Ar 2 Fl B Ar 2 .
-Note:
-no whitespace may be given between the option and its argument.
+See also the
+.Fl A
+and
+.Fl B
+options.
.It Fl c , Fl Fl count
Only a count of selected lines is written to standard output.
.It Fl Fl colour= Ns Oo Ar when Oc , Fl Fl color= Ns Oo Ar when Oc
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 166d3451774a..6fbd6bee8ace 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -57,9 +57,9 @@ const char *errstr[] = {
"",
/* 1*/ "(standard input)",
/* 2*/ "unknown %s option",
-/* 3*/ "usage: %s [-abcDEFGHhIiLlmnOoPqRSsUVvwxz] [-A num] [-B num] [-C[num]]\n",
+/* 3*/ "usage: %s [-abcDEFGHhIiLlmnOoPqRSsUVvwxz] [-A num] [-B num] [-C num]\n",
/* 4*/ "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n",
-/* 5*/ "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n",
+/* 5*/ "\t[--context=num] [--directories=action] [--label] [--line-buffered]\n",
/* 6*/ "\t[--null] [pattern] [file ...]\n",
/* 7*/ "Binary file %s matches\n",
/* 8*/ "%s (BSD grep, GNU compatible) %s\n",