6 int posix_openpt(int flags)
8 return open("/dev/ptmx", flags);
19 return ioctl(fd, TIOCSPTLCK, &unlock);
24 static char buf[9 + sizeof(int)*3 + 1];
25 char *s = buf+sizeof(buf)-1;
27 if (ioctl (fd, TIOCGPTN, &pty))
29 if (pty) for (; pty; pty/=10) *--s = '0' + pty%10;
32 s[0] = '/'; s[1] = 'd'; s[2] = 'e'; s[3] = 'v';
33 s[4] = '/'; s[5] = 'p'; s[6] = 't'; s[7] = 's'; s[8] = '/';