* Specifying parameters to a C program?
@ 1999-08-18 4:00 Kevin Lynn
1999-08-19 4:00 ` Fred Kleinsorge
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Kevin Lynn @ 1999-08-18 4:00 UTC (permalink / raw)
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?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Specifying parameters to a C program?
1999-08-18 4:00 Specifying parameters to a C program? Kevin Lynn
` (2 preceding siblings ...)
1999-08-19 4:00 ` sol gongola
@ 1999-08-19 4:00 ` Arlen Williams
1999-08-19 4:00 ` Adrian Birkett
4 siblings, 0 replies; 6+ messages in thread
From: Arlen Williams @ 1999-08-19 4:00 UTC (permalink / raw)
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?
I see that others have answered your question, but in the future there
is a newsgroup comp.os.vms just for specific VMS questions.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Specifying parameters to a C program?
1999-08-18 4:00 Specifying parameters to a C program? Kevin Lynn
@ 1999-08-19 4:00 ` Fred Kleinsorge
1999-08-19 4:00 ` Richard Tomkins
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Fred Kleinsorge @ 1999-08-19 4:00 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Specifying parameters to a C program?
1999-08-18 4:00 Specifying parameters to a C program? Kevin Lynn
1999-08-19 4:00 ` Fred Kleinsorge
@ 1999-08-19 4:00 ` Richard Tomkins
1999-08-19 4:00 ` sol gongola
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Richard Tomkins @ 1999-08-19 4:00 UTC (permalink / raw)
$ prog :== $mydirectory:myprog.exe
$ prog -1 -2 -3
The dollar sign in column 1 is the standard OpenVMS prompt.
The dollar sign in string equate will translate into run myprog.exe, but
unless you specify your directory or the actual location of your executable,
the system will default to running myprog.exe in sys$system.
The second line is of course, the actual run of your program, with it's
parameters and you should be able to pick them up with argc and argv.
rtt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Specifying parameters to a C program?
1999-08-18 4:00 Specifying parameters to a C program? Kevin Lynn
1999-08-19 4:00 ` Fred Kleinsorge
1999-08-19 4:00 ` Richard Tomkins
@ 1999-08-19 4:00 ` sol gongola
1999-08-19 4:00 ` Arlen Williams
1999-08-19 4:00 ` Adrian Birkett
4 siblings, 0 replies; 6+ messages in thread
From: sol gongola @ 1999-08-19 4:00 UTC (permalink / raw)
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?
assuming myprog resides in drive:[dirspec], yo can use either of:
$mc drive:[dirspec]myprog -i param1 -a param2
or
$mycmd :== $drive:[dirspec]myprog.exe ! define a foreign command
then use
$mycmd -i param1 -a param2
sol
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Specifying parameters to a C program?
1999-08-18 4:00 Specifying parameters to a C program? Kevin Lynn
` (3 preceding siblings ...)
1999-08-19 4:00 ` Arlen Williams
@ 1999-08-19 4:00 ` Adrian Birkett
4 siblings, 0 replies; 6+ messages in thread
From: Adrian Birkett @ 1999-08-19 4:00 UTC (permalink / raw)
Just to add to the other replies;
I am not a C programmer, but in macro, I use LIB$GET_FOREIGN in conjunction
with defining foreign commands to run programs to read the remainder of the
command line. I use this when parameters are required because if it doesn't
find anything on the command line, it will prompt for it.
Ade
-- My own opinion --
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?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1999-08-19 4:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-08-18 4:00 Specifying parameters to a C program? Kevin Lynn
1999-08-19 4:00 ` Fred Kleinsorge
1999-08-19 4:00 ` Richard Tomkins
1999-08-19 4:00 ` sol gongola
1999-08-19 4:00 ` Arlen Williams
1999-08-19 4:00 ` Adrian Birkett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox