- char *pts;
-
- if((m = posix_openpt(O_RDWR | O_NOCTTY)) < 0)
- die("openpt failed: %s\n", SERRNO);
- if(grantpt(m) < 0)
- die("grantpt failed: %s\n", SERRNO);
- if(unlockpt(m) < 0)
- die("unlockpt failed: %s\n", SERRNO);
- if(!(pts = ptsname(m)))
- die("ptsname failed: %s\n", SERRNO);
- if((s = open(pts, O_RDWR | O_NOCTTY)) < 0)
- die("Couldn't open slave: %s\n", SERRNO);
- fcntl(s, F_SETFL, O_NDELAY);
+
+ /* seems to work fine on linux, openbsd and freebsd */
+ struct winsize w = {term.row, term.col, 0, 0};
+ if(openpty(&m, &s, NULL, NULL, &w) < 0)
+ die("openpty failed: %s\n", SERRNO);
+