home *** CD-ROM | disk | FTP | other *** search
- (*************************************************************************
-
- $RCSfile: PrArgs.mod $
- Description: A port of prargs.c from the RKM:Libraries
-
- Created by: fjc (Frank Copeland)
- $Revision: 1.4 $
- $Author: fjc $
- $Date: 1995/01/25 23:56:20 $
-
- Copyright © 1994, Frank Copeland.
- This example program is part of Oberon-A.
- See Oberon-A.doc for conditions of use and distribution.
-
- Log entries are at the end of the file.
-
- *************************************************************************)
-
- <* STANDARD- *>
-
- MODULE PrArgs;
-
- IMPORT Dos, Args, IO := StdIO;
-
- CONST
- VersionTag = "$VER: PrArgs 1.2 (19.9.94)\r\n";
-
- VAR
- ktr : LONGINT;
- olddir : Dos.FileLockPtr;
-
- BEGIN (* PrArgs *)
- IF Args.IsCLI THEN
- IO.WriteF1 ("Run from the CLI, %ld args.\n", Args.argc);
- FOR ktr := 0 TO Args.argc - 1 DO
- (* Print an arg, and its number *)
- IO.WriteF2 ("\tArg %2.2ld: '%s'.\n", ktr, Args.argv [ktr])
- END
- ELSE
- IO.WriteF1 ("Run from the Workbench, %ld args.\n", Args.NumArgs);
- FOR ktr := 0 TO Args.NumArgs - 1 DO
- IF Args.ArgList [ktr].lock # NIL THEN
- (* locks supported, change to the proper directory *)
- olddir := Dos.CurrentDir (Args.ArgList [ktr].lock);
-
- (* process the file.
- ** If you have done the CurrentDir() above, then you can
- ** access the file by its name. Otherwise, you have to
- ** examine the lock to get a complete path to the file.
- *)
- IO.WriteF2
- ( "\tArg %2.2ld (w/ lock): '%s'.\n",
- ktr, Args.ArgList [ktr].name );
-
- (* change back to the original directory when done.
- ** be sure to change back before you exit.
- *)
- olddir := Dos.CurrentDir (olddir)
- ELSE
- (* something that does not support locks *)
- IO.WriteF2
- ( "\tArg %2.2ld (no lock): '%s'.\n",
- ktr, Args.ArgList [ktr].name )
- END;
- END;
- (* wait before closing down *)
- Dos.Delay (500)
- END;
- END PrArgs.
-
- (*************************************************************************
-
- $Log: PrArgs.mod $
- Revision 1.4 1995/01/25 23:56:20 fjc
- - Release 1.5
-
- Revision 1.3 1994/09/25 18:37:50 fjc
- - Uses new syntax for external code declarations
-
- Revision 1.2 1994/08/08 16:59:51 fjc
- Release 1.4
-
- Revision 1.1 1994/06/18 22:59:44 fjc
- Initial revision
-
- *************************************************************************)
-
-
-