home *** CD-ROM | disk | FTP | other *** search
-
- This is GNU e?grep for MSDOS and Borland's Turbo C compiler
- Jim Segrave 22:35:41 Sun Nov 25 1990
- Jim Segrave 08:26:59 Thu Jan 03 1991
-
- I did some cleanups to get clean compiles from Turbo.
- I've added/altered a few things:
-
- 1) An environment variable GREP_OPTS can be used to supply
- options to grep/egrep. The environment string, if present
- will be inserted between the grep and the first argument
- to the program. You must have a single contiguous string
- of options: '-inH', whitespace will cause grep to fail -
- Eg. don't set GREP_OPTS to "-i -n -H"
-
- Enabled by -DGREP_OPTS in the makefile
-
- 2) Globbing has been modified to work on Novel networks - the
- previous version used stat() with a path name of '.', which
- failed under Novel.
-
- 3) Globbing now removes duplicate file names so that the follwing
- command would only scan fred.txt once:
- grep xxx f* *.txt
-
- 4) Additional options, -H, -I, -N have been added.
- -H forces grep to output the file name even when there is
- only a single file to scan.
- (I needed this for a uEmacs macro to process grep output.)
- -I forces case sensitive searches (to override -i in GREP_OPTS)
- -N suppresses line number output (to override -n in GREP_OPTS)
-
- Enabled by -DNEG_OPTS in the makefile
-
- 5) The pointer arithmetic in regex.c failed dismally when running
- the Khadafy regression tests. I rewrote the macro used when
- expanding the buffer so that pointers are updated correctly.
-
- 6) The usage and die routine now displays a screen full of help,
- giving virtually all the data from the man page.
-
- Enabled by -DBIG_HELP in the makefile
-
- 7) Globbing used to fail when a drive was specified with an 'access
- denied' error when looking at drives other than the default one.
- eg:
- c:>grep fred d:/alvin
- gave an error.
-
- 8) The make file and linker files make some assumptions about how
- you have TC installed. Change the path names as appropriate for
- your system.
-
- 9) I added a second environment variable NO_GLOB which, if defined,
- suppresses globbing. I needed this so that I can run a shell
- which does globbing, and command.com/ 4dos, which don't. Without
- this variable, it becomes a royal pain to pass a regex to grep,
- since sh unglobs and strips quotes, then grep globbed again with the
- regex. When running sh, you can set NO_GLOB, and pass regexes in a
- single set of quotes. (See note 13 for a better solution for MKS).
-
- 10) grep/egrep passed all the regression tests except the two which
- pass multiple words to egrep - tests 114 and 115. Under MKS,
- the quotes were being stripped and the 'multiple words' string
- was passed unquoted to grep. Grep's startup code then parsed
- this into two separate argv's and complained that words is not
- a file. Forcing a second set of quotes: '"multiple words"',
- cures the problem.
- Fixed by the MKS environment variable - see note 13
-
- 11) Anothe makefile variable - UNDER_WORD - forces grep to consider
- underscore as part of a word. It fits my style of C and assembler
- coding to make this assumption.
-
- 12) The macro EXTRACT_PROGRAM_NAME in msdosmac.h failed if you are using
- forward slash as a directory separator and there is a '.' in the
- path.
-
- 13) Yet another makefile variable - MKSARGS. When set, grep will look for
- an environment variable 'MKS'. If it is defined, globbing is suppresses
- and grep obtains its arguments from the environmnet variables set up
- by the MKS toolkit. This option deals with the funny parsing of command
- lines by MKS and allows the MKS globber to pass command lines which would
- otherwise exceed 128 characters. If you use both MKS and command.com,
- the MKS environment should set an environment variable MKS to any
- arbitrary value. I preferred to use this rather than a check of
- COMSPEC for a SHELL=...sh.exe, since there may well be other shells called
- sh which do not pass arguments via the environment. If MKS is defined
- (and the make is done with MKSARGS defined), it will over-ride the
- presence/absence of the NO_GLOB environment variable, and globbing will
- be supressed. This option also fixes the problems caused by MKS
- stripping quotes from the command line, causing patterns containing
- whitespace to be mis-interpreted by grep.
-
-
-