Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Aug 2021 21:15:52 GMT
From:      Mateusz Piotrowski <0mp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 90146cfa3180 - stable/12 - grep: Fix an incorrect description of the -C flag
Message-ID:  <202108152115.17FLFqZe020272@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by 0mp (doc, ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=90146cfa3180ee6f8e183f3fb31cdde2e4fc6417

commit 90146cfa3180ee6f8e183f3fb31cdde2e4fc6417
Author:     Mateusz Piotrowski <0mp@FreeBSD.org>
AuthorDate: 2021-02-05 18:38:09 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2021-08-15 21:08:29 +0000

    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
    
    (cherry picked from commit be6b8b7a3a18acb3b044e144d946392fca05e5d0)
---
 usr.bin/grep/grep.1 | 21 +++++++++------------
 usr.bin/grep/grep.c |  4 ++--
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/usr.bin/grep/grep.1 b/usr.bin/grep/grep.1
index 9aac1cc6ca92..af3aec95cb19 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 11, 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 a9c67c268b47..b9dc97661fd6 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) %s\n",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108152115.17FLFqZe020272>