/* send command */ iprintf(id, "%s\n", cmd);

/* check cmd for a ’?’, if found assume it is a query */ for(idx=0; idx<strlen(cmd); idx++)

if( ’?’ == cmd[idx])

{

/* wait up to 1 minute for srq handler */ if( 0 != iwaithdlr(60000))

{

printf("ERROR: Failed to process Query\n");

}

break;

}

}/* while - there are commands to send */ /* remove the handler */

ionsrq( id, 0);

/* close the session */

printf("\nClosing Instrument at %s\n", addr); iclose(id);

}

Chapter 2

Programming the Status System 21