aboutsummaryrefslogtreecommitdiff
path: root/std.c
diff options
context:
space:
mode:
authorMatthias-Christian Ott <ott@enolink.de>2008-06-10 17:30:15 +0200
committerMatthias-Christian Ott <ott@enolink.de>2008-06-10 17:30:15 +0200
commit47d8633f157156ef4701ce71ed7eff766206c107 (patch)
tree78190354f0b6784063f5434821b40bbe0ebd8d1e /std.c
parent0dedee5de8e35f4bab3d707d63be31943715264e (diff)
downloadst-47d8633f157156ef4701ce71ed7eff766206c107.tar.gz
st-47d8633f157156ef4701ce71ed7eff766206c107.zip
source getpty() out to pty.c
Diffstat (limited to 'std.c')
-rw-r--r--std.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/std.c b/std.c
index fcfead9..1b918f5 100644
--- a/std.c
+++ b/std.c
@@ -6,9 +6,6 @@
6#include <ctype.h> 6#include <ctype.h>
7#include <errno.h> 7#include <errno.h>
8#include <fcntl.h> 8#include <fcntl.h>
9#if !(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
10#include <pty.h>
11#endif
12#include <signal.h> 9#include <signal.h>
13#include <stdarg.h> 10#include <stdarg.h>
14#include <stdio.h> 11#include <stdio.h>
@@ -101,38 +98,6 @@ eprintn(const char *errstr, ...) {
101} 98}
102 99
103void 100void
104getpty(void) {
105 char *ptsdev;
106
107#if defined(_GNU_SOURCE)
108 ptm = getpt();
109#elif _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
110 ptm = posix_openpt(O_RDWR);
111#else
112 ptm = open("/dev/ptmx", O_RDWR);
113 if(ptm == -1)
114 if(openpty(&ptm, &pts, NULL, NULL, NULL) == -1)
115 eprintn("error, cannot open pty");
116#endif
117#if defined(_XOPEN_SOURCE)
118 if(ptm != -1) {
119 if(grantpt(ptm) == -1)
120 eprintn("error, cannot grant access to pty");
121 if(unlockpt(ptm) == -1)
122 eprintn("error, cannot unlock pty");
123 ptsdev = ptsname(ptm);
124 if(!ptsdev)
125 eprintn("error, slave pty name undefined");
126 pts = open(ptsdev, O_RDWR);
127 if(pts == -1)
128 eprintn("error, cannot open slave pty");
129 }
130 else
131 eprintn("error, cannot open pty");
132#endif
133}
134
135void
136movea(int x, int y) { 101movea(int x, int y) {
137 x = MAX(x, cols); 102 x = MAX(x, cols);
138 y = MAX(y, lines); 103 y = MAX(y, lines);