home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / fileutil / tcggrep2.arj / TURBO.DOC < prev   
Encoding:
Text File  |  1991-01-08  |  4.3 KB  |  96 lines

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