diff options
author | Jim Meyering <jim@meyering.net> | 1994-01-24 20:46:23 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1994-01-24 20:46:23 +0000 |
commit | 370edcd71f9fe1eac7ac62799a7114f630de09e3 (patch) | |
tree | 1e81e3e7a070055f3610744aa2be6ab26facad01 | |
parent | a63a148116d71ba64dc34f73c1826bb1073fd495 (diff) | |
download | coreutils-370edcd71f9fe1eac7ac62799a7114f630de09e3.tar.xz |
merge with 1.9.2e
-rw-r--r-- | old/sh-utils/ChangeLog | 22 | ||||
-rw-r--r-- | old/sh-utils/NEWS | 1 | ||||
-rw-r--r-- | src/stty.c | 41 |
3 files changed, 64 insertions, 0 deletions
diff --git a/old/sh-utils/ChangeLog b/old/sh-utils/ChangeLog index 34d37cb3a..cebf5f472 100644 --- a/old/sh-utils/ChangeLog +++ b/old/sh-utils/ChangeLog @@ -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. diff --git a/old/sh-utils/NEWS b/old/sh-utils/NEWS index 48d9a53cd..bc8bf81c7 100644 --- a/old/sh-utils/NEWS +++ b/old/sh-utils/NEWS @@ -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 diff --git a/src/stty.c b/src/stty.c index 414a2304a..98f503f6d 100644 --- a/src/stty.c +++ b/src/stty.c @@ -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"); } |