only set window size if not previously set
[unix-history] / usr / src / usr.bin / tset / tset.c
index f86274c..7e44cb1 100644 (file)
@@ -1112,9 +1112,12 @@ ask:
 
                /* Set window size */
                if (DoSetenv) {
 
                /* Set window size */
                if (DoSetenv) {
-                       win.ws_row = lines;
-                       win.ws_col = columns;
-                       ioctl(FILEDES, TIOCSWINSZ, &win);
+                       ioctl(FILEDES, TIOCGWINSZ, &win);
+                       if (win.ws_row == 0 && win.ws_col == 0) {
+                               win.ws_row = lines;
+                               win.ws_col = columns;
+                               ioctl(FILEDES, TIOCSWINSZ, &win);
+                       }
                }
                /* output startup string */
                if (!NoInit)
                }
                /* output startup string */
                if (!NoInit)