home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 22 gnu
/
22-gnu.zip
/
grep20.zip
/
patches.os2
< prev
next >
Wrap
Text File
|
1993-10-15
|
3KB
|
95 lines
*** orig/grep.c Sun May 23 06:52:52 1993
--- grep.c Wed Oct 13 17:07:24 1993
*************** usage()
*** 573,582 ****
--- 573,612 ----
{
fprintf(stderr, USAGE, prog);
exit(2);
}
+ static void
+ help()
+ {
+ fprintf( stderr, USAGE, prog);
+ fprintf( stderr, "GNU e?grep understands the following command line options:\n" );
+ fprintf( stderr, " -A <num> print <num> lines of context after every matching line\n" );
+ fprintf( stderr, " -B <num> print <num> lines of context before every matching line\n" );
+ fprintf( stderr, " -C print 2 lines of context on each side of every match\n" );
+ fprintf( stderr, " -E run egrep\n" );
+ fprintf( stderr, " -F run fgrep\n" );
+ fprintf( stderr, " -E run grep\n" );
+ fprintf( stderr, " -L list files not containing matches only\n" );
+ fprintf( stderr, " -X <matcher> run <matcher> (grep, egrep or fgrep)\n" );
+ fprintf( stderr, " -V print the version number on stderr\n" );
+ fprintf( stderr, " -<num> print <num> lines of context on each side\n" );
+ fprintf( stderr, " -b print every match preceded by its byte offset\n" );
+ fprintf( stderr, " -c print a total count of matching lines only\n" );
+ fprintf( stderr, " -e <expr> search for <expr>; useful if <expr> begins with -\n" );
+ fprintf( stderr, " -f <file> take <expr> from the given <file>\n" );
+ fprintf( stderr, " -h don't display filenames on matches\n" );
+ fprintf( stderr, " -i ignore case difference when comparing strings\n" );
+ fprintf( stderr, " -l list files containing matches only\n" );
+ fprintf( stderr, " -n print each match preceded by its line number\n" );
+ fprintf( stderr, " -s run silently producing no output except error messages\n" );
+ fprintf( stderr, " -v print only lines that contain no matches for the <expr>\n" );
+ fprintf( stderr, " -w print only lines where the match is a complete word\n" );
+ fprintf( stderr, " -x print only lines where the match is a whole line\n" );
+ exit(2);
+ }
+
/* Go through the matchers vector and look for the specified matcher.
If we find it, install it in compile and execute, and return 1. */
int
setmatcher(name)
char *name;
*************** main(argc, argv)
*** 604,616 ****
--- 634,654 ----
int opt, cc, desc, count, status;
FILE *fp;
extern char *optarg;
extern int optind;
+ #if defined __EMX__
+ _wildcard( &argc, &argv );
+ #endif __EMX__
+
prog = argv[0];
if (prog && strrchr(prog, '/'))
prog = strrchr(prog, '/') + 1;
+ #if defined MSDOS | defined OS2
+ if (prog && strrchr(prog, '\\'))
+ prog = strrchr(prog, '\\') + 1;
+ #endif
keys = NULL;
keycc = 0;
keyfound = 0;
count_matches = 0;
*************** main(argc, argv)
*** 757,767 ****
{
keys = argv[optind++];
keycc = strlen(keys);
}
else
! usage();
if (!matcher)
matcher = prog;
if (!setmatcher(matcher) && !setmatcher("default"))
--- 795,805 ----
{
keys = argv[optind++];
keycc = strlen(keys);
}
else
! help();
if (!matcher)
matcher = prog;
if (!setmatcher(matcher) && !setmatcher("default"))