home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / dev / amiga_e-2.1b.lha / Amiga_E-2.1b / Docs / Utilities / GetLength.doc next >
Encoding:
Text File  |  1993-10-05  |  5.3 KB  |  163 lines

  1.  
  2.  
  3.                               GetLength
  4.                               ~~~~~~~~~
  5.  
  6.                     A small utility  for the Shell
  7.                           By Diego Caravana
  8.  
  9.                          Actual Version: 1.0
  10.  
  11.                                  ---
  12.  
  13.  
  14.                             1. Legal Stuff
  15.                             ==============
  16.  
  17.  GetLength  is  placed  in  the Public Domain for the Amiga.
  18.  No  fee  is  requested  to  use it, nor anyone can ask anything for it
  19.  (except for the media).  Feel free to use it, but AT YOUR OWN RISK, as
  20.  I  cannot  be  considered  responsible  for  any damage caused to your
  21.  system.  Have Fun!
  22.  
  23.  
  24.                             2. What is it?
  25.                             ==============
  26.  
  27.  GetLength  is a small utility that I have written mainly for me, but I
  28.  think  it can be very useful also for you.  It is a Shell-only program
  29.  and  its  work  should be clear:  it gets the length (in bytes) of the
  30.  specified  file  and store it in an environment variable (either local
  31.  or  global) or prints it, enabling you to use it in your Shell scripts
  32.  (or for what you want :) in a very simple way.
  33.  
  34.  
  35.                             3. How to use
  36.                             =============
  37.  
  38.  It requires OS 2.04+.
  39.  As said above, GetLength is a Shell-only program, so do not try to use
  40.  from  Workbench.   It  uses  the  standard  parser  of OS 2.x.  Try to
  41.  execute  GetLength  with  a `?' as argument and you will get something
  42.  like this:
  43.  
  44.     FILENAME/A,VAR=VARIABLE/K,GLOBAL/S,STDOUT/S
  45.  
  46.  Now, a little explanations of arguments:
  47.  
  48.     FILENAME/A      here you MUST supply the file name  whose  you want
  49.                     know the length; if you do not do, there will be an
  50.                     error.
  51.  
  52.     VAR=VARIABLE/K  is the name of the environment variable that will
  53.                     contain the input of the user; it must obey to the
  54.                     rules of DOS; the default is `GetLengthResult'.
  55.                     Do not mix with STDOUT keyword.
  56.  
  57.     GLOBAL/S        if present , the variable will be global (setenv);
  58.                     the default is a local variable (set). Do not mix
  59.                     with STDOUT keyword.
  60.  
  61.     STDOUT/S        if present, the resulting string will be printed
  62.                     in  stdout  (i.e.  on  the  Shell  you  started
  63.                     GetLength) and not stored in any variable.
  64.  
  65.  The  keywords  above  followed by `/K' MUST appear in the command line
  66.  followed by their argument.  Those followed by `/S' act like switches,
  67.  i.e.   if  they  appear,  the  corresponding feature will be enabled.
  68.  Remember to use apices when necessary!
  69.  
  70.  A simple example of how to use GetLength is given below:
  71.  
  72.     ; stuff...
  73.  
  74.     GetLength MAIL:TrapDoor.log VAR tmpLen
  75.     if $tmpLen GE 50000
  76.         delete TrapDoor.log
  77.     endif
  78.  
  79.     ; or even...
  80.  
  81.     if `GetLength MAIL:TrapDoor.log STDOUT` GE 50000
  82.         delete TrapDoor.log
  83.     endif
  84.  
  85.     ; even more stuff...
  86.  
  87.  Note  that above in the first GetLength line, you must NOT include the
  88.  `$'  sign  before  the  variable  name!   Once  more,  note the use of
  89.  backquote  (a  new  2.0+  feature!)  in the second GetLength line:  it
  90.  means  that  what  will  be  printed by the `backquoted' command, will
  91.  became a parameter for if (in this case) and will be no more printed.
  92.  
  93.  As  you can see, GetLength can be useful for treating files which tend
  94.  to  became  larger  and  larger,  allowing  to  automatize  a job that
  95.  frequently  is done manually.  Utilities like mine exist, but they are
  96.  constructed on a time base (do this every hour, week, etc.) instead of
  97.  on a length base, which I think is better and more precise.
  98.  
  99.  
  100.                            4. The Language
  101.                            ===============
  102.  
  103.  I  have used E language to write GetLength.  What?  E ?!  Yea!  Go and
  104.  see the source !!!  :-)
  105.  But  Why?   Because  it  is  a  very  powerful  simple-to-use language
  106.  dedicated  explicitly  to  our Amiga, influenced by C and Modula-2, so
  107.  you  can  imagine  its  power.  It offers an incredibly vast number of
  108.  features, like high speed in compiling, extremely compact executables,
  109.  inline  assembly,  direct  access  to Amiga Shared Libraries, powerful
  110.  type system, exception handling, etc.
  111.  
  112.  Cool, eh?  Try it, if you do not believe to your eyes ! :-)
  113.  The author of E language is:
  114.  
  115.       Wouter van Oortmerssen ($#%!)
  116.       Levendaal 87
  117.       2311 JG  Leiden
  118.       HOLLAND
  119.   
  120.   If you have access to Email:
  121.  
  122.       Wouter@alf.let.uva.nl    (E-programming support)
  123.   or: Wouter@mars.let.uva.nl   (personal)
  124.   or: Oortmers@gene.fwi.uva.nl (other)
  125.  
  126.  
  127.                             5. The Author
  128.                             =============
  129.  
  130.  If you want to send me bug-reports or a time-bomb *:), I can be
  131.  contacted in the following manners:
  132.  
  133.     by snail-mail
  134.  
  135.         Diego Caravana
  136.  
  137.         V. Liguria, 24
  138.         10071 Borgaro (TO)
  139.         Italy
  140.  
  141.     by e-mail
  142.  
  143.         `Diego Caravana'  on
  144.  
  145.         FIDO       2:334/308
  146.                    2:334/308.9
  147.         AMIGANET   39:101/3
  148.  
  149.         Internet   Diego.Caravana%bbs@osra.sublink.org
  150.  
  151.  To  find  me and the E language stuff, you can call the BBS on which I
  152.  am CoSysOp (located in Turin, Italy):
  153.  
  154.        *The New ATH*
  155.         ~~~~~~~~~~~
  156.         TEL       +39-11-5629284
  157.                   +39-11-5629290
  158.         FIDO      2:334/308
  159.         AMIGANET  39:101/3
  160.         Internet  <soon>
  161.  
  162.  
  163.