VMS Help
CRTL, decc$from_vms
*Conan The Librarian
|
Converts OpenVMS file specifications to UNIX style file
specifications.
Format
#include <unixlib.h>
int decc$from_vms (const char *vms_filespec, int
action_routine, int wild_flag);
vms_filespec
The address of a null-terminated string containing a name in
OpenVMS file specification format.
action_routine
The address of a routine that takes as its only argument a null-
terminated string containing the translation of the given OpenVMS
filename to a valid UNIX style filename.
If the action_routine returns a nonzero value (TRUE), file
translation continues. If it returns a zero value (FALSE), no
further file translation takes place.
wild_flag
Either 0 or 1, passed by value. If a 0 is specified, wildcards
found in vms_filespec are not expanded. Otherwise, wildcards
are expanded and each one is passed to action_routine. Only
expanded filenames that correspond to existing UNIX style files
are included.
The decc$from_vms routine converts the given OpenVMS file
specification into the equivalent UNIX style file specification.
It allows you to specify OpenVMS wildcards, which are translated
into a list of corresponding existing files in UNIX style file
specification format.
x The number of filenames that result from the
specified OpenVMS file specification.
/* This example must be run as a foreign command */
/* and be supplied with an OpenVMS file specification. */
#include <unixlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int number_found; /* number of files found */
int print_name(); /* name printer */
printf("Translating: %s\n", argv[1]);
number_found = decc$from_vms(argv[1], print_name, 1);
printf("\n%d files found", number_found);
}
/* print the name on each line */
print_name(char *name)
{
printf("\n%s", name);
/* will continue as long as success status is returned */
return (1);
}
This example shows how to use the decc$from_vms routine in
Compaq C. It produces a simple form of the ls command that
lists existing files that match an OpenVMS file specification
supplied on the command line. The matching files are displayed
in UNIX style file specification format.