Command line parameters with VAX C?
Martin v.d. Boogaard
nboogaar at ruunsa.fys.ruu.nl
Wed Jan 3 19:17:20 AEST 1990
There are two ways to do the job.
1. Use argc and argv like you do on any other system. You saw that you can't
type
RUN MYCODE PAR1 PAR2 <ret>
because RUN expects only the name of the executable it should load. The
simple solution is to define (e.g. in LOGIN.COM)
MYC*ODE :== $MYCODE <ret>
which enables you to simply enter
MYCODE PAR1 PAR2 <ret>
2. The complicated way is to use the Command Definition Utility (CDU) to
install a command MYCODE that takes two parameters and runs MYCODE.EXE .
You can specify default values and options and check whether parameter
values are filenames or numbers etc. I use this to parse command
line parameters to Pascal code because in VAX Pascal there is no such
thing as argv . You have to use the routines CLI$PRESENT and CLI$GET_VALUE
to find out about the values of your command line parameters. Off course
the parameters off these system routines are passed by means of the usual
string descriptor, which means you'll have to define a structure to match
the VMS definition off this descriptor.
Solution #1 is quick and will solve many problems, #2 is very non-portable,
rather time consuming, but is to be preferred if you don't want your code to
do the initial parameter checking.
Contact me directly if you need examples of the use of CDU or the application
of CLI$...
Martin J. van den Boogaard
Dept. of Atomic & Interface Physics, Rijksuniversiteit, Utrecht
P.O. Box 80.000
DecNet: ruunsc::boogaard NL-3508 TA Utrecht
BitNet: boogaard at hutruu51.bitnet the Netherlands
internet: nboogaar at fys.ruu.nl +31 30 532904
More information about the Comp.lang.c
mailing list