/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <descrip.h>

#include "sys$examples:bapidef.h"

typedef struct _buf_arg
{
    bck_opt_struct_dsc arg1;
    bck_opt_struct_dsc arg2;
    bck_opt_struct_flag arg3;
    bck_opt_struct_flag arg4;
    bck_opt_struct_flag arg5;
} buf_arg;

int backup$start(buf_arg *mybufarg);

int main()
{
    buf_arg mybufarg;;
    int status;
    $DESCRIPTOR(input_dsc, "[.ratfor...]");
    $DESCRIPTOR(output_dsc, "ratfor.bck");
    mybufarg.arg1.opt_dsc_type = BCK_OPT_K_INPUT;
    memcpy(&mybufarg.arg1.opt_dsc, &input_dsc, 8);
    mybufarg.arg2.opt_dsc_type = BCK_OPT_K_OUTPUT;
    memcpy(&mybufarg.arg2.opt_dsc, &output_dsc, 8);
    mybufarg.arg3.option_type = BCK_OPT_K_SAVE_SET_OUT;
    mybufarg.arg3.opt_flag_value = TRUE;
    mybufarg.arg4.option_type = BCK_OPT_K_OPERATION_TYPE;
    mybufarg.arg4.opt_flag_value = BCK_OP_K_SAVE ;
    mybufarg.arg5.option_type = BCK_OPT_K_END_OPT;
    mybufarg.arg5.opt_flag_value = FALSE;
    status = backup$start(&mybufarg);
    exit(status);
}
