Converts UNIX style file specifications to OpenVMS file specifications.
#include <unixlib.h>
int decc$to_vms (const char *unix_style_filespec,
int (*action_routine)(char
*unix_style_filespec, int
type_of_file), int allow_wild,
int no_directory);
| Value | Translation |
|---|---|
| 0 (DECC$K_FOREIGN) | A file on a remote system that is not running the OpenVMS or VAXELN operating system. |
| 2 (DECC$K_DIRECTORY) | The OpenVMS translation of the UNIX style file name is a directory. |
| 1 (DECC$K_FILE) | The translation is a file. |
These values can be defined symbolically with the symbols DECC$K_ FOREIGN, DECC$K_DIRECTORY, and DECC$K_FILE. 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.
| Value | Translation |
|---|---|
| 0 | Directory is not allowed. |
| 1 | Prevent expansion of the string as a directory name. |
| 2 | Forced to be a directory name. |
| x | The number of file names that result from the specified UNIX style file specification. |
#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 DEC 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.