BSD 4_3_Reno release
[unix-history] / usr / src / usr.bin / grep / old.fgrep / old.fgrep.c
index ae7fcc0..72bfe74 100644 (file)
@@ -1,4 +1,4 @@
-static char *sccsid = "@(#)old.fgrep.c 4.3 (Berkeley) %G%";
+static char *sccsid = "@(#)old.fgrep.c 4.4 (Berkeley) 10/7/87";
 /*
  * fgrep -- print all lines containing any of a set of keywords
  *
 /*
  * fgrep -- print all lines containing any of a set of keywords
  *
@@ -27,6 +27,7 @@ struct words {
 long   lnum;
 int    bflag, cflag, fflag, lflag, nflag, vflag, xflag, yflag;
 int    hflag   = 1;
 long   lnum;
 int    bflag, cflag, fflag, lflag, nflag, vflag, xflag, yflag;
 int    hflag   = 1;
+int    oflag;
 int    sflag;
 int    retcode = 0;
 int    nfile;
 int    sflag;
 int    retcode = 0;
 int    nfile;
@@ -50,6 +51,10 @@ char **argv;
                        hflag = 0;
                        continue;
 
                        hflag = 0;
                        continue;
 
+               case 'o':
+                       oflag++;
+                       continue;
+
                case 'b':
                        bflag++;
                        continue;
                case 'b':
                        bflag++;
                        continue;
@@ -218,7 +223,7 @@ char *file;
                                return;
                        }
                        else {
                                return;
                        }
                        else {
-                               if (nfile > 1 && hflag) printf("%s:", file);
+                               if (nfile > 1 && hflag || oflag) printf("%s:", file);
                                if (bflag) printf("%ld:", (blkno-ccount-1)/DEV_BSIZE);
                                if (nflag) printf("%ld:", lnum);
                                if (p <= nlp) {
                                if (bflag) printf("%ld:", (blkno-ccount-1)/DEV_BSIZE);
                                if (nflag) printf("%ld:", lnum);
                                if (p <= nlp) {