rtfm# more ngdisc.c
#include <sys/ioctl.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> int
main(void)
{ int d; int ldisc; ldisc = NETGRAPHDISC; if ((d = open("/dev/ttyd1", O_NONBLOCK)) == -1) { perror("open"); } else { printf("descripto # %d\n", d); if ((ioctl(d, TIOCSETD, &ldisc)) == -1) { perror("ioctl"); } } printf("Netgraph TTY node initialized successfully\nPress any key to destroy it"); getc(stdin); close(d); exit; } rtfm# |