main(int argc, char \\argv)

{

typedef struct attrib_struct { int attrib_count; Qus_Vlen_Rec_3_t keyinfo; char key_value;

} attrib_struct;

 

 

Qus_EC_t error_code;

/\ Error code parameter

\/

attrib_struct attrib_info;

/\ Attribute to change

\/

char user_space[21];

/\ User space and library

\/

char descr[5ð];

/\ Text description

\/

char initial_value = ðxðð;

/\ Initial value for user space\/

char return_lib[1ð];

/\ Return library

\/

char ret_file_lib[2ð];

/\ Returned file and library

\/

char file_and_lib[21];

/\ File and library

\/

char record_fmt[11];

/\ Record format name

\/

char \space_ptr;

/\ Pointer to user space object\/

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ Start of executable code.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/ if (argc != 4) {

printf("This program requires 3 parameters:\n"); printf(" 1) User space name and library\n"); printf(" 2) File name and library\n"); printf(" 3) Record format name\n"); printf("Please retry with those parameters.\n"); exit(1);

}

memcpy(user_space, \++argv, 2ð); memcpy(file_and_lib, \++argv, 2ð); memcpy(record_fmt, \++argv, 1ð); memset(desc,' ',5ð); memcpy(descr,"RTVFD User Space",16);

signal(SIGALL,error_handler);

/\

Enable the error

handler

\/

error_code.Bytes_Provided=ð;

/\

Have APIs return

exceptions \/

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ Create the user space.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

QUSCRTUS(user_space,

 

/\ User space

\/

"

",

/\ Extended attribute

\/

1ð24,

 

/\ Initial size

\/

&initial_value,

/\ Initial value

\/

"\CHANGE

",

/\ Public authority

\/

descr,

 

/\ Text description

\/

"\YES

",

/\ Replace if it exists

\/

&error_code,

/\ Error code

\/

"\USER

");

/\ Domain = USER

\/

if (error_flag) { exit(1);

}

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

Appendix A. Performing Tasks Using APIs—ExamplesA-13

Page 269
Image 269
IBM Version 4 manual Change, Yes