FTAM/9000 Programmer's Guide

384 Chapter 10
Example Programs
Common Code Example
main()
/*
** ftm_hlcopy
**
** DESCRIPTION:
** This example program uses high level, context free functions
** synchronously. This program copies a file, changes the
** attributes of the destination file and deletes the source file.
**
*/
{
Ae_label ae_label;
Ae_dir_name source_dirname;
Ft_filename source_filename;
Ae_dir_name destination_dirname;
Ft_filename destination_filename;
Local_event_name return_event_name;
struct Ft_fcopy_in_dcb *fco_input_dcb;
struct Ft_fcopy_out_dcb *fco_inout_dcb;
struct Ft_fcattributes_in_dcb *fca_input_dcb;
struct Ft_fcattributes_out_dcb *fca_inout_dcb;
struct Ft_fdelete_in_dcb *fde_input_dcb;
struct Ft_fdelete_out_dcb *fde_inout_dcb;
Return_code res;
Api_rc outcome;
struct Ft_diagnostic *diag = NULL;
(void)printf(“ftm_fcopy: starting\n”);
/*
** Copy the source file to the destination directory.
**
** Get the parameters for ft_fcopy.
** Call ft_fcopy and verify the outcome.
*/
(void)printf(“Copying the source file to the destination directory...\n”);
fco_parm_in( & source_dirname, & source_filename,
& destination_dirname, & destination_filename,
& ae_label, & return_event_name, & fco_input_dcb,
& fco_inout_dcb );
res = ft_fcopy(source_dirname, source_filename, destination_dirname,
destination_filename, & ae_label,
return_event_name, fco_input_dcb, & fco_inout_dcb);
if (res != SUCCESS)
error_handler(fco_inout_dcb-result, fco_inout_dcb-diagnostic);
/*
** Free memory.
*/
res = ft_dfdcb((Octet *)fco_input_dcb, & outcome);
if (res != SUCCESS)
error_handler(outcome, diag);
res = ft_dfdcb((Octet *)fco_inout_dcb, & outcome);
if (res != SUCCESS)
error_handler(outcome, diag);