close master/slave pty in the shell process.
[st.git] / st.c
diff --git a/st.c b/st.c
index 2e0ef70..e288902 100644 (file)
--- a/st.c
+++ b/st.c
@@ -136,6 +136,7 @@ static void tinsertblankline(int);
 static void tmoveto(int, int);
 static void tnew(int, int);
 static void tnewline(void);
+static void tputtab(void);
 static void tputc(char);
 static void tputs(char*, int);
 static void treset(void);
@@ -152,6 +153,9 @@ static void ttyread(void);
 static void ttyresize(int, int);
 static void ttywrite(const char *, size_t);
 
+static void xbell(void);
+static void xdraws(char *, Glyph, int, int, int);
+static void xhints(void);
 static void xclear(int, int, int, int);
 static void xcursor(int);
 static void xinit(void);
@@ -243,7 +247,7 @@ ttynew(void) {
        if((m = posix_openpt(O_RDWR | O_NOCTTY)) < 0)
                die("openpt failed: %s\n", SERRNO);
        if(grantpt(m) < 0)
-               die("grandpt failed: %s\n", SERRNO);
+               die("grantpt failed: %s\n", SERRNO);
        if(unlockpt(m) < 0)
                die("unlockpt failed: %s\n", SERRNO);
        if(!(pts = ptsname(m)))
@@ -261,7 +265,9 @@ ttynew(void) {
                dup2(s, STDOUT_FILENO);
                dup2(s, STDERR_FILENO);
                if(ioctl(s, TIOCSCTTY, NULL) < 0)
-                       die("ioctl TTIOCSTTY failed: %s\n", SERRNO);
+                       die("ioctl TIOCSCTTY failed: %s\n", SERRNO);
+               close(s);
+               close(m);
                execsh();
                break;
        default:
@@ -857,12 +863,7 @@ csireset(void) {
 void
 tputtab(void) {
        int space = TAB - term.c.x % TAB;
-       
-       if(term.c.x + space >= term.col)
-               space--;
-       
-       for(; space > 0; space--)
-               tmovecursor(CURSOR_RIGHT);
+       tmoveto(term.c.x + space, term.c.y);
 }
 
 void