+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.
+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
+\f
Major changes in release 1.9.1:
* stty can be built on Suns again
* minor fix for who -q
#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)
#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 ();
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;
char **argv;
{
struct termios mode;
+ struct termios new_mode;
enum output_type output_type = changed;
int optc;
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");
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);
}
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)
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 ");