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.2 $
- $Author: fjc $
- $Date: 1994/08/08 16:59:51 $
-
- 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.
-
- *************************************************************************)
-
- MODULE PrArgs;
-
- (*
- ** $C= CaseChk $I= IndexChk $L= LongAdr $N= NilChk
- ** $P- PortableCode $R= RangeChk $S= StackChk $T= TypeChk
- ** $V= OvflChk $Z= ZeroVars
- *)
-
- IMPORT SYS := SYSTEM, Dos, Args, IO := StdIO;
-
- CONST
- VersionTag = "\0$VER: PrArgs 1.0 (18.6.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.base.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.base.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.base.Delay (500)
- END;
- END PrArgs.
-
- (*************************************************************************
-
- $Log: PrArgs.mod $
- 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
-
- *************************************************************************)
-
-