From: jmc Date: Sun, 10 Dec 2017 09:17:24 +0000 (+0000) Subject: - add max-count to SYNOPSIS X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1bab628a3398d7958ae7b8d5aa030f109778701f;p=openbsd - add max-count to SYNOPSIS - list long options with short, where they have an equivalent - sync usage() - minor tweaks --- diff --git a/usr.bin/grep/grep.1 b/usr.bin/grep/grep.1 index 44fcf2c4851..3085a02dbca 100644 --- a/usr.bin/grep/grep.1 +++ b/usr.bin/grep/grep.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: grep.1,v 1.44 2017/12/09 18:38:37 pirofti Exp $ +.\" $OpenBSD: grep.1,v 1.45 2017/12/10 09:17:24 jmc Exp $ .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -28,7 +28,7 @@ .\" .\" @(#)grep.1 8.3 (Berkeley) 4/18/94 .\" -.Dd $Mdocdate: December 9 2017 $ +.Dd $Mdocdate: December 10 2017 $ .Dt GREP 1 .Os .Sh NAME @@ -48,6 +48,7 @@ .Op Fl -binary-files Ns = Ns Ar value .Op Fl -context Ns Op = Ns Ar num .Op Fl -line-buffered +.Op Fl -max-count Ns = Ns Ar num .Op Ar pattern .Op Ar .Ek @@ -132,7 +133,7 @@ options. .It Fl b The offset in bytes of a matched pattern is displayed in front of the respective matched line. -.It Fl C Ns Op Ar num +.It Fl C Ns Oo Ar num Oc , Fl -context Ns Op = Ns Ar num Print .Ar num lines of leading and trailing context surrounding each match. @@ -217,7 +218,7 @@ Pathnames are listed once per file searched. If the standard input is searched, the string .Dq (standard input) is written. -.It Fl m Ar num, Fl Fl max-count Ns = Ns Ar num +.It Fl m Ar num , Fl -max-count Ns = Ns Ar count Stop after .Ar num matches. @@ -271,7 +272,7 @@ Force .Nm grep to behave as .Nm zgrep . -.It Fl Fl binary-files Ns = Ns Ar value +.It Fl -binary-files Ns = Ns Ar value Controls searching and printing of binary files. Options are .Ar binary , @@ -281,14 +282,7 @@ do not search binary files; and .Ar text : treat all files as text. -.Sm off -.It Fl Fl context Op = Ar num -.Sm on -Print -.Ar num -lines of leading and trailing context. -The default is 2. -.It Fl Fl line-buffered +.It Fl -line-buffered Force output to be line buffered. By default, output is line buffered when standard output is a terminal and block buffered otherwise. @@ -303,7 +297,7 @@ utility exits with one of the following values: One or more lines were selected. .It Li 1 No lines were selected. -.It Li \*(Gt1 +.It Li >1 An error occurred. .El .Sh EXAMPLES diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c index 401ed503cbb..913cc97a0f3 100644 --- a/usr.bin/grep/grep.c +++ b/usr.bin/grep/grep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.c,v 1.56 2017/12/09 18:38:37 pirofti Exp $ */ +/* $OpenBSD: grep.c,v 1.57 2017/12/10 09:17:24 jmc Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -110,12 +110,13 @@ usage(void) { fprintf(stderr, #ifdef NOZ - "usage: %s [-abcEFGHhIiLlnoqRsUVvwx] [-A num] [-B num] [-C[num]]\n" + "usage: %s [-abcEFGHhIiLlnoqRsUVvwx] [-A num] [-B num] [-C[num]]" #else - "usage: %s [-abcEFGHhIiLlnoqRsUVvwxZ] [-A num] [-B num] [-C[num]]\n" + "usage: %s [-abcEFGHhIiLlnoqRsUVvwxZ] [-A num] [-B num] [-C[num]]" #endif - "\t[-e pattern] [-f file] [-m num] [--binary-files=value]\n" - "\t[--context[=num]] [--line-buffered] [pattern] [file ...]\n", + " [-e pattern]\n" + "\t[-f file] [-m num] [--binary-files=value] [--context[=num]]\n" + "\t[--line-buffered] [--max-count=num] [pattern] [file ...]\n", __progname); exit(2); }