PERFORCE change 143851 for review
Gabor Kovesdan
gabor at FreeBSD.org
Sat Jun 21 00:33:54 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=143851
Change 143851 by gabor at gabor_server on 2008/06/21 00:33:00
- GNU compatibility: better -d behaviour
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/grep/grep.c#32 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.h#17 edit
.. //depot/projects/soc2008/gabor_textproc/grep/util.c#31 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#32 (text+ko) ====
@@ -80,6 +80,7 @@
int Zflag; /* -Z: grep in gzipped file */
int bflag; /* -b: show block numbers for each match */
int cflag; /* -c: only show a count of matching lines */
+int dflag; /* -d: skip reading of directories */
int hflag; /* -h: don't print filename headers */
int iflag; /* -i: ignore case */
int lflag; /* -l: only show names of files with matches */
@@ -422,7 +423,10 @@
if (strcmp("recurse", optarg) == 0) {
Hflag++;
Rflag++;
- }
+ } else if (strcmp("skip", optarg) == 0)
+ dflag++;
+ else if (strcmp("read", optarg) != 0)
+ usage();
break;
case 'E':
Fflag = Gflag = 0;
==== //depot/projects/soc2008/gabor_textproc/grep/grep.h#17 (text+ko) ====
@@ -62,7 +62,7 @@
/* Command line flags */
extern int Aflag, Bflag, Dflag, Eflag, Fflag, Gflag, Hflag, Jflag,
Lflag, Oflag, Pflag, Rflag, Zflag,
- bflag, cflag, hflag, iflag, lflag, mflag, nflag, oflag,
+ bflag, cflag, dflag, hflag, iflag, lflag, mflag, nflag, oflag,
qflag, sflag, vflag, wflag, xflag, nullflag;
extern long long mcount;
extern char *color, *label;
==== //depot/projects/soc2008/gabor_textproc/grep/util.c#31 (text+ko) ====
@@ -90,7 +90,7 @@
case FTS_DP:
break;
default:
- if (Dflag || Rflag) {
+ if (Dflag || Rflag || dflag) {
struct stat *finfo;
if (!(finfo = malloc(sizeof(struct stat))))
@@ -105,7 +105,7 @@
free(finfo);
break;
}
- if (Rflag && S_ISDIR(finfo->st_mode)) {
+ if ((Rflag || dflag) && S_ISDIR(finfo->st_mode)) {
free(finfo);
break;
}
More information about the p4-projects
mailing list