VMS Help
CRTL, decc$to_vms
*Conan The Librarian
|
Converts UNIX style file specifications to OpenVMS file
specifications.
Format
#include <unixlib.h>
int decc$to_vms (const char *unix_style_filespec,
int (*action_routine)
(char *OpenVMS_style_filespec, int type_of_file),
int allow_wild, int no_directory);
unix_style_filespec
The address of a null-terminated string containing a name in UNIX
style file specification format.
action_routine
The address of a routine called by decc$to_vms that accepts the
following arguments:
o A pointer to a null-terminated string that is the result of
the translation to OpenVMS format.
o An integer that has one of the following values:
Value Translation
0 (DECC$K_FOREIGN) A file on a remote system that is not
running the OpenVMS or VAXELN operating
system.
1 (DECC$K_FILE) The translation is a file.
2 (DECC$K_ The OpenVMS translation of the UNIX style
DIRECTORY) filename is a directory.
These values can be defined symbolically with the symbols
DECC$K_FOREIGN, DECC$K_FILE, and DECC$K_DIRECTORY. See the
example for more information.
If action_routine returns a nonzero value (TRUE), file
translation continues. If it returns a 0 value (FALSE), no
further file translation takes place.
allow_wild
Either 0 or 1, passed by value. If a 0 is specified, wildcards
found in unix_style_filespec are not expanded. Otherwise,
wildcards are expanded and each one is passed to action_routine.
Only expanded filenames that correspond to existing OpenVMS files
are included.
no_directory
An integer that has one of the following values:
Value Translation
0 Directory allowed.
1 Prevent expansion of the string as a directory
name.
2 Forced to be a directory name.
The decc$to_vms function converts the given UNIX style file
specification into the equivalent OpenVMS file specification
(in all uppercase letters). It allows you to specify UNIX style
wildcards, which are translated into a list of corresponding
OpenVMS files.
Note that the following feature logicals can affect the behavior
of decc$to_vms:
DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION
DECC$NO_ROOTED_SEARCH_LISTS
x The number of filenames that result from the
specified UNIX style file specification.
/* Translate "UNIX" wildcard file names to OpenVMS names.*/
/* Define as a foreign command and provide the name as */
/* an argument. */
#include <unixlib.h>
#include <stdio.h>
int print_name(char *, int);
int main(int argc, char *argv[])
{
int number_found; /* number of files found */
printf("Translating: %s\n", argv[1]);
number_found = decc$to_vms(argv[1], print_name, 1, 0);
printf("%d files found\n", number_found);
}
/* action routine that prints name and type on each line */
int print_name(char *name, int type)
{
if (type == DECC$K_DIRECTORY)
printf("directory: %s\n", name);
else if (type == DECC$K_FOREIGN)
printf("remote non-VMS: %s\n", name);
else
printf("file: %s\n", name);
/* Translation continues as long as success status is returned */
return (1);
}
This example shows how to use the decc$to_vms routine in
Compaq C. It takes a UNIX style file specification argument
and displays, in OpenVMS file specification format, the name of
each existing file that matches it.