X25AM Programming Manual

PTP Applications
X25AM Programming Manual527201-001
3-85
Text of C Example
if( error_msg[ index ].err_code == error )
{
fprintf( stderr, "\n%s: %s\n",
prog_name, error_msg[index].err_msg );
if( error == 0 ) return; /* exit this function & continue*/
exit( EXIT_FAILURE ); /* terminate this program */
}; /* if err_code == error */
}; /* for */
fprintf( stderr, "\n%s: ??Unknow error code - %d\n",
prog_name, error );
exit( EXIT_FAILURE );
} /* PrintErrorMessage() */
/*
*----------------------------------------------------------------------
* PROMPT_TERMINAL FUNCTION
* ------------------------
*
* This function will do the following:
*
* 1) displays a question mark on the terminal;
* 2) posts a read from the terminal device.
*----------------------------------------------------------------------
*/
void PromptTerminal( )
{
short error;
if( fprintf( stderr, "? " ) < 0 )
{
DEBUG();
}
else
{
fflush( stderr );
}; /* if fprintf() */
if( READ( term_file, term_buff, MAX_TERM_READ ) != CCE )
{
FILEINFO( term_file, &error );
PrintErrorMessage( error );