PERFORCE change 143024 for review
Gabor Kovesdan
gabor at FreeBSD.org
Fri Jun 6 12:31:24 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=143024
Change 143024 by gabor at gabor_server on 2008/06/06 12:30:52
- Implement -d / --directories
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/grep/grep.1#8 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.c#14 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/grep/grep.1#8 (text+ko) ====
@@ -39,7 +39,7 @@
.Sh SYNOPSIS
.Nm grep
.Bk -words
-.Op Fl abcDEFGHhIiLlnOoPqRSsUVvwxZ
+.Op Fl abcdDEFGHhIiLlnOoPqRSsUVvwxZ
.Op Fl A Ar num
.Op Fl B Ar num
.Op Fl C Ns Op Ar num
@@ -158,8 +158,17 @@
The default action is `read', which means, that they are read
as if they were normal files.
If the action is set to `skip', devices will be silently skipped.
-.\".It Fl d Ar action , Fl Fl directories Ns = Ns Ar action
-.\"XXX: Unimplemented.
+.It Fl d Ar action , Fl Fl directories Ns = Ns Ar action
+Specify the demanded action for directories.
+It is `read' by default, which means that the directories
+are read in the same manner as normal files.
+Other possible values are `skip' to silently ignore the
+directories, and `recurse' to read them recursively, which
+has the same effect as the
+.Fl R
+and
+.Fl r
+option.
.It Fl E , Fl Fl extended-regexp
Interpret
.Ar pattern
==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#14 (text+ko) ====
@@ -124,13 +124,14 @@
{
fprintf(stderr,
"usage: %s [-abcDEFGHhIiLlnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n"
- "\t[--color=when] [-e pattern] [-f file] [--binary-files=value] [--context[=num]]\n"
- "\t[--label] [--line-buffered] [--null] [pattern] [file ...]\n"
+ "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n"
+ "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n"
+ "\t[--null] [pattern] [file ...]\n"
, __progname);
exit(2);
}
-static char *optstr = "0123456789A:B:CD:EFGHILOPSRUVZabce:f:hilnoqrsuvwxy";
+static char *optstr = "0123456789A:B:CD:EFGHILOPSRUVZabcd:e:f:hilnoqrsuvwxy";
struct option long_options[] =
{
@@ -149,8 +150,7 @@
{"context", optional_argument, NULL, 'C'},
{"count", no_argument, NULL, 'c'},
{"devices", required_argument, NULL, 'D'},
-/* XXX: UNIMPLEMENTED
- {"directories", required_argument, NULL, 'd'}, */
+ {"directories", required_argument, NULL, 'd'},
{"extended-regexp", no_argument, NULL, 'E'},
{"regexp", required_argument, NULL, 'e'},
{"fixed-strings", no_argument, NULL, 'F'},
@@ -334,6 +334,10 @@
if (strcmp(optarg, "skip") == 0)
Dflag = 1;
break;
+ case 'd':
+ if (strcmp("recurse", optarg) == 0)
+ Rflag++;
+ break;
case 'E':
Fflag = Gflag = 0;
Eflag++;
More information about the p4-projects
mailing list