2635A
Users Manual
4-66
/*
* This function checks the Hydra prompt after sending a command to Hydra,
* to see if an error occurred.
*
* Possible responses are:
* "=>(CR)(LF)" (Command successful)
* "?>(CR)(LF)" (Command syntax error)
* "!>(CR)(LF)" (Command execution error)
*/
static int checkResponse()
{
char response[129];
/* Gets string from Hydra -- asigets_timed
gets characters from the receive buffer,
and strips the (CR)(LF) characters from
the end before placing them in the
"response" buffer */
asigets_timed(COM2,response,128,-2,TICKS_PER_SECOND*2);
/* check to see if the command worked correctly */
if(strcmp(response,"=>") == 0)
return 0; /* command executed without error */
if(strcmp(response,"?>") == 0)
fprintf(stderr,"Command Syntax Error!\n");
else
{
if(strcmp(response,"!>") == 0)
fprintf(stderr,"Command Execution Error!\n");
}
fprintf(stderr,"\nProgram execution halted due to communications errors\n");
fclose(testdata);
exit(1);
}
op53_5f.eps

Figure 4-7. Sample Program (QuickC)(5 of 5)