Path: utzoo!attcan!uunet!ogicse!ucsd!ucbvax!LAUCOSC.LAURENTIAN.CA!GRANT From: GRANT@LAUCOSC.LAURENTIAN.CA ("Grant R. Guenther") Newsgroups: comp.lang.modula2 Subject: Re: Using CLI routines & Modula-2 Message-ID: Date: 12 Mar 90 15:32:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Modula2 List Organization: The Internet Lines: 55 How to get command lines from DCL with the Hamburg M2 Compiler. The first thing to realise is that you should avoid the CLI routines. They are messy and require that you compile a .CLD file to specify the syntax. Use the GetForeign interface instead. If a program is invoked through a symbol, its entire command line can be easily obtained. The following command (put it in LOGIN.COM or SYSLOGIN.COM) declares the foreign command $mycom :== $mydisk:[mydir]myprog After this, a command like $mycom anything at all will invoke mydisk:[mydir]myprog with "anything at all" as its command line. To obtain the command line in an M2 program you must do two things. First, create the following .DEF file and compile it. Leave the .SYM file in MOD$SYSTEM (then it is reusable). There is no implementation, the %FOREIGN takes care of that - the linker will find the standard LIB$GET_FOREIGN in the RTL. %FOREIGN DEFINITION MODULE Foreign; EXPORT QUALIFIED LIB$GET_FOREIGN; PROCEDURE LIB$GET_FOREIGN( VAR %STDESCR line: ARRAY OF CHAR ): CARDINAL; END Foreign. Second, in your application you should FROM Foreign IMPORT LIB$GET_FOREIGN; Then declare VAR com : ARRAY [0..79] OF CHAR; And in your initialisation code, execute IF NOT ODD(LIB$GET_FOREIGN(com)) THEN com[0] := 0C END; Now, com contains the command line, parse it as you wish. Good luck, send me mail if you have any problems Grant Guenther Maths and Computer Science, Laurentian University, Sudbury, Ontario, Canada. grant@laucosc.laurentian.ca