X25AM Programming Manual

PTP Applications
X25AM Programming Manual527201-001
3-83
Text of C Example
GetDefaults( (char *) defaults );
FNAMEEXPAND( out_device, x25_line, defaults );
end_program_flag = FALSE;
/*
*------------------------------------------------------------------
* Step 1: Open the remote X.25 subdevice.
*------------------------------------------------------------------
*/
if( OPEN( x25_line, &comm_file, O_RDWR_DEPTH_2 ) != CCE ) {
FILEINFO( -1, &error );
fprintf( stderr, "%s: Unable to open remote X.25 subdevice %s"
" - error = %d\n",
prog_name, out_device, error );
exit( EXIT_FAILURE );
}; /* if open() */
/*
*------------------------------------------------------------------
* Step 2: Establish the connection.
*------------------------------------------------------------------
*/
ConnectLine();
/*
*------------------------------------------------------------------
* Step 3: Close & reopen stdin for nowait I/O.
*------------------------------------------------------------------
*/
if( fclose( stdin ) != 0 ) {
fprintf( stderr, "%s: Unable to close %s - error = %d\n",
prog_name, in_device, ferror( stdin ) );
exit( EXIT_FAILURE );
}; /* if fclose() */
FNAMEEXPAND( in_device, std_in, defaults );
if( OPEN( std_in, &term_file, O_RDWR_DEPTH_1 ) != CCE ) {
FILEINFO( -1, &error );
fprintf( stderr, "%s: Unable to open %s - error = %d\n",
prog_name, in_device, error );
exit( EXIT_FAILURE );
}; /* if open() */
/*