]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-bsd.c
save and restore window size settings
[ppp.git] / pppd / sys-bsd.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;
     }
 }