From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,f91985259c68da43 X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,f91985259c68da43 X-Google-Attributes: gid1164f8,public From: Joshua Cope Subject: Re: Q: VMS "CLD"/programming problem Date: 1998/11/04 Message-ID: <3640C4EA.FABBF5F5@star.enet.dec.com>#1/1 X-Deja-AN: 408431206 Content-Transfer-Encoding: 7bit References: <364095AC.1119@nswc.navy.mil> Content-Type: text/plain; charset=us-ascii Organization: Compaq OpenVMS Engineering Mime-Version: 1.0 Reply-To: cope@star.enet.dec.com Newsgroups: comp.sys.dec,comp.os.vms 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 #include #include #include #include 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. ------------------------------------------------------------