Arguments.def 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. DEFINITION MODULE Arguments;
  2. (*
  3. Module: Access to program arguments and environment
  4. Author: Ceriel J.H. Jacobs
  5. Version: $Id$
  6. *)
  7. VAR Argc: CARDINAL; (* Number of program arguments, including the program
  8. name, so it is at least 1.
  9. *)
  10. PROCEDURE Argv( argnum : CARDINAL;
  11. VAR argument : ARRAY OF CHAR
  12. ) : CARDINAL;
  13. (* Stores the "argnum'th" argument in "argument", and returns its length,
  14. including a terminating null-byte. If it returns 0, the argument was not
  15. present, and if it returns a number larger than the size of "argument",
  16. "argument" was'nt large enough.
  17. Argument 0 contains the program name.
  18. *)
  19. PROCEDURE GetEnv( name : ARRAY OF CHAR;
  20. VAR value : ARRAY OF CHAR
  21. ) : CARDINAL;
  22. (* Searches the environment list for a string of the form
  23. name=value
  24. and stores the value in "value", if such a string is present.
  25. It returns the length of the "value" part, including a terminating
  26. null-byte. If it returns 0, such a string is not present, and
  27. if it returns a number larger than the size of the "value",
  28. "value" was'nt large enough.
  29. The string in "name" must be null_terminated.
  30. *)
  31. END Arguments.