home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / pascal / 5044 < prev    next >
Encoding:
Text File  |  1992-08-25  |  1.3 KB  |  44 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!decwrl!deccrl!news.crl.dec.com!rdg.dec.com!ryn.mro4.dec.com!mrdood.enet.dec.com!mdoody
  3. From: mdoody@bump.enet.dec.com (Michael Doody)
  4. Subject: Re: How can I retrieve the command string from within Pascal program ?
  5. Message-ID: <1992Aug25.180355.22056@ryn.mro4.dec.com>
  6. Lines: 31
  7. Sender: mdoody@mrdood.enet.dec.com (Michael Doody)
  8. Reply-To: mdoody@bump.enet.dec.com
  9. Organization: Digital Equipment Corporation
  10. References:  <13453.2a9509ab@ohstpy.mps.ohio-state.edu>
  11. Date: Tue, 25 Aug 1992 18:03:55 GMT
  12.  
  13.  
  14.  
  15. >  How could one retrieve the on-line program parameters,
  16. >such as the program name, or the whole command string
  17. >from within the pascal program  ?
  18.  
  19.     Since you are using VAX Pascal, you have two choices:
  20.  
  21.     1) Define your program using $ SET COMMAND and then use the 
  22.        $CLI routines to parse the command line arguments.
  23.  
  24.     2) Define your program as a foreign command  using $ prog :== $prog.exe
  25.        and use the Run Time Library routine LIB$GET_FOREIGN.
  26.  
  27.     #1 is the standard VMS method, #2 is quicker.
  28.  
  29.     [inherit('sys$library:lib_routines')]
  30.     program temp( input, output )
  31.     
  32.     VAR
  33.         command_line    : VARYING [132] OF CHAR;
  34.         sys_stat    : INTEGER;
  35.  
  36.     BEGIN
  37.     sys_stat := LIB$GET_FOREIGN( command_line.body,,command_line.length );
  38.     if not odd( sys_sat ) then lib$stop( sys_stat );
  39.  
  40.     WRITELN( 'Command line is ', command_line );
  41.     END;
  42.  
  43. Mike
  44.