home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / grep20.zip / patches.os2 < prev    next >
Text File  |  1993-10-15  |  3KB  |  95 lines

  1. *** orig/grep.c    Sun May 23 06:52:52 1993
  2. --- grep.c    Wed Oct 13 17:07:24 1993
  3. *************** usage()
  4. *** 573,582 ****
  5. --- 573,612 ----
  6.   {
  7.     fprintf(stderr, USAGE, prog);
  8.     exit(2);
  9.   }
  10.   
  11. + static void
  12. + help()
  13. + {
  14. +   fprintf( stderr, USAGE, prog);
  15. +   fprintf( stderr, "GNU e?grep understands the following command line options:\n" );
  16. +   fprintf( stderr, "    -A <num>    print <num> lines of context after every matching line\n" );
  17. +   fprintf( stderr, "    -B <num>    print <num> lines of context before every matching line\n" );
  18. +   fprintf( stderr, "    -C        print 2 lines of context on each side of every match\n" );
  19. +   fprintf( stderr, "    -E        run egrep\n" );
  20. +   fprintf( stderr, "    -F        run fgrep\n" );
  21. +   fprintf( stderr, "    -E        run grep\n" );
  22. +   fprintf( stderr, "    -L        list files not containing matches only\n" );
  23. +   fprintf( stderr, "    -X <matcher>    run <matcher> (grep, egrep or fgrep)\n" );
  24. +   fprintf( stderr, "    -V        print the version number on stderr\n" );
  25. +   fprintf( stderr, "    -<num>        print <num> lines of context on each side\n" );
  26. +   fprintf( stderr, "    -b        print every match preceded by its byte offset\n" );
  27. +   fprintf( stderr, "    -c        print a total count of matching lines only\n" );
  28. +   fprintf( stderr, "    -e <expr>    search for <expr>; useful if <expr> begins with -\n" );
  29. +   fprintf( stderr, "    -f <file>    take <expr> from the given <file>\n" );
  30. +   fprintf( stderr, "    -h        don't display filenames on matches\n" );
  31. +   fprintf( stderr, "    -i        ignore case difference when comparing strings\n" );
  32. +   fprintf( stderr, "    -l        list files containing matches only\n" );
  33. +   fprintf( stderr, "    -n        print each match preceded by its line number\n" );
  34. +   fprintf( stderr, "    -s        run silently producing no output except error messages\n" );
  35. +   fprintf( stderr, "    -v        print only lines that contain no matches for the <expr>\n" );
  36. +   fprintf( stderr, "    -w        print only lines where the match is a complete word\n" );
  37. +   fprintf( stderr, "    -x        print only lines where the match is a whole line\n" );
  38. +   exit(2);
  39. + }
  40. +   
  41.   /* Go through the matchers vector and look for the specified matcher.
  42.      If we find it, install it in compile and execute, and return 1.  */
  43.   int
  44.   setmatcher(name)
  45.        char *name;
  46. *************** main(argc, argv)
  47. *** 604,616 ****
  48. --- 634,654 ----
  49.     int opt, cc, desc, count, status;
  50.     FILE *fp;
  51.     extern char *optarg;
  52.     extern int optind;
  53.   
  54. + #if defined __EMX__
  55. +   _wildcard( &argc, &argv );
  56. + #endif __EMX__  
  57.     prog = argv[0];
  58.     if (prog && strrchr(prog, '/'))
  59.       prog = strrchr(prog, '/') + 1;
  60. + #if defined MSDOS | defined OS2
  61. +   if (prog && strrchr(prog, '\\'))
  62. +     prog = strrchr(prog, '\\') + 1;
  63. + #endif    
  64.   
  65.     keys = NULL;
  66.     keycc = 0;
  67.     keyfound = 0;
  68.     count_matches = 0;
  69. *************** main(argc, argv)
  70. *** 757,767 ****
  71.         {
  72.       keys = argv[optind++];
  73.       keycc = strlen(keys);
  74.         }
  75.       else
  76. !       usage();
  77.   
  78.     if (!matcher)
  79.       matcher = prog;
  80.   
  81.     if (!setmatcher(matcher) && !setmatcher("default"))
  82. --- 795,805 ----
  83.         {
  84.       keys = argv[optind++];
  85.       keycc = strlen(keys);
  86.         }
  87.       else
  88. !       help();
  89.   
  90.     if (!matcher)
  91.       matcher = prog;
  92.   
  93.     if (!setmatcher(matcher) && !setmatcher("default"))
  94.