PERFORCE change 141296 for review

Gabor Kovesdan gabor at FreeBSD.org
Wed May 7 19:55:45 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=141296

Change 141296 by gabor at gabor_server on 2008/05/07 19:55:39

	- Swap -o and -H so that -H  match GNU functionality. -o is a
	  plus functionality from OpenBSD, it will be renamed later
	  when I implement the GNU-compatible -o.

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/grep.c#7 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.h#7 edit
.. //depot/projects/soc2008/gabor_textproc/grep/util.c#9 edit

Differences ...

==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#7 (text+ko) ====

@@ -70,7 +70,7 @@
 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	 Hflag;		/* -H: always print file name */
 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 */
@@ -82,7 +82,7 @@
 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	 oflag;		/* -o: if -R, follow explicitly listed symlinks */
 int	 qflag;		/* -q: quiet mode (don't output anything) */
 int	 sflag;		/* -s: silent mode (ignore errors) */
 int	 vflag;		/* -v: only show non-matching lines */
@@ -153,8 +153,7 @@
 	{"file",		required_argument,	NULL, 'f'},
 	{"basic-regexp",	no_argument,		NULL, 'G'},
 	{"no-filename",		no_argument,		NULL, 'h'},
-/* XXX: UNIMPLEMENTED / INCOMPATIBLE
-	{"with-filename",	no_argument,		NULL, 'H'}, */
+	{"with-filename",	no_argument,		NULL, 'H'},
 	{"ignore-case",		no_argument,		NULL, 'i'},
 /* XXX: UNIMPLEMENTED
 	{"bz2decompress",	no_argument,		NULL, 'J'}, */
@@ -353,7 +352,7 @@
 			Hflag++;
 			break;
 		case 'h':
-			oflag = 0;
+			Hflag = 0;
 			hflag = 1;
 			break;
 		case 'I':
@@ -376,8 +375,7 @@
 			nflag = 1;
 			break;
 		case 'o':
-			hflag = 0;
-			oflag = 1;
+			oflag++;
 			break;
 		case 'P':
 			Pflag++;
@@ -391,7 +389,7 @@
 		case 'R':
 		case 'r':
 			Rflag++;
-			oflag++;
+			Hflag++;
 			break;
 		case 's':
 			sflag = 1;
@@ -488,7 +486,7 @@
 	if (lbflag)
 		setlinebuf(stdout);
 
-	if ((argc == 0 || argc == 1) && !oflag)
+	if ((argc == 0 || argc == 1) && !Hflag)
 		hflag = 1;
 
 	if (argc == 0)

==== //depot/projects/soc2008/gabor_textproc/grep/grep.h#7 (text+ko) ====

@@ -62,7 +62,7 @@
 /* Command line flags */
 extern int	 Aflag, Bflag, Eflag, Fflag, Gflag, Hflag, Lflag, Pflag,
 		 Sflag, Rflag, Zflag,
-		 bflag, cflag, hflag, iflag, lflag, nflag, qflag, sflag,
+		 bflag, cflag, hflag, iflag, lflag, nflag, oflag, qflag, sflag,
 		 vflag, wflag, xflag,
 		 nullflag;
 extern char	*label;

==== //depot/projects/soc2008/gabor_textproc/grep/util.c#9 (text+ko) ====

@@ -69,7 +69,7 @@
 
 	c = fts_flags = 0;
 
-	if (Hflag)
+	if (oflag)
 		fts_flags = FTS_COMFOLLOW;
 	if (Pflag)
 		fts_flags = FTS_PHYSICAL;


More information about the p4-projects mailing list