/* field.c -- UTOOL.  select fields from a file

     author: David H. Wolen
     last change:  11/14/83

     usage:  field  n1 n2 ...

     input:  STDIN
     output: STDOUT

     notes:    (a)  fields are numbered from 1
               (b)  a field may be selected more than once
               (c)  fields are separated by commas on input and output
               (d)  maximum input and output line length is 149 characters
               (e)  maximum number of input fields is 70

*/
/*  fieldcc.c -- UTOOL. Select column delimited fields from a file

     author: David H. Wolen
     last change: 5/26/84

     usage: fieldcc <infile >outfile  n1-n2 n3-n4 ...
            fieldcc <infile >outfile 1-5 8-12 6-7

     input:    STDIN
     output:   STDOUT

     notes:  (a) ni are origin 1.
             (b) if a field is invalid for a particular line, the output
                 for that field will be null.
             (c) a maximum of 10 fields are allowed

*/
/* find.c -- UTOOL. Find patterns in text files (ver. 3.1) 

     author: David H. Wolen
     last change: 12/18/83

     usage:     find [-axn] pattern1 [pattern2 ... pattern10]

     options:  -a   output lines which contain all patterns
                    (default is output lines matching any pattern)
               -x   output lines that fail the match criteria
               -n   line numbers for output
               -c   just output count of matching lines
               -f   fold (ignore case in character comparisons)

     input:    STDIN
     output:   STDOUT

     notes:    1. -x pat1 pat2 : output if line contains neither pat
               2. -ax pat1 pat2 : output if line doesn't contain both pats
               3. metacharacters in pattern
                    %    match pattern at beginning of line
                    # #  enclose capital letters
                    " "  enclose embedded blanks
                    ?    match any char except newline
                    $    end of line
                    [c1-c2]  character class
                    [!c1-c2] negated character class
                    *    closure (0 or more occurrences of prev pattern)
                    escaped chars:  \n (newline)  \t (tab)  \r (cr)
                         \f (form feed)  \b (backspace)  \q (")  \p (#)
               4. first pattern can't begin with "-"
               5. up to MAXPATS patterns allowed (currently 10)
               6. if -c and -n, the latter will be ignored
               7. version 3.1 handles continued input lines indicated by
                  & in column one.  The max continued line length is 2048 
                  char.  With keyboard input and output, there is now a lag
                  since it has to see if the following line begins with &.


*/
/* findmf.c -- UTOOL. Simple pattern match with multiple file input 
     (including wildcards).  Ignores case.

     author: David H. Wolen
     last change: 12/14/83

     usage:  findmf pat filespec
               findmf pat *.c
               findmf pat *.* !*.com    (the *.* is required for this program)
               findmf pat fn.ft fn.ft fn.ft
               findmf pat test?.c
               findmf "last change" *.c

     input:  files
     output: STDOUT

     notes: (a) wildcards of * (match one or more characters) and ? (match a
                single character) are allowed in filespec
            (b) the construction *.* !*.com means all files except .com
            (c) drive prefixes are allowed
            (d) output lines are prefixed with file name
            (e) the expanded filespec can't contain more than 200 files

*/
/* lpr.c -- UTOOL. Send stdin to printer

     author: David H. Wolen
     last change: 10/14/84

     usage:    prog |lpr -lnp 5 55
               lpr <file

     options:  -l  left margin (default 8)
               -n  lines per page (default 50)
               -p  pause after each page. <cr> to
                   resume, anything else to quit.
                   (default false)


     input:    STDIN
     output:   printer

     notes:    (1)  form feed after each page and at eof
               (2)  if both -l and -n are used, margin
                    value must preceed page size value.
               (3)  handles tabs (tabs every 8 spaces)
               (4)  ignores any imbedded form feeds in input


*/
/*  sort.c -- UTOOL. (ver. 2.2) Incore sort of ascii lines.
     Max file size 2000 lines or about 30K.

     author: David H. Wolen
     last change: 9/22/85

     usage: sort <infile >outfile
            sort <infile -kf 1-5 8-12 6-7

     options:  -f fold lower into upper case before comparison
               -k key fields (n1-n2)  10 max
                    if no key fields and no numeric, whole line is used
               -r reverse
               -n numeric (first item on line must be int)
                    neither -f nor -k can be used with -n
               -u unique (according to current sort def of equal)

     input:    STDIN
     output:   STDOUT

     note:   version 2.1 handles continued input lines indicated by
             & in column one.  The max continued line length is 2048 
             char.  With keyboard input and output, there is now a lag
             since it has to see if the following line begins with &.

*/
/* tabs.c -- UTOOL. Convert tabs to blanks (-d) or blanks
     to tabs and blanks (-e).

     author: David H. Wolen
     last change:  10/21/83

     usage:    tabs -d
               tabs -e 5 21 &5

     options:  -d   detab (convert tab chars to  blanks)
               -e   entab (convert blanks to tab chars and blanks)

     input:    STDIN
     output:   STDOUT

     notes:    (1) either -d or -e is required
               (2) default tab stops are at columns 1, 9, 17, 25, ...
               (3) &n in the command line sets tabs every n columns.
                   E.G. "5 21 &5" sets tabs at columns 5, 21, 26, 31, ...
                   Anything after the &n will be ignored.

*/
output:   STDOUT

     note:   version 2.1 handles continued input lines indicated by
             