]> git.ozlabs.org Git - ppp.git/commitdiff
save and restore window size settings
authorPaul Mackerras <paulus@samba.org>
Fri, 11 Aug 1995 02:36:26 +0000 (02:36 +0000)
committerPaul Mackerras <paulus@samba.org>
Fri, 11 Aug 1995 02:36:26 +0000 (02:36 +0000)
pppd/sys-bsd.c
pppd/sys-str.c
pppd/sys-svr4.c
pppd/sys-ultrix.c

index 1a7c83a6827a505026ee8b591f13c57ecf872099..e9dcd5af7f60f0214ba08a6682e5871da6fd9268 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-bsd.c,v 1.19 1995/05/19 03:27:03 paulus Exp $";
+static char rcsid[] = "$Id: sys-bsd.c,v 1.20 1995/08/11 02:36:21 paulus Exp $";
 #endif
 
 /*
@@ -57,6 +57,7 @@ static int rtm_seq;
 
 static int     restore_term;   /* 1 => we've munged the terminal */
 static struct termios inittermios; /* Initial TTY termios */
+static struct winsize wsinfo;  /* Initial window size info */
 
 static char *lock_file;                /* name of lock file created */
 
@@ -213,8 +214,10 @@ set_up_tty(fd, local)
        die(1);
     }
 
-    if (!restore_term)
+    if (!restore_term) {
        inittermios = tios;
+       ioctl(fd, TIOCGWINSZ, &wsinfo);
+    }
 
     tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL);
     if (crtscts > 0)
@@ -281,6 +284,7 @@ restore_tty()
        if (tcsetattr(fd, TCSAFLUSH, &inittermios) < 0)
            if (errno != ENXIO)
                syslog(LOG_WARNING, "tcsetattr: %m");
+       ioctl(fd, TIOCSWINSZ, &wsinfo);
        restore_term = 0;
     }
 }
index 623edf9ef7279eb52adb4706df8ffb6e60eb73b4..05e6805bc259e2c70ddc55faca2698a47946b432 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-str.c,v 1.22 1995/07/04 12:35:56 paulus Exp $";
+static char rcsid[] = "$Id: sys-str.c,v 1.23 1995/08/11 02:36:23 paulus Exp $";
 #endif
 
 /*
@@ -68,6 +68,7 @@ static int    closed_stdio;
 
 static int     restore_term;   /* 1 => we've munged the terminal */
 static struct termios inittermios; /* Initial TTY termios */
+static struct winsize wsinfo;  /* Initial window size info */
 
 int sockfd;                    /* socket for doing interface ioctls */
 static char *lock_file;                /* lock file created for serial port */
@@ -396,8 +397,10 @@ set_up_tty(fd, local)
        die(1);
     }
 
-    if (!restore_term)
+    if (!restore_term) {
        inittermios = tios;
+       ioctl(fd, TIOCGWINSZ, &wsinfo);
+    }
 
     tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL);
     if (crtscts > 0)
@@ -465,6 +468,7 @@ restore_tty()
        if (tcsetattr(fd, TCSAFLUSH, &inittermios) < 0)
            if (errno != ENXIO)
                syslog(LOG_WARNING, "tcsetattr: %m");
+       ioctl(fd, TIOCSWINSZ, &wsinfo);
        restore_term = 0;
     }
 }
index 08a2a01fd46599a338e7c527e6c91c31f92dcd87..df74afe7b823bb1dfd2b63868fec4e47098ae2b5 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-svr4.c,v 1.4 1995/08/10 06:53:39 paulus Exp $";
+static char rcsid[] = "$Id: sys-svr4.c,v 1.5 1995/08/11 02:36:24 paulus Exp $";
 #endif
 
 #include <stdio.h>
@@ -64,6 +64,7 @@ static int    ipmuxid = -1;
 
 static int     restore_term;
 static struct termios inittermios;
+static struct winsize wsinfo;  /* Initial window size info */
 static pid_t   tty_sid;        /* original session ID for terminal */
 
 static int     link_mtu, link_mru;
@@ -371,8 +372,10 @@ set_up_tty(fd, local)
        die(1);
     }
 
-    if (!restore_term)
+    if (!restore_term) {
        inittermios = tios;
+       ioctl(fd, TIOCGWINSZ, &wsinfo);
+    }
 
     tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL);
     if (crtscts > 0)
@@ -440,6 +443,7 @@ restore_tty()
        if (tcsetattr(fd, TCSAFLUSH, &inittermios) < 0)
            if (!hungup && errno != ENXIO)
                syslog(LOG_WARNING, "tcsetattr: %m");
+       ioctl(fd, TIOCSWINSZ, &wsinfo);
        restore_term = 0;
     }
 }
index 20f6e5e630b885a503ead8d111687ed7930b7a4c..7fc4034e6b0cdecc568909eac88f98376faa45e9 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-ultrix.c,v 1.13 1995/07/04 12:36:47 paulus Exp $";
+static char rcsid[] = "$Id: sys-ultrix.c,v 1.14 1995/08/11 02:36:26 paulus Exp $";
 #endif
 
 /*
@@ -52,6 +52,7 @@ static int initdisc = -1;     /* Initial TTY discipline */
 
 static int     restore_term;   /* 1 => we've munged the terminal */
 static struct termios inittermios; /* Initial TTY termios */
+static struct winsize wsinfo;  /* Initial window size info */
 
 static char *lock_file;
 
@@ -336,8 +337,10 @@ set_up_tty(fd, local)
        die(1);
     }
 
-    if (!restore_term)
+    if (!restore_term) {
        inittermios = tios;
+       ioctl(fd, TIOCGWINSZ, &wsinfo);
+    }
 
     tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL);
 #ifdef CRTSCTS
@@ -413,6 +416,7 @@ restore_tty()
        if (tcsetattr(fd, TCSAFLUSH, &inittermios) < 0)
            if (errno != ENXIO)
                syslog(LOG_WARNING, "tcsetattr: %m");
+       ioctl(fd, TIOCSWINSZ, &wsinfo);
        restore_term = FALSE;
     }
 }