     This  is  a  set of Unix utilities; I mean a set of programs with
the  same  name  and purpose of various common Unix programs, and that
accept  the same switches as their Unix counterparts.  All of them are
callable  from  CLI only, and all print a short help text if scheduled
with  invalid  arguments  (try the program name followed by a question
mark,  e.g.  "head ?"); the only exception is the Unix command "find",
that  is  implemented  with  a  different name and behaviour, and with
different switches, as the Amiga program "tree".

     The  Unix  programs  are:   "head",  "tail",  "sort",  "strings",
"diff";  and, as already said, "find". A "grep" was also foreseen, but
the   "grep"  program  (from  Angela  Schmidt)  distributed  with  the
pattern.library  on  Fish  disk  625 was better than mine :-( ...  Get
that one!

-----

SORT:  AmigaDOS has already (in C:) a "sort" program; why, then, write
another  one?   A  reason  could  have  been  the wish to use the same
switches  I  am  used  to  on my Unix machine; or, perhaps, simply the
amusement  I  have  writing  programs; (any way, my version of SORT is
quicker  than  C:SORT  ;-) ...  SORT comes in three flavors, i.e.  you
will  find  three  executables:   "sort",  "s_sort"  and "b_sort"; all
related  to the same source files, but with different compile options.
"sort"  is  the  normal  version,  that  reads  the  input file(s) and
organises  their  content  in a binary tree in memory before the final
output;  "s_sort"  is a "simplified" sort that accepts only the switch
"-r"  (sort  in  reverse  order), and that performs the "alphabetical"
ordering of the file lines starting from column 1:  being that one the
most  common option, I have written a specialised and quicker version.
As an example, a file containing 1202 lines of ASCII text (47100 bytes
total)  can  be  sorted  (by  s_sort) on a vanilla A500 in less than 4
seconds,  against  the  _24_ seconds needed from c:sort (AmigaDOS 1.3:
Kickstart  34.5, Workbench 34.28).  "b_sort" is the same as "sort" but
uses  for storage a "balanced" binary tree, according to the algorithm
of  Adel'son-Vel'skij  and  Landis  as described from D.  E.  Knuth in
"The  art  of  computer programming" (Addison-Wesley) - Vol.  3, pagg.
451  -  471.   This leads to a more efficient searching along the tree
for "unbalanced" input (i.e.  for almost sorted files), but is only an
exercise in computer science without pratical effect normally; so that
you don't really need to use b_sort.

-----

DIFF:   this  is a port, to the Amiga (for the SAS C compiler), of the
GNU  "diff"  program.   It  has  been derived, with some changes, from
another  port  due  to  Martin Hohl; refer to the file DIFF_README for
more  information  about the port and about this "diff"'s options.  In
the  subdirectory  named  "Source/Diff" I have placed the original GNU
sources  and the modifications for the Amiga, with the GNU disclaimer.
This  "diff"  is  more complete than the one that SAS distributes with
his C compiler, but quite huge; you could be forced to raise the stack
when using Unix regular expressions (a requester "STACK OVERFLOW" will
appear).

-----

FIND:   "find"  is  one  of  the  most useful commands under Unix; but
instead  of  reinventing  the  wheel  writing a "find" from scratch, I
liked  better to modify an existing program:  it is "tree", from Tomas
Rokicki,  released to the public domain and published in the Fred Fish
collection  on  disk  306.  "tree", like "find", walks through all the
directories  below some starting location, and performs some action on
their   content  (but,  for  AmigaDOS,  only  on  the  "normal"  files
encountered,  and  not  on  subdirectories); only, instead of directly
performing  the required action, "tree" can build a command file that,
after having been later examined, you can execute.  You see, I hate to
perform mechanically actions that could be destructive without a check
for  unexpected  behaviours...   I  have  placed in this directory the
original README file for "tree"; what I have done is the following:

     The  program  has  been  extensively  cleaned  and rewritten.  An
option  has  been  added  to specify the starting directory, -r:  e.g.
the command "tree -r work:  ..." will list the tree directory starting
from  work: .  The  directories to be excluded can be specified giving
their full path with the option -D (e.g.:  "tree -D work:tex/pk ..."),
or  their  name only with the option -d:  "tree -d temp ..." will skip
EVERY directory in the scanned tree having name "temp".

     If  you have pattern.library (from Angela Schmidt, Fish disk 625)
installed,  you  can  specify a set of patterns separated from blanks,
after  one  of  the four options -n, +n, -N or +N; the capital N means
that  in  the  pattern  the case is significant, where the lowercase n
means  that it is NOT significant.  If the first character is a minus,
all files matching the given patterns will NOT be listed; with a plus,
ONLY  the files with names matching the given patterns will be listed.
Of  these  four options, only one can be specified.  You can still use
the  program if you do not have the pattern.library installed; but you
CANNOT use one of these four options.

     You  can specify a set of file extensions after the options -x or
+x,  with blanks between them (the case is not significant):  with -x,
all  files having the quoted extensions are EXCLUDED from the list; if
+x  has been given, ONLY the files having one of the quoted extensions
will  be  listed.   -x  and  +x  are  in  conflict, and cannot be used
together;  if both file name patterns and extensions have been used to
select  files,  the  pattern  matching  is  done  first  and  then the
extension is checked.

     The format field has been changed this way: in the format string,
  -  %p will be changed to the file path, e.g. RAM: or WORK:TEX/PK/ ;
  -  %s will be changed to the file name, e.g. TREE.C or MAKEFILE ;
  -  %b will be changed to the file size, in bytes;
  -  %d will be changed to the file date, e.g. 08-May-1986;
  -  %t will be changed to the file time, e.g. 09:10:11;
  -  %% is the character "%" itself;
  -  %q is the double quote character ("), so that files having in the
        name a blank can be surrounded with quotes: e.g. "tree >T:temp
        -f "delete %q%p%s%q" ... "  will generate a  command file that
        will delete EVERY file in the directory tree.
  -  every other character  in the format string  is simply copied  to
     stdout.


     Apart   from   "diff"   (described  in  DIFF_README)  and  "tree"
(described  in  detail  just now), here are the specific calls for the
other programs:


HEAD      Usage:   head [-N] [file [file [ ... ]]]
          Purpose: prints on stdout the first N (default: 10) lines
                   read from the given file(s), or from stdin.


TAIL      Usage:   tail [-N | +N] [file [file [ ... ]]]
          Purpose: prints on stdout the last N (default: 10)  lines
                   read from the given file(s), or from stdin. With
                   +N, skips the first N input lines and prints the
                   remainder.


SORT      Usage:   sort [-r][-f|-n][+N|-N][-tx] [file [file [ ... ]]]
          Purpose: sorts  the records  read from the  input  file(s),
                   or from stdin, to stdout.
              -r : reverse order sorting
              -n : numeric sorting              \ Default: alphabetic
              -f : folds uppercase to lowercase /          sorting
              -N : sorts starting at column N   \ Default: start
              +N : sorts respect to field N     /         at column 1
           -t... : separator  character(s)  between fields  (default:
                   space)


STRINGS   Usage:   strings [-N] [-A] [-L] [file [file [ ... ]]]
          Purpose: prints on stdout the "strings" found in the given
                   file(s), or in stdin.  A "string" is defined as a
                   sequence of  at least N  (default:  4)  printable
                   characters ended from newline or a NULL;  or as a
                   sequence of N printable characters, if the switch
                   -A (for ALL) has been given. The switch -L limits
                   printable characters to the range 0x0-0x7F,  NULL
                   to DEL, and then do not consider printables 8 bit
                   characters.
-----

     All  the  program  I  have  written are public domain, and can be
freely  used  and  distributed;  they can be also freely modified, but
please  leave  my  name in the header comments - and send me a copy of
your  changes  at one of the addresses quoted at the end of this file.
The source code is in the directory "Source". "diff" is subject to the
GNU  license,  and  the  original  "tree"  has been released as public
domain software by Tom.

-----

Special thanks to: Angela Schmidt (pattern.library);
                   Tomas Rokicki  (tree);
                   Stefan Boberg  (LhA);
                   The GNU group  (diff).

-----

          Have fun!
                                                MLO
-----

Author:  Maurizio Loreti, aka MLO or I3NOO.            
Address: University of Padova - Department of Physics   
         Via F. Marzolo, 8 - 35131 PADOVA - Italy      
Phone:   (39)(49) 844-313         FAX: (39)(49) 844-245
E-Mail:  LORETI at IPDINFN (BITNET),  or VAXFPD::LORETI
         (DECnet). VAXFPD is DECnet node 38.257 or 39169;
         INTERNET: LORETI@PADOVA.INFN.IT . All these
         addresses refer to the same computer, a VAX
         8600 owned from the Italian Agency for Research
         in High Energy Physics (I.N.F.N.).
Home: Via G. Donizetti 6 - 35010 CADONEGHE (PD) - Italy


Home setup: Amiga 500, A501, A590 20MB Hard Disk, 3 MB total memory;
            an Hewlett-Packard Deskjet 500.
Work setup: Amiga 3000 16 MHz, 50 MB Hard Disk, 6 MB total memory;
            and another Hewlett-Packard Deskjet 500.
Software: CygnusEd Professional, SAS-C 5.10, FlexeLint for the Amiga.
