1 /* See LICENSE file for copyright and license details. */
6 #if !(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
16 #if defined(_GNU_SOURCE)
18 #elif _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
19 ptm = posix_openpt(O_RDWR);
21 ptm = open("/dev/ptmx", O_RDWR);
23 if(openpty(&ptm, &pts, NULL, NULL, NULL) == -1)
24 eprintn("error, cannot open pty");
26 #if defined(_XOPEN_SOURCE)
28 if(grantpt(ptm) == -1)
29 eprintn("error, cannot grant access to pty");
30 if(unlockpt(ptm) == -1)
31 eprintn("error, cannot unlock pty");
32 ptsdev = ptsname(ptm);
34 eprintn("error, slave pty name undefined");
35 pts = open(ptsdev, O_RDWR);
37 eprintn("error, cannot open slave pty");
40 eprintn("error, cannot open pty");