* Re: [NEED] C Source to convert VMS filenames
1996-04-29 4:00 [NEED] C Source to convert VMS filenames John Haro
@ 1996-04-30 4:00 ` Ed Wilts
0 siblings, 0 replies; 2+ messages in thread
From: Ed Wilts @ 1996-04-30 4:00 UTC (permalink / raw)
In article <DqMx6p.CIr@plato.ds.boeing.com>, John Haro <haro@fclzoo.itdl.ds.boeing.com> writes:
> Anyone have a clean C source code to convert VMS filename strings to UNIX
> filename strings ?
>
> Similar to what VMSTAR does, but just the filenames w/ capability to handle
> versions.
>
> We need to make this a C subroutine that will compile on VMS or UNIX.
>
> eg: %convert_filename vms_input_filename unix_output_filename
To run on VMS, it's easy - just use the RTL to do the work for you. I'm
including a help file that you can throw into a help library to get the docs.
To run under Unix, I'd suggest you do some cut and paste of sources like ZIP,
VMSTAR, etc.
1 SHELL
The VAXC Shell$ run time library routines.
2 SHELL$CLI_NAME
Reports your current CLI name.
General high-level language format:
status = shell$cli_name( cli_name_desc )
VAX C format:
# include descrip
int shell$cli_name();
struct dsc$descriptor *cli_name_desc;
SHELL$CLI_NAME places the string "SHELL" in the user-supplied string
descriptor, cli_name_desc, if the current CLI is the DEC/Shell.
Otherwise, the string "CLI$NAME" is placed in cli_name_desc.
2 SHELL$FIX_TIME
Converts VAX/VMS binary system times to UNIX binary times.
General high-level language format:
unxtim = shell$fix_time( vmstim )
VAX C format:
int quadword[2];
int *vmstim = quadword;
int shell$fix_time();
SHELL$FIX_TIME converts a VMS binary time (a 64 bit quadword containing
a number of 10 nsec. ticks since 00:00 November 17, 1858) into a
UNIX-like time longword containing the number of seconds since 00:00
January 1, 1970. This routine is useful in converting binary times
returned by VMS system services and RMS services into the format used
by some C routines (such as ctime, localtime).
2 SHELL$FROM_VMS
Converts VAX/VMS file specifications to Shell file specifications.
General high-level language format:
num_files_found =
shell$from_vms( vms_filespec, action_routine, wild_flag )
VAX C format:
char *vms_filespec;
int wild_flag;
int action_routine();
int shell$from_vms();
SHELL$FROM_VMS converts the given VMS file specification into the
equivalent DEC/Shell file specification. Further, it allows you user
to specify VMS wildcards and have them translated into a corresponding
list of existing files in DEC/Shell file specification syntax.
3 Arguments
vms_filespec
The address of a null-terminated string containing a name in VMS
file specification syntax.
action_routine
The address of a routine that takes as its only argument a
null-terminated string containing the translation of the given
DEC/Shell name syntax to valid VMS filename syntax. Further, if
this routine returns false (low bit clear), no further file
translation takes place.
wild_flag
Either a 0 or 1 passed by value. If a 0 is specified, then
wildcards found in the shell_filespec are not expanded. Otherwise,
such wildcards are expanded and each is passed to the
action_routine. Only those expanded filenames that correspond to
existing VMS files will be included.
3 Returns
num_files_found
The number of filenames that result from the given VAX/VMS
filespec.
2 SHELL$IS_SHELL
Determines whether you are running the DEC/Shell as your current CLI.
General high-level Language Format:
status = shell$is_shell()
VAX C format:
int shell$is_shell();
status = shell$is_shell()
2 SHELL$MATCH_WILD
Matches a file specification to a pattern.
General high-level language format:
status = shell$match_wild( string, pattern )
VAX C format:
char *string;
char *pattern;
int shell$match_wild();
2 SHELL$TO_VMS
Converts DEC/Shell file specifications to VAX/VMS file specifications.
General high-level language format:
num_files_found =
shell$to_vms( shell_filespec, action_routine, wild_flag )
VAX C format:
char *shell_filespec;
int wild_flag;
int action_routine();
int shell$to_vms();
SHELL$TO_VMS converts the given DEC/Shell file specification into the
equivalent VMS file specification. Further, it allows you to specify
DEC/Shell wildcard characters and have them translated into a list of
the corresponding existing VMS files.
3 Arguments
shell_filespec
The address of a null-terminated string containing a name in
DEC/Shell file specification syntax.
action_routine
The address of a routine that takes as its only argument a
null-terminated string containing the translation of the given
DEC/Shell name syntax to valid VMS filename syntax. Further, if
this routine returns false (low bit clear), no further file
translation takes place.
wild_flag
Either a 0 or 1 passed by value. If a 0 is specified, then
wildcards found in the shell_filespec are not expanded. Otherwise,
such wildcards are expanded and each is passed to the
action_routine. Only those expanded filenames that correspond to
existing VMS files will be included.
3 Returns
num_files_found
The number of filenames that result from the given DEC/Shell
filespec.
2 SHELL$TRANSLATE_VMS
Translates VAX/VMS file specifications to DEC/Shell file
specifications.
General high-level language format:
shell_filespec = shell$translate_vms( vms_filespec )
VAX C format:
char *vms_filespec;
char *shell$translate_vms();
--
Ed Wilts
Information Technology Services Division, Ministry of Finance, Province of BC
4000 Seymour Place, Victoria, B.C., Canada, V8X 4S8
mailto:EWilts@Galaxy.Gov.BC.CA Phone: (604) 389-3430 Fax: (604) 389-3412
Disclaimer: The opinions and statements contained in this posting are the sole
responsibility of the author and have not in any way been reviewed or approved
by my employer or any network service.
^ permalink raw reply [flat|nested] 2+ messages in thread