home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / MODULAV2GERMAN.DMS / in.adf / Def.zoo / Arguments.def next >
Encoding:
Modula Definition  |  1988-11-29  |  1.5 KB  |  54 lines

  1. (* $N- *)
  2. DEFINITION MODULE Arguments;
  3. (* 29.11.88 / ms *)
  4.  
  5. FROM Dos IMPORT
  6.  FileLockPtr;
  7.  
  8. (*
  9.  * Arguments supports access to user supplied program arguments. These
  10.  * are command line arguments or workbench arguments depending on the
  11.  * program activation.
  12.  * If an argument comes with len=0 and its number is valid
  13.  * ( 1 <= nr <= NumArgs() ) then it specifies the current directory.
  14.  *)
  15.  
  16. VAR
  17. (*
  18.  * quoted indicates that the last argument contained quotes
  19.  *)
  20.  quoted: BOOLEAN;
  21.  
  22. (*
  23.  * NumArgs returns the number of arguments available. 
  24.  *)
  25. PROCEDURE NumArgs(): INTEGER;
  26.  
  27. (*
  28.  * GetArg returns the i-th argument from the argument list. If the program
  29.  * is started from CLI the command line is parsed. Quotes are interpreted
  30.  * slightly different as from DOS commands or C-startup code. All text
  31.  * between two quotes is taken literally. Quotes may occur at any position
  32.  * in an argument (see example). With workbench startup GetArg changes the
  33.  * directory (CurrentDir) to the directory of the requested argument and
  34.  * returns the argument name. GetArg(0...) returns the name of the currently
  35.  * executed program.
  36.  *
  37.  * Examples for CLI Arguments:
  38.  *
  39.  * 1> command "Hello World"
  40.  * 1> command Hello" "World
  41.  * 1> command Hell"o World"
  42.  *
  43.  * All these calls give >Hello World< as argument.
  44.  *)
  45. PROCEDURE GetArg(arg: INTEGER; VAR argument: ARRAY OF CHAR; VAR len: INTEGER);
  46.  
  47. (*
  48.  * sometimes it is useful to get the directory lock associated with the
  49.  * arguments directory. Works only if started from WB
  50.  *)
  51. PROCEDURE GetLock(arg: INTEGER): FileLockPtr;
  52.  
  53. END Arguments.
  54.