decc$to_vms

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
                 *unix_style_filespec, int
                 type_of_file), int allow_wild,
                 int no_directory);

Arguments

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 that accepts the following arguments:

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 file names that correspond to existing OpenVMS files are included.
no_directory
An integer that has one of the following values:
Value  Translation 
Directory is not allowed. 
Prevent expansion of the string as a directory name. 
Forced to be a directory name. 

Description

This routine 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.

Return Value
The number of file names that result from the specified UNIX style file specification. 

Example

    #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.


Previous Page | Next Page | Table of Contents | Index