summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--old/sh-utils/ChangeLog37
-rw-r--r--old/sh-utils/NEWS5
-rw-r--r--src/expr.c9
-rw-r--r--src/printf.c11
-rw-r--r--src/stty.c29
-rw-r--r--src/who.c20
6 files changed, 91 insertions, 20 deletions
diff --git a/old/sh-utils/ChangeLog b/old/sh-utils/ChangeLog
index c3e314840..0dee1d0ee 100644
--- a/old/sh-utils/ChangeLog
+++ b/old/sh-utils/ChangeLog
@@ -1,3 +1,40 @@
+Fri Nov 19 23:08:03 1993 Jim Meyering (meyering@comco.com)
+
+ * who.c (print_entry): Produce reasonably formatted output even when
+ sizeof (this->ut_name,ut_line) are much larger than 8. For Solaris
+ and other SysVr4. With help from Arne H. Juul.
+ * configure.in (HAVE_UTMPX_H): New test; combined with test for the
+ ut_host field. From Arne H. Juul.
+
+ * memcmp.c: New file.
+ * lib/Makefile.in [SOURCES]: Add memcmp.c.
+ * configure.in (AC_REPLACE_FUNCS): Add memcmp.
+ Add test for 8-bit clean memcmp.
+
+ * configure.in (AC_HAVE_FUNCS): Add isascii.
+ * expr.c [!defined (isascii) || defined (STDC_HEADERS)]: This failed
+ on AIX PS/2 1.3 systems because isascii is a function and it is used
+ in definitions (with the necessary side effect of assigning to a
+ global variable) of the is* macros. Also test HAVE_ISASCII and
+ redefine ISASCII(c) instead of isascii.
+ Reported by Minh Tran-Le (tranle@intellicorp.com).
+ * printf.c: Ditto.
+
+ * configure.in (AC_HAVE_HEADERS): Add sys/timeb.h; getdate.y tests
+ HAVE_SYS_TIMEB_H.
+
+ * stty.c (main): Detect the case in which POSIX-conformant tcsetattr
+ fails and still returns zero.
+
+Wed Nov 17 21:05:10 1993 Jim Meyering (meyering@comco.com)
+
+ * yes.c (main): Complete my half-finished Nov 2 change.
+ yes with arguments did not print newlines. From Andreas Schwab
+ (ls5.informatik.uni-dortmund.de).
+
+ * stty.c (wrapf): Fix off-by-one error that could make `stty -a'
+ output lines one character too long. From Andreas Schwab.
+
Sat Nov 13 00:11:19 1993 Jim Meyering (meyering@comco.com)
* Version 1.9.1.
diff --git a/old/sh-utils/NEWS b/old/sh-utils/NEWS
index 4b3f4c3d5..68e493af1 100644
--- a/old/sh-utils/NEWS
+++ b/old/sh-utils/NEWS
@@ -1,3 +1,8 @@
+User visible changes in release 1.9.2:
+* fix a minor problem in formatting of output from `stty -a'
+* yes with arguments outputs newlines again
+* partial stty failures are reported
+
Major changes in release 1.9.1:
* stty can be built on Suns again
* minor fix for who -q
diff --git a/src/expr.c b/src/expr.c
index 26c4ffa0d..e5549140f 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -48,12 +48,13 @@
#include "version.h"
#include "long-options.h"
-#if !defined (isascii) || defined (STDC_HEADERS)
-#undef isascii
-#define isascii(c) 1
+#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
+#define ISASCII(c) 1
+#else
+#define ISASCII(c) isascii(c)
#endif
-#define ISDIGIT(c) (isascii (c) && isdigit (c))
+#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
#define NEW(type) ((type *) xmalloc (sizeof (type)))
#define OLD(x) free ((char *) x)
diff --git a/src/printf.c b/src/printf.c
index 43cc0dec3..0fe108fb6 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -63,13 +63,14 @@
#include "version.h"
#include "long-options.h"
-#if !defined (isascii) || defined (STDC_HEADERS)
-#undef isascii
-#define isascii(c) 1
+#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
+#define ISASCII(c) 1
+#else
+#define ISASCII(c) isascii(c)
#endif
-#define ISDIGIT(c) (isascii (c) && isdigit (c))
-#define ISXDIGIT(c) (isascii (c) && isxdigit (c))
+#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
+#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
#ifndef STDC_HEADERS
double strtod ();
diff --git a/src/stty.c b/src/stty.c
index 60f2ec9f1..fc44cd35d 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -428,7 +428,7 @@ wrapf (message, va_alist)
vsprintf (buf, message, args);
va_end (args);
buflen = strlen (buf);
- if (current_col + buflen >= max_col)
+ if (current_col + (current_col > 0) + buflen >= max_col)
{
putchar ('\n');
current_col = 0;
@@ -624,6 +624,7 @@ main (argc, argv)
char **argv;
{
struct termios mode;
+ struct termios new_mode;
enum output_type output_type = changed;
int optc;
@@ -661,6 +662,9 @@ done:;
if (show_help)
usage (0);
+ /* Initialize to all zeroes so there is no risk memcmp will report a
+ spurious difference in uninitialized portion of the structure. */
+ bzero (&mode, sizeof (mode));
if (tcgetattr (0, &mode))
error (1, errno, "standard input");
@@ -795,6 +799,29 @@ done:;
if (tcsetattr (0, TCSADRAIN, &mode))
error (1, errno, "standard input");
+ /* POSIX (according to Zlotnick's book) tcsetattr returns zero if it
+ performs *any* of the requested operations. This means it can report
+ `success' when it has actually failed to perform some proper subset
+ of the requested operations. To detect this partial failure, get the
+ current terminal attributes and compare them to the requested ones. */
+
+ /* Initialize to all zeroes so there is no risk memcmp will report a
+ spurious difference in uninitialized portion of the structure. */
+ bzero (&new_mode, sizeof (new_mode));
+ if (tcgetattr (0, &new_mode))
+ error (1, errno, "standard input");
+
+ /* Normally, one shouldn't use memcmp to compare structures that
+ may have `holes' containing uninitialized data, but we have been
+ careful to initialize the storage of these two variables to all
+ zeroes. One might think it more efficient simply to compare the
+ modified fields, but that would require enumerating those fields --
+ and not all systems have the same fields in this structure. */
+
+ if (memcmp (&mode, &new_mode, sizeof (mode)) != 0)
+ error (1, 0,
+ "standard input: unable to perform all requested operations");
+
exit (0);
}
diff --git a/src/who.c b/src/who.c
index 8ef2749f4..b7f800b90 100644
--- a/src/who.c
+++ b/src/who.c
@@ -297,15 +297,17 @@ print_entry (this)
last_change = 0;
}
- printf ("%-*.*s",
- (int) sizeof (this->ut_name), (int) sizeof (this->ut_name),
- this->ut_name);
+ printf ("%-8.*s", (int) sizeof (this->ut_name), this->ut_name);
if (include_mesg)
printf (" %c ", mesg);
- printf (" %-*.*s",
- (int) sizeof (this->ut_line), (int) sizeof (this->ut_line),
- this->ut_line);
+ printf (" %-8.*s", (int) sizeof (this->ut_line), this->ut_line);
+
+#ifdef HAVE_UTMPX_H
+ printf (" %-12.12s", ctime (&this->ut_tv.tv_sec) + 4);
+#else
printf (" %-12.12s", ctime (&this->ut_time) + 4);
+#endif
+
if (include_idle)
{
if (last_change)
@@ -362,12 +364,10 @@ list_entries (n)
static void
print_heading ()
{
- STRUCT_UTMP *ut;
-
- printf ("%-*s ", (int) sizeof (ut->ut_name), "USER");
+ printf ("%-8s ", "USER");
if (include_mesg)
printf ("MESG ");
- printf ("%-*s ", (int) sizeof (ut->ut_line), "LINE");
+ printf ("%-8s ", "LINE");
printf ("LOGIN-TIME ");
if (include_idle)
printf ("IDLE ");