PERFORCE change 141295 for review
Gabor Kovesdan
gabor at FreeBSD.org
Wed May 7 19:45:34 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=141295
Change 141295 by gabor at gabor_server on 2008/05/07 19:44:43
- Implement --label
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/grep/grep.c#6 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.h#6 edit
.. //depot/projects/soc2008/gabor_textproc/grep/util.c#8 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#6 (text+ko) ====
@@ -90,6 +90,7 @@
int xflag; /* -x: pattern must match entire line */
int lbflag; /* --line-buffered */
int nullflag; /* --null */
+char *label; /* --label */
int binbehave = BIN_FILE_BIN;
@@ -98,6 +99,7 @@
HELP_OPT,
MMAP_OPT,
LINEBUF_OPT,
+ LABEL_OPT,
NULL_OPT
};
@@ -131,8 +133,7 @@
{"help", no_argument, NULL, HELP_OPT},
{"mmap", no_argument, NULL, MMAP_OPT},
{"line-buffered", no_argument, NULL, LINEBUF_OPT},
-/* XXX: UNIMPLEMENTED
- {"label", required_argument, NULL, LABEL_OPT}, */
+ {"label", required_argument, NULL, LABEL_OPT},
{"null", no_argument, NULL, NULL_OPT},
/* XXX: UNIMPLEMENTED
{"color", optional_argument, NULL, COLOR_OPT},
@@ -427,6 +428,9 @@
else
errx(2, "Unknown binary-files option");
break;
+ case LABEL_OPT:
+ label = optarg;
+ break;
case LINEBUF_OPT:
lbflag = 1;
break;
==== //depot/projects/soc2008/gabor_textproc/grep/grep.h#6 (text+ko) ====
@@ -65,6 +65,7 @@
bflag, cflag, hflag, iflag, lflag, nflag, qflag, sflag,
vflag, wflag, xflag,
nullflag;
+extern char *label;
extern int binbehave;
extern int first, matchall, patterns, tail;
==== //depot/projects/soc2008/gabor_textproc/grep/util.c#8 (text+ko) ====
@@ -108,7 +108,10 @@
int c, t, z, nottext;
if (fn == NULL) {
- fn = "(standard input)";
+ if (label != NULL)
+ fn = label;
+ else
+ fn = "(standard input)";
f = grep_fdopen(STDIN_FILENO, "r");
} else {
f = grep_open(fn, "r");
More information about the p4-projects
mailing list