]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
merge with 1.9.2e
authorJim Meyering <jim@meyering.net>
Mon, 24 Jan 1994 20:46:23 +0000 (20:46 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 24 Jan 1994 20:46:23 +0000 (20:46 +0000)
old/sh-utils/ChangeLog
old/sh-utils/NEWS
src/stty.c

index 34d37cb3aec82d59df25335d9a64646e258e62a6..cebf5f47239c394b953d311a89cdab313f176a06 100644 (file)
@@ -1,3 +1,25 @@
+Mon Jan 24 12:57:18 1994  Jim Meyering  (meyering@comco.com)
+
+       * stty.c (set_window_size): Work around SunOS 4.x kernel bug that
+       makes `stty rows 34 cols 80;stty rows 0;stty cols 0' incorrectly
+       set rows to 80 and columns to 0.  Sun's stty has this problem, too.
+       The kernel bug is fixed in Solaris 2.  Mostly from Alexander Dupuy
+       <dupuy@cs.columbia.edu>.
+
+Thu Jan 13 17:27:38 1994  Jim Meyering  (meyering@comco.com)
+
+       * src/Makefile.in: Change all link commands to use both $(CFLAGS)
+       and $(LDFLAGS).
+
+Mon Jan 10 01:20:38 1994  Jim Meyering  (meyering@comco.com)
+
+       * man/Makefile.in (manprefix): Use binprefix as the default.
+
+Thu Jan 06 18:19:06 1994  Jim Meyering  (meyering@comco.com)
+
+       * who.c (print_entry): Prepend `/dev/' only if ut_line is not
+       already an absolute filename.  Just to be safe.
+
 Fri Dec 31 00:22:59 1993  Jim Meyering  (meyering@comco.com)
 
        * date.c (usage): Reorder listing of % formats in `sort -f' order.
index 48d9a53cdcaa93db7c83a5895374496776c21750..bc8bf81c795d005bedf214b22e4c29f93882b1ee 100644 (file)
@@ -1,4 +1,5 @@
 User visible changes in release 1.9.3
+* stty works around SunOS 4.x kernel bug that made `stty rows 0 cols 0' fail.
 * who and tee no longer fail gratuitously when continued after an
   interrupted read or write system call.
 * date accepts new format: %s time in seconds since 00:00:00 1/1/1971
index 414a2304a941431ebddecf41fbd49d87d566ed53..98f503f6d9235cf4e34fc4fab216d8ab266ccecd 100644 (file)
@@ -1089,6 +1089,47 @@ set_window_size (rows, cols)
       if (cols >= 0)
        win.ws_col = cols;
     }
+
+#ifdef TIOCSSIZE
+  /* The following code deals with a bug in the SunOS 4.x (and 3.x?) kernel.
+     This comment from sys/ttold.h describes Sun's twisted logic - a better
+     test would have been (ts_lines > 64k || ts_cols > 64k || ts_cols == 0).
+     At any rate, the problem is gone in Solaris 2.x.
+
+       Unfortunately, the old TIOCSSIZE code does collide with TIOCSWINSZ,
+       but they can be disambiguated by checking whether a "struct ttysize"
+       structure's "ts_lines" field is greater than 64K or not.  If so,
+       it's almost certainly a "struct winsize" instead.
+
+     At any rate, the bug manifests itself when ws_row == 0; the symptom is
+     that ws_row is set to ws_col, and ws_col is set to (ws_xpixel<<16) +
+     ws_ypixel.  Since GNU stty sets rows and columns separately, this bug
+     caused "stty rows 0 cols 0" to set rows to cols and cols to 0, while
+     "stty cols 0 rows 0" would do the right thing.  On a little-endian
+     machine like the sun386i, the problem is the same, but for ws_col == 0.
+
+     The workaround is to do the ioctl once with row and col = 1 to set the
+     pixel info, and then do it again using a TIOCSSIZE to set rows/cols.  */
+
+  if (win.ws_row == 0 || win.ws_col == 0)
+    {
+      struct ttysize ttysz;
+
+      ttysz.ts_lines = win.ws_row;
+      ttysz.ts_cols = win.ws_col;
+
+      win.ws_row = 1;
+      win.ws_col = 1;
+
+      if (ioctl (0, TIOCSWINSZ, (char *) &win))
+       error (1, errno, "standard input");
+
+      if (ioctl (0, TIOCSSIZE, (char *) &ttysz))
+       error (1, errno, "standard input");
+      return;
+    }
+#endif
+
   if (ioctl (0, TIOCSWINSZ, (char *) &win))
     error (1, errno, "standard input");
 }