Translates OpenVMS file specifications to UNIX style file specifications. Format #include <unixlib.h> char *decc$translate_vms (const char *vms_filespec);
1 – Argument
vms_filespec The address of a null-terminated string containing a name in OpenVMS file specification format.
2 – Description
The decc$translate_vms function translates the given OpenVMS file specification into the equivalent UNIX style file specification, whether or not the file exists. The translated name string is stored in a thread-specific memory, which is overwritten by each call to decc$translate_vms from the same thread. This function differs from the decc$from_vms function, which does the conversion for existing files only.
3 – Return Values
x The address of a null-terminated string containing a name in UNIX style file specification format. 0 Indicates that the filename is null or syntactically incorrect. -1 Indicates that the file specification contains an ellipsis (for example, [ . . . ]a.dat), but is otherwise correct. You cannot translate the OpenVMS ellipsis syntax into a valid UNIX style file specification.
4 – Example
/* Demonstrate translation of a "UNIX" name to OpenVMS */ /* form, define a foreign command, and pass the name as */ /* the argument. */ #include <unixlib.h> #include <stdio.h> int main(int argc, char *argv[]) { char *ptr; /* translation result */ ptr = decc$translate_vms( argv[1] ); if ((int) ptr == 0 || (int) ptr == -1) printf( "could not translate %s\n", argv[1]); else printf( "%s is translated to %s\n", argv[1], ptr ); }