diff options
-rw-r--r-- | usr.bin/grep/grep.1 | 26 | ||||
-rw-r--r-- | usr.bin/grep/grep.c | 31 | ||||
-rw-r--r-- | usr.bin/grep/grep.h | 6 | ||||
-rw-r--r-- | usr.bin/grep/util.c | 13 |
4 files changed, 16 insertions, 60 deletions
diff --git a/usr.bin/grep/grep.1 b/usr.bin/grep/grep.1 index 8d4512c27a6..aae00dcb7b9 100644 --- a/usr.bin/grep/grep.1 +++ b/usr.bin/grep/grep.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: grep.1,v 1.36 2009/02/08 17:15:10 jmc Exp $ +.\" $OpenBSD: grep.1,v 1.37 2010/04/05 03:03:55 tedu 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: February 8 2009 $ +.Dd $Mdocdate: April 5 2010 $ .Dt GREP 1 .Os .Sh NAME @@ -38,7 +38,7 @@ .Sh SYNOPSIS .Nm grep .Bk -words -.Op Fl abcEFGHhIiLlnoPqRSsUVvwxZ +.Op Fl abcEFGhIiLlnqRsUVvwxZ .Op Fl A Ar num .Op Fl B Ar num .Op Fl C Ns Op Ar num @@ -183,12 +183,6 @@ as a basic regular expression .Nm grep to behave as traditional .Nm grep ) . -.It Fl H -If -.Fl R -is specified, follow symbolic links only if they were explicitly listed -on the command line. -The default is not to follow symbolic links. .It Fl h Never print filename headers .Pq i.e. filenames @@ -229,13 +223,6 @@ or .Fl q is specified. -.It Fl o -Always print filename headers with output lines. -.It Fl P -If -.Fl R -is specified, no symbolic links are followed. -This is the default. .It Fl q Quiet mode: suppress normal output. @@ -244,11 +231,6 @@ will only search a file until a match has been found, making searches potentially less expensive. .It Fl R Recursively search subdirectories listed. -.It Fl S -If -.Fl R -is specified, all symbolic links are followed. -The default is not to follow symbolic links. .It Fl s Silent mode. Nonexistent and unreadable files are ignored @@ -367,7 +349,7 @@ utility is compliant with the specification. .Pp The flags -.Op Fl AaBbCGHhILoPRSUVwZ +.Op Fl AaBbCGhILRUVwZ are extensions to that specification, and the behaviour of the .Fl f flag when used with an empty pattern file is left undefined. diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c index a78b66b1d51..d8e3ae725da 100644 --- a/usr.bin/grep/grep.c +++ b/usr.bin/grep/grep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.c,v 1.39 2007/09/02 15:19:32 deraadt Exp $ */ +/* $OpenBSD: grep.c,v 1.40 2010/04/05 03:03:55 tedu Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -62,11 +62,8 @@ int Bflag; /* -B x: print x lines leading each match */ int Eflag; /* -E: interpret pattern as extended regexp */ int Fflag; /* -F: interpret pattern as list of fixed strings */ int Gflag; /* -G: interpret pattern as basic regexp */ -int Hflag; /* -H: if -R, follow explicitly listed symlinks */ int Lflag; /* -L: only show names of files with no matches */ -int Pflag; /* -P: if -R, no symlinks are followed */ int Rflag; /* -R: recursively search directory trees */ -int Sflag; /* -S: if -R, follow all symlinks */ #ifndef NOZ int Zflag; /* -Z: decompress input before processing */ #endif @@ -76,7 +73,6 @@ int hflag; /* -h: don't print filename headers */ int iflag; /* -i: ignore case */ int lflag; /* -l: only show names of files with matches */ int nflag; /* -n: show line numbers in front of matching lines */ -int oflag; /* -o: always print file name */ int qflag; /* -q: quiet mode (don't output anything) */ int sflag; /* -s: silent mode (ignore errors) */ int vflag; /* -v: only show non-matching lines */ @@ -110,9 +106,9 @@ usage(void) { fprintf(stderr, #ifdef NOZ - "usage: %s [-abcEFGHhIiLlnoPqRSsUVvwx] [-A num] [-B num] [-C[num]]\n" + "usage: %s [-abcEFGhIiLlnqRsUVvwx] [-A num] [-B num] [-C[num]]\n" #else - "usage: %s [-abcEFGHhIiLlnoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n" + "usage: %s [-abcEFGhIiLlnqRsUVvwxZ] [-A num] [-B num] [-C[num]]\n" #endif "\t[-e pattern] [-f file] [--binary-files=value] [--context[=num]]\n" "\t[--line-buffered] [pattern] [file ...]\n", __progname); @@ -120,9 +116,9 @@ usage(void) } #ifdef NOZ -static char *optstr = "0123456789A:B:CEFGHILPSRUVabce:f:hilnoqrsuvwxy"; +static char *optstr = "0123456789A:B:CEFGILRUVabce:f:hilnqrsuvwxy"; #else -static char *optstr = "0123456789A:B:CEFGHILPSRUVZabce:f:hilnoqrsuvwxy"; +static char *optstr = "0123456789A:B:CEFGILRUVZabce:f:hilnqrsuvwxy"; #endif struct option long_options[] = @@ -317,9 +313,6 @@ main(int argc, char *argv[]) Eflag = Fflag = 0; Gflag++; break; - case 'H': - Hflag++; - break; case 'I': binbehave = BIN_FILE_SKIP; break; @@ -327,16 +320,9 @@ main(int argc, char *argv[]) lflag = 0; Lflag = qflag = 1; break; - case 'P': - Pflag++; - break; - case 'S': - Sflag++; - break; case 'R': case 'r': Rflag++; - oflag++; break; case 'U': binbehave = BIN_FILE_BIN; @@ -370,7 +356,6 @@ main(int argc, char *argv[]) needpattern = 0; break; case 'h': - oflag = 0; hflag = 1; break; case 'i': @@ -385,10 +370,6 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; - case 'o': - hflag = 0; - oflag = 1; - break; case 'q': qflag = 1; break; @@ -472,7 +453,7 @@ main(int argc, char *argv[]) if (lbflag) setlinebuf(stdout); - if ((argc == 0 || argc == 1) && !oflag) + if ((argc == 0 || argc == 1) && !Rflag) hflag = 1; if (argc == 0) diff --git a/usr.bin/grep/grep.h b/usr.bin/grep/grep.h index 5ba9b442347..7bfbe9a50d8 100644 --- a/usr.bin/grep/grep.h +++ b/usr.bin/grep/grep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.h,v 1.14 2007/09/02 15:19:32 deraadt Exp $ */ +/* $OpenBSD: grep.h,v 1.15 2010/04/05 03:03:55 tedu Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -63,8 +63,8 @@ typedef struct { extern int cflags, eflags; /* Command line flags */ -extern int Aflag, Bflag, Eflag, Fflag, Gflag, Hflag, Lflag, Pflag, - Sflag, Rflag, Zflag, +extern int Aflag, Bflag, Eflag, Fflag, Gflag, Lflag, + Rflag, Zflag, bflag, cflag, hflag, iflag, lflag, nflag, qflag, sflag, vflag, wflag, xflag; extern int binbehave; diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index 4feb17cf8ab..39e8ea346f7 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.36 2007/10/02 17:59:18 otto Exp $ */ +/* $OpenBSD: util.c,v 1.37 2010/04/05 03:03:55 tedu Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -59,16 +59,9 @@ grep_tree(char **argv) FTSENT *p; int c, fts_flags; - c = fts_flags = 0; + c = 0; - if (Hflag) - fts_flags = FTS_COMFOLLOW; - if (Pflag) - fts_flags = FTS_PHYSICAL; - if (Sflag) - fts_flags = FTS_LOGICAL; - - fts_flags |= FTS_NOSTAT | FTS_NOCHDIR; + fts_flags = FTS_PHYSICAL | FTS_NOSTAT | FTS_NOCHDIR; if (!(fts = fts_open(argv, fts_flags, NULL))) err(2, NULL); |