home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.utils.bug
- Path: sparky!uunet!stanford.edu!agate!spool.mu.edu!nigel.msen.com!emory!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!devon.lns.pa.US!paul
- From: paul@devon.lns.pa.US (Paul Sutcliffe Jr.)
- Subject: changes to shellutils-1.8
- Message-ID: <9211090953.AA24643@hobbes.cert.org>
- Sender: gnulists@ai.mit.edu
- Reply-To: paul@devon.lns.pa.us (Paul Sutcliffe Jr.)
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Sun, 8 Nov 1992 19:36:47 GMT
- Approved: bug-gnu-utils@prep.ai.mit.edu
- Lines: 195
-
- While porting SHELLUTILS-1.8 to my ESIX 4.0.3a (SYS V/386 R4.0 V3.0)
- system, I made some changes to allow "who" to use the ut_host member in
- the utmpx structure. Here are unified diffs of the changes.
-
- The changes aren't elegant. They allow "who" to function with the
- utmpx file instead of the utmp file, while retaining the output format
- (WRT field sizes) of the utmp fields.
-
- - paul
-
- --- Makefile.in.orig Fri Sep 11 00:09:59 1992
- +++ Makefile.in Sun Nov 8 23:19:26 1992
- @@ -52,7 +52,8 @@
- # -DHAVE_TZNAME If you have tm_zone and tzname but not tm_zone;
- # otherwise uses tm_isdst and timezone.
- # -DHAVE_C_LINE If you have struct termios with the c_line member.
- -# -DHAVE_UT_HOST If you have ut_host in struct utmp.
- +# -DHAVE_UTMPX If you have struct utmpx.
- +# -DHAVE_UT_HOST If you have ut_host in struct utmp/utmpx.
- # -DNICE_PRIORITY If you lack getpriority and setpriority system
- # calls but have nice system call.
- # -DWINSIZE_IN_PTEM If your system defines `struct winsize' in sys/ptem.h.
-
- --- configure.in.orig Thu Oct 1 20:56:22 1992
- +++ configure.in Sun Nov 8 23:19:14 1992
- @@ -44,7 +44,12 @@
- AC_COMPILE_CHECK(ut_host in struct utmp,
- [#include <sys/types.h>
- #include <utmp.h>], [struct utmp ut; ut.ut_host;],
- -AC_DEFINE(HAVE_UT_HOST))
- +AC_DEFINE(HAVE_UT_HOST),
- +AC_COMPILE_CHECK(ut_host in struct utmpx,
- +[#include <sys/types.h>
- +#include <utmpx.h>], [struct utmpx ut; ut.ut_host;],
- +[AC_DEFINE(HAVE_UT_HOST)
- +AC_DEFINE(HAVE_UTMPX)]))
-
- AC_COMPILE_CHECK(POSIX termios,
- [#include <sys/types.h>
-
- --- src/who.c.orig Wed Oct 28 15:02:50 1992
- +++ src/who.c Sun Nov 8 16:35:16 1992
- @@ -34,7 +34,16 @@
-
- #include <stdio.h>
- #include <sys/types.h>
- +#ifdef HAVE_UTMPX
- +#include <utmpx.h>
- +#define UTMP struct utmpx
- +#undef UTMP_FILE
- +#define UTMP_FILE UTMPX_FILE
- +#define ut_time ut_xtime
- +#else
- #include <utmp.h>
- +#define UTMP struct utmp
- +#endif
- #include <time.h>
- #include <getopt.h>
- #ifndef _POSIX_SOURCE
- @@ -60,7 +69,7 @@
-
- char *idle_string ();
- char *xmalloc ();
- -struct utmp *search_entries ();
- +UTMP *search_entries ();
- void error ();
- void list_entries ();
- void print_entry ();
- @@ -176,7 +185,7 @@
- exit (0);
- }
-
- -static struct utmp *utmp_contents;
- +static UTMP *utmp_contents;
-
- /* Display a list of who is on the system, according to utmp file FILENAME. */
-
- @@ -209,7 +218,7 @@
-
- fstat (desc, &file_stats);
- if (file_stats.st_size > 0)
- - utmp_contents = (struct utmp *) xmalloc ((unsigned) file_stats.st_size);
- + utmp_contents = (UTMP *) xmalloc ((unsigned) file_stats.st_size);
- else
- {
- close (desc);
- @@ -223,7 +232,7 @@
- if (close (desc))
- error (1, errno, "%s", filename);
-
- - return file_stats.st_size / sizeof (struct utmp);
- + return file_stats.st_size / sizeof (UTMP);
- }
-
- /* Display a line of information about entry THIS. */
- @@ -230,8 +239,9 @@
-
- void
- print_entry (this)
- - struct utmp *this;
- + UTMP *this;
- {
- + struct utmp *ut;
- struct stat stats;
- time_t last_change;
- char mesg;
- @@ -251,12 +261,12 @@
- }
-
- printf ("%-*.*s",
- - sizeof (this->ut_name), sizeof (this->ut_name),
- + sizeof (ut->ut_name), sizeof (ut->ut_name),
- this->ut_name);
- if (include_mesg)
- printf (" %c ", mesg);
- printf (" %-*.*s",
- - sizeof (this->ut_line), sizeof (this->ut_line),
- + sizeof (ut->ut_line), sizeof (ut->ut_line),
- this->ut_line);
- printf (" %-12.12s", ctime (&this->ut_time) + 4);
- if (include_idle)
- @@ -265,10 +275,11 @@
- printf (" %s", idle_string (last_change));
- else
- printf (" . ");
- + printf ( " %5d", this->ut_pid);
- }
- #ifdef HAVE_UT_HOST
- if (this->ut_host[0])
- - printf (" (%-.*s)", sizeof (this->ut_host), this->ut_host);
- + printf (" (%-.*s)", sizeof (this->ut_host), this->ut_host);
- #endif
-
- putchar ('\n');
- @@ -281,7 +292,7 @@
- list_entries (n)
- int n;
- {
- - register struct utmp *this = utmp_contents;
- + register UTMP *this = utmp_contents;
- register int entries = 0;
-
- while (n--)
- @@ -311,8 +322,11 @@
- printf ("%-*s ", sizeof (ut->ut_line), "LINE");
- printf ("LOGIN-TIME ");
- if (include_idle)
- - printf ("IDLE ");
- - printf ("FROM\n");
- + printf (" IDLE PID ");
- +#ifdef HAVE_UT_HOST
- + printf (" FROM");
- +#endif
- + putchar ('\n');
- }
-
- /* Display `utmp_contents', which should have N entries. */
- @@ -321,7 +335,7 @@
- scan_entries (n)
- int n;
- {
- - register struct utmp *this = utmp_contents;
- + register UTMP *this = utmp_contents;
-
- if (include_heading)
- print_heading ();
- @@ -343,12 +357,12 @@
- Return the first matching entry found, or NULL if there
- is no matching entry. */
-
- -struct utmp *
- +UTMP *
- search_entries (n, line)
- int n;
- char *line;
- {
- - register struct utmp *this = utmp_contents;
- + register UTMP *this = utmp_contents;
-
- while (n--)
- {
- @@ -370,7 +384,7 @@
- who_am_i (filename)
- char *filename;
- {
- - register struct utmp *utmp_entry;
- + register UTMP *utmp_entry;
- char hostname[MAXHOSTNAMELEN + 1];
- char *tty;
-
-
- --
- INTERNET: paul@devon.lns.pa.us | Why doesn't anything ever
- UUCP: ...!rutgers!devon!paul | vanish into THICK air? --Me
-
-