[BACK]Return to grep.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / grep

Diff for /src/usr.bin/grep/grep.c between version 1.39 and 1.40

version 1.39, 2007/09/02 15:19:32 version 1.40, 2010/04/05 03:03:55
Line 62 
Line 62 
 int      Eflag;         /* -E: interpret pattern as extended regexp */  int      Eflag;         /* -E: interpret pattern as extended regexp */
 int      Fflag;         /* -F: interpret pattern as list of fixed strings */  int      Fflag;         /* -F: interpret pattern as list of fixed strings */
 int      Gflag;         /* -G: interpret pattern as basic regexp */  int      Gflag;         /* -G: interpret pattern as basic regexp */
 int      Hflag;         /* -H: if -R, follow explicitly listed symlinks */  
 int      Lflag;         /* -L: only show names of files with no matches */  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 */  int      Rflag;         /* -R: recursively search directory trees */
 int      Sflag;         /* -S: if -R, follow all symlinks */  
 #ifndef NOZ  #ifndef NOZ
 int      Zflag;         /* -Z: decompress input before processing */  int      Zflag;         /* -Z: decompress input before processing */
 #endif  #endif
Line 76 
Line 73 
 int      iflag;         /* -i: ignore case */  int      iflag;         /* -i: ignore case */
 int      lflag;         /* -l: only show names of files with matches */  int      lflag;         /* -l: only show names of files with matches */
 int      nflag;         /* -n: show line numbers in front of matching lines */  int      nflag;         /* -n: show line numbers in front of matching lines */
 int      oflag;         /* -o: always print file name */  
 int      qflag;         /* -q: quiet mode (don't output anything) */  int      qflag;         /* -q: quiet mode (don't output anything) */
 int      sflag;         /* -s: silent mode (ignore errors) */  int      sflag;         /* -s: silent mode (ignore errors) */
 int      vflag;         /* -v: only show non-matching lines */  int      vflag;         /* -v: only show non-matching lines */
Line 110 
Line 106 
 {  {
         fprintf(stderr,          fprintf(stderr,
 #ifdef NOZ  #ifdef NOZ
             "usage: %s [-abcEFGHhIiLlnoPqRSsUVvwx] [-A num] [-B num] [-C[num]]\n"              "usage: %s [-abcEFGhIiLlnqRsUVvwx] [-A num] [-B num] [-C[num]]\n"
 #else  #else
             "usage: %s [-abcEFGHhIiLlnoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n"              "usage: %s [-abcEFGhIiLlnqRsUVvwxZ] [-A num] [-B num] [-C[num]]\n"
 #endif  #endif
             "\t[-e pattern] [-f file] [--binary-files=value] [--context[=num]]\n"              "\t[-e pattern] [-f file] [--binary-files=value] [--context[=num]]\n"
             "\t[--line-buffered] [pattern] [file ...]\n", __progname);              "\t[--line-buffered] [pattern] [file ...]\n", __progname);
Line 120 
Line 116 
 }  }
   
 #ifdef NOZ  #ifdef NOZ
 static char *optstr = "0123456789A:B:CEFGHILPSRUVabce:f:hilnoqrsuvwxy";  static char *optstr = "0123456789A:B:CEFGILRUVabce:f:hilnqrsuvwxy";
 #else  #else
 static char *optstr = "0123456789A:B:CEFGHILPSRUVZabce:f:hilnoqrsuvwxy";  static char *optstr = "0123456789A:B:CEFGILRUVZabce:f:hilnqrsuvwxy";
 #endif  #endif
   
 struct option long_options[] =  struct option long_options[] =
Line 317 
Line 313 
                         Eflag = Fflag = 0;                          Eflag = Fflag = 0;
                         Gflag++;                          Gflag++;
                         break;                          break;
                 case 'H':  
                         Hflag++;  
                         break;  
                 case 'I':                  case 'I':
                         binbehave = BIN_FILE_SKIP;                          binbehave = BIN_FILE_SKIP;
                         break;                          break;
Line 327 
Line 320 
                         lflag = 0;                          lflag = 0;
                         Lflag = qflag = 1;                          Lflag = qflag = 1;
                         break;                          break;
                 case 'P':  
                         Pflag++;  
                         break;  
                 case 'S':  
                         Sflag++;  
                         break;  
                 case 'R':                  case 'R':
                 case 'r':                  case 'r':
                         Rflag++;                          Rflag++;
                         oflag++;  
                         break;                          break;
                 case 'U':                  case 'U':
                         binbehave = BIN_FILE_BIN;                          binbehave = BIN_FILE_BIN;
Line 370 
Line 356 
                         needpattern = 0;                          needpattern = 0;
                         break;                          break;
                 case 'h':                  case 'h':
                         oflag = 0;  
                         hflag = 1;                          hflag = 1;
                         break;                          break;
                 case 'i':                  case 'i':
Line 385 
Line 370 
                 case 'n':                  case 'n':
                         nflag = 1;                          nflag = 1;
                         break;                          break;
                 case 'o':  
                         hflag = 0;  
                         oflag = 1;  
                         break;  
                 case 'q':                  case 'q':
                         qflag = 1;                          qflag = 1;
                         break;                          break;
Line 472 
Line 453 
         if (lbflag)          if (lbflag)
                 setlinebuf(stdout);                  setlinebuf(stdout);
   
         if ((argc == 0 || argc == 1) && !oflag)          if ((argc == 0 || argc == 1) && !Rflag)
                 hflag = 1;                  hflag = 1;
   
         if (argc == 0)          if (argc == 0)

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40