Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!killer!ames!mailrus!ukma!rutgers!soleil!geigel From: geigel@soleil.UUCP (jogle) Newsgroups: comp.lang.pascal Subject: Re: Help with VAX Pascal Summary: It's not pretty. Message-ID: <421@soleil.UUCP> Date: 11 Oct 88 20:55:50 GMT References: <5900@june.cs.washington.edu> <5214@juniper.uucp> <1096@leah.Albany.Edu> Organization: somewhere over the rainbow Lines: 66 In article <1096@leah.Albany.Edu>, bbw842@leah.Albany.Edu (Barry B Werger) writes: > > Does anyone know how to receive a command-line parameter in VAX Pascal? Actually, this is a problem in VAX Pascal. We figured out a solution but it's certainly far from clean. We use the VAX system routine lib$get_foreign. A sample piece of code using this might look like: [inherit ('sys$library:starlet.pen')] program moo; type string80 = packed array [1..80] of char; string25 = packed array [1..25] of char; w_integer = [WORD]0..32767; var command_Line: string80; prompt: string25; (* prompt if no command line is given *) status: unsigned; length: w_integer; (* Length of command line returned *) x: integer; (* Determines if prompting is to be done *) [EXTERNAL]function lib$get_foreign (%stdescr in_line : string80; %stdescr prompt_st:string25 VAR out_len : w_integer; VAR x : integer) : integer; EXTERNAL; begin (* moo *) prompt:= 'prompt here '; status := lib$get_foreign (command_Line,prompt,out_len,x); ... end (* moo *). After calling lib$get_foreign, the command line will be in command_Line. Note that you have to parse this string in order to extract each parameter. (Its not like an argv array in C, its whatever was typed after the command name). You don't have to specify a prompt. We don't use promping here, and we never tried it. You can find more specific information about this routine, as well as the status codes that the function returns, in the VAX Run-time library manual. (they may also be on line. Run help and look under topic RTL-Routines.). Once you compile and link the program, you must assign the executable name to a symbol and then to run the program, type in the symbol then the rest of the command line. For example, if my executable is disk01:[jmg]moo.exe, then at the VAX prompt, one would type: $ gorf:==$disk01:[jmg]moo to run moo (with a command line), one types: $ gorf commandline Hopes this helps. good luck. -- jogle