Copyright Digital Equipment Corp. All rights reserved.

Example

       /* 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
     VSI 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.