Download Print this page

HP 9000 Manual page 52

Dtc device file access utilities and telnet port identification
Hide thumbs Also See for 9000:

Advertisement

5-4
Application Examples
dp
ocd
#include <errno.h>
#include <stdio.h>
#include <sys/fcntl.h>
#include <sys/ptyio.h>
#include <sys/ioctl.h>
#include <sys/termio.h>
main()
{
char msg [ 80] ;
char i;
int fd;
if ( ( fd = open ( "/dev/telnet/dtcb1p4", O_RDWR ) ) == -1 ) {
printf ( "Unable to open device file: error %d: %s\n",
errno, strerror ( errno ) );
exit ( 1 );
}
for ( i = 0; i <= 'z' - 'a'; i++ ) {
sprintf ( msg, "Character %1d is %c\n", i + 1, 'a' + i );
write ( fd, msg, strlen ( msg ) );
}
if ( ioctl ( fd, TCSBRK, 0 ) == -1 ) {
printf ( "Unable to send break to device: error %d: %s\n",
errno, strerror ( errno ) );
exit ( 1 );
}
if ( close ( fd ) == -1 ) {
printf ( "Unable to close device file\n" );
exit ( 1 );
}
exit ( 0 );
}
ioctl()
open()
dp

Advertisement

loading