From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,b8af4c15521994f7 X-Google-Attributes: gid1164f8,public From: Fred Kleinsorge Subject: Re: Specifying parameters to a C program? Date: 1999/08/19 Message-ID: <37BBF648.27E119F3@star.enet.dec_nospam.com>#1/1 X-Deja-AN: 515149122 Content-Transfer-Encoding: 7bit References: <7pf1gt$g56$1@news.wrc.xerox.com> Organization: OpenVMS Engineering Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: comp.sys.dec Kevin Lynn wrote: > > I'm having trouble guessing how to specify command line parameters to a C > program under VMS. > > What I'd like to do is something like: > > $run myprog -i param1 -a param2 > > so that -i, param1, -a, and param2 are passed to main() in the argv[]. > > Anyone know how to do this under VMS? To make your VMS system act more like UNIX, define the logical name DCL$PATH in your login.com file. For instance: $ define/nolog dcl$path [], sys$system then when you type in an unknown command, DCL will search for an executable image with the command name in the areas listed. If it doesn't find an executable, then it will look for a command file. So typing FOO will seach for []FOO.EXE and then SYS$SYSTEM:FOO.EXE, then []FOO.COM and SYS$SYSTEM:FOO.COM. The traditional way to explicitly define a foreign command is to do: $ foo :== $mydir:foo.exe which creates a foreign command called foo. In either case, argc and argv[] will contain the command line args (the command line in argv[0], first argument parsed from white space in argv[1], etc. Note that unless you put an argument in quotes, everything is set to lower case.