OSI/MHS Gateway Programmatic Interface (GPI) Programming Guide

C Program Example
OSI/MHS Gateway Programmatic Interface (GPI) Programming Guide424822-001
B-28
max_descriptors) /* Number of elements in */
/* the descriptor list */
{
unsigned short
local_rc; /* Return code from the function call */
short
len, /* The return value from the stccpy function */
exist; /* Position from the element in descriptor list*/
unsigned long
string_offset, /* String offset for GPI_OM_READ_ */
string_length, /* Length in octets of the string to read */
actual_number, /* Actual number of octets */
total_number; /* Total number of octets */
unsigned short
counter_2, /* Counter for the loop */
counter ; /* Counter for the loop */
char
*octet_pointer, /* Pointer to the octet string */
data_string[STRING_BUFFER_LEN], /* String buffer for the read */
printout[STRING_BUFFER_LEN]; /* Contains the string to print */
for (counter = 0; counter < number_of_printdata; ++counter)
{
exist = search_descriptor ( print_data[counter].type,
descriptor_list,
max_descriptors);
if ( exist > -1 )
{
if ( print_data[counter].type != IM_T_TEXT )
{
switch ( descriptor_list[exist].syntax)
{
case OM_S_BOOLEAN :
printf ( " %s %ld\n",
print_data[counter].text,
descriptor_list[exist].value.boolean);
break;
/*
* Since octet strings are not stored in ASCII, they
* need to be printed in hex.
*
*/
case OM_S_OCTET_STRING :
printf ( " %s " ,print_data[counter].text);
/*
* Printf needs a char pointer since it won't accept
* a void pointer.
*
*/
octet_pointer =
descriptor_list[exist].value.z_string.elements;
for ( counter_2 = 0;
counter_2 <
descriptor_list[exist].value.z_string.length;
++counter_2)