1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* * getpt.c * * GNU extension to the standard Unix98 pty suite */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <termios.h> #include <fcntl.h> #include <sys/ioctl.h> int getpt(void) { return open("/dev/ptmx", O_RDWR|O_NOCTTY); }