* Q: VMS "CLD"/programming problem @ 1998-11-04 5:00 David W. Fisher 1998-11-04 5:00 ` Joshua Cope 1998-11-05 5:00 ` Ferry Bolhar 0 siblings, 2 replies; 3+ messages in thread From: David W. Fisher @ 1998-11-04 5:00 UTC (permalink / raw) I've written a program in c. Using argc and argv it can determine what's coming into main. The tricky thing is the c-program is being called via a verb setup in a ".CLD" file. Consequently, argv[0] contains the name of my c-program and not the verb the user typed-in at the command line. How can I determine what the user typed-in (i.e., the verb)? Thanks ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Q: VMS "CLD"/programming problem 1998-11-04 5:00 Q: VMS "CLD"/programming problem David W. Fisher @ 1998-11-04 5:00 ` Joshua Cope 1998-11-05 5:00 ` Ferry Bolhar 1 sibling, 0 replies; 3+ messages in thread From: Joshua Cope @ 1998-11-04 5:00 UTC (permalink / raw) David W. Fisher wrote: > I've written a program in c. Using argc and argv it can determine what's > coming into main. The tricky thing is the c-program is being called via > a verb setup in a ".CLD" file. Consequently, argv[0] contains the name > of my c-program and not the verb the user typed-in at the command line. > How can I determine what the user typed-in (i.e., the verb)? I don't think you can, using ANSI C - argv[0] is defined as the filename currently being run. If you don't mind it being VMS specific (and considering you're using a CLD file, that may be a reasonable assumption), take a look at the CLI$GET_VALUE routine, using the special label $VERB - see below: $ type verb.c,verb.cld #include <cli$routines> #include <clidef> #include <stdio> #include <stdlib> #include <descrip> int main (int argc, char **argv) { char verb[255]; int status; struct dsc$descriptor_s verb_dsc = {255,DSC$K_DTYPE_T,DSC$K_CLASS_S,verb}; $DESCRIPTOR(vd,"$VERB"); status = CLI$GET_VALUE (&vd,&verb_dsc,&verb_dsc.dsc$w_length); if (!(status & 1)) return (status); verb[verb_dsc.dsc$w_length] = 0; /* Null-terminate the string */ printf ("argv[0] = '%s'\n", argv[0]); printf ("Verb = '%s'\n", verb); return 1; } DISK$USERS:[JOSH.TEMP]VERB.CLD;1 define verb doit image verb $ doit_note_that_only_4_characters_matter_to_DCL argv[0] = '$4$dka400:[josh.temp]verb.exe;5' Verb = 'DOIT' $ ------------------------------------------------------------ The above opinions and information are not necessarily those of Compaq Computer Corporation. ------------------------------------------------------------ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Q: VMS "CLD"/programming problem 1998-11-04 5:00 Q: VMS "CLD"/programming problem David W. Fisher 1998-11-04 5:00 ` Joshua Cope @ 1998-11-05 5:00 ` Ferry Bolhar 1 sibling, 0 replies; 3+ messages in thread From: Ferry Bolhar @ 1998-11-05 5:00 UTC (permalink / raw) To: dwfishe David W. Fisher wrote: > > I've written a program in c. Using argc and argv it can determine what's > coming into main. The tricky thing is the c-program is being called via > a verb setup in a ".CLD" file. Consequently, argv[0] contains the name > of my c-program and not the verb the user typed-in at the command line. > How can I determine what the user typed-in (i.e., the verb)? > > Thanks Include this in your code: char retbuf[16]; short retlen; $DESCRIPTOR(vrb_dsc,"$VERB"); $DESCRITPOR(vrb_ret,retbuf); cli$get_value(&vrb_dsc,&vrb_ret,&retlen); retbuf[retlen] = 0; You may obtain the verb from retbuf. Greetings, Ferry -- Ing. Ferry Bolh�r-Nordenkampf Magistrat der Stadt Wien (MA-14) A - 1010 Vienna (Austria) Phone: +43 1 4000 98632 E-Mail: bol@adv.magwien.gv.at "Wenn hier einer schuld ist, dann immer nur der Computer." ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1998-11-05 5:00 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1998-11-04 5:00 Q: VMS "CLD"/programming problem David W. Fisher 1998-11-04 5:00 ` Joshua Cope 1998-11-05 5:00 ` Ferry Bolhar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox