X25AM Programming Manual

PTP Applications
X25AM Programming Manual527201-001
3-77
Text of C Example
/*
*----------------------------------------------------------------------
* CONNECT LINE (PLACE OR ACCEPT CALL)
* -----------------------------------
*
* This function does the following:
*
* 1) prompts user for selection of send or wait for a call to/from
* the remote subdevice;
* 2) depending on the user's selection, it establishes the connection
* and sends appropriate code to CONTROL(); waits for its completion
* and checks for error;
* 3) if the user makes an invalid selection, it informs the user and
* returns to step 1);
* 4) sets the communication line's parameters to allow operations to
* complete in any order;
* 5) posts a read on the communication line using a read tag, so that
* the main() function knows how to process the data when it gets
* a completed I/O on the comm line;
*
*----------------------------------------------------------------------
*/
void ConnectLine( )
{
short error=0;
L_PROMPT:
/*
*------------------------------------------------------------------
* Step 1: Request user's selection of operations.
*------------------------------------------------------------------
*/
fprintf( stderr, "Enter <CALL> to place a call or <WAIT> to wait "
"for a call ?" );
if( fgets( term_buffs, MAX_TERM_READ, stdin ) == NULL )
{
fprintf( stderr, "%s: Error reading stdin; ferror() = %d\n",
prog_name, ferror( stdin ) );
DEBUG();
}; /* if fgets() */