| Can't do it in DCL, except in a kludgy way. Your first step is to make
a .CLD file:
module CATZ_MEOW
define verb CAT
qualifier DIRECTORY, value(required)
qualifier LOG
qualifier VERSION, value(required)
Now you compile that with SET COMMAND/OBJECT and you have an .OBJ file.
Next step is to write a program to link this to. The program should
o Get the command line with the LIB$GET_FOREIGN() routine.
o Parse that command line against the CATZ_MEOW tables using the
CLI$DCL_PARSE() routine.
o Check for each of the three qualifiers with the CLI$PRESENT()
routine to see if they're there.
o For /DIRECTORY and /VERSION, if they're present, get their
values with the CLI$GET_VALUE() routine.
Here's a C program to do that, written from the top of my head:
#include <climsgdef.h>
#include <descrip.h>
#include <ssdef.h>
#include <stsdef.h>
main()
{
globalvalue CATZ_MEOW;
char buffer[1024];
short int log_present = 0;
unsigned int status;
struct dsc$descriptor_d directory_d = {0,DSC$K_DTYPE_T,DSC$K_CLASS_D,0};
struct dsc$descriptor_d version_d = {0,DSC$K_DTYPE_T,DSC$K_CLASS_D,0};
$DESCRIPTOR(buffer_d,buffer);
$DESCRIPTOR(kwd_DIRECTORY_d,"DIRECTORY");
$DESCRIPTOR(kwd_LOG_d,"LOG");
$DESCRIPTOR(kwd_VERSION_d,"VERSION");
buffer[0] = 'C'; /* 'C' is for CAT. */
buffer[1] = ' '; /* Space between verb and arguments. */
buffer_d.dsc$a_pointer = &buffer[2];
buffer_d.dsc$w_length -= 2;
if ((status = lib$get_foreign(
&buffer_d,
0,
&buffer_d.dsc$w_length,
0
)) != SS$_NORMAL)
exit(status);
buffer_d.dsc$a_pointer = &buffer[0];
buffer_d.dsc$w_length += 2;
if ((status = cli$dcl_parse(
&buffer_d,
CATZ_MEOW,
0,0,0
)) != CLI$_NORMAL)
exit(status | STS$M_INHIB_MSG);
if (cli$present(&kwd_DIRECTORY_d) == CLI$_PRESENT)
{
if ((status = cli$get_value(
&kwd_DIRECTORY_d,
&directory_d,
&directory_d.dsc$w_length
)) != SS$_NORMAL)
exit(status);
}
if (cli$present(&kwd_LOG_d) == CLI$_PRESENT)
log_present = 1;
if (cli$present(&kwd_VERSION_d) == CLI$_PRESENT)
{
if ((status = cli$get_value(
&kwd_VERSION_d,
&version_d,
&version_d.dsc$w_length
)) != SS$_NORMAL)
exit(status);
}
/* Now you've got all the information you need. Let's roll it back now. */
if (directory_d.dsc$w_length)
{
printf("\nDirectory:\r");
lib$put_output(&directory_d);
}
if (log_present)
printf("\n/LOG was specified\r");
if (version_d.dsc$w_length)
{
printf("\nVersion:\r");
lib$put_output(&version_d);
}
}
|