1 /* See LICENSE file for copyright and license details. */
7 #if !(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
17 #if defined(_GNU_SOURCE)
19 #elif _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
20 ptm = posix_openpt(O_RDWR);
22 ptm = open("/dev/ptmx", O_RDWR);
24 if(openpty(&ptm, &pts, NULL, NULL, NULL) == -1)
25 eprintn("error, cannot open pty");
27 #if defined(_XOPEN_SOURCE)
29 if(grantpt(ptm) == -1)
30 eprintn("error, cannot grant access to pty");
31 if(unlockpt(ptm) == -1)
32 eprintn("error, cannot unlock pty");
33 ptsdev = ptsname(ptm);
35 eprintn("error, slave pty name undefined");
36 pts = open(ptsdev, O_RDWR);
38 eprintn("error, cannot open slave pty");
41 eprintn("error, cannot open pty");