Bill Peters <[EMAIL PROTECTED]> writes:

| The "who" on Linux 6.0 (sh-utils-1.16-23) produces output like
|
|       peters   pts/7    Dec 17 11:38 (bitburger.as.arizona.edu)
|
| when I use telnet or rlogin to get to the machine.  On Linux 6.1
| (sh-utils-2.0-1), this field is blank:
|
|       gag      pts/0    Dec 17 11:42
|
| This breaks a script I have that fetches the machine I logged in from so that
| DISPLAY can be redirected to that machine.  Is the new behavior of "who"
| intended?

Thanks for the report.
Here's a tentative patch.  If you get dotted quads but want
names instead, use --lookup (-l).

Index: who.c
===================================================================
RCS file: /fetish/shellutils/src/who.c,v
retrieving revision 1.55
diff -u -p -r1.55 who.c
--- who.c       1999/04/24 21:29:22     1.55
+++ who.c       1999/12/18 11:12:03
@@ -175,7 +175,7 @@ print_entry (const STRUCT_UTMP *utmp_ent
        printf ("   .  ");
     }
 #if HAVE_UT_HOST
-  if (utmp_ent->ut_host[0] && do_lookup)
+  if (utmp_ent->ut_host[0])
     {
       char ut_host[sizeof (utmp_ent->ut_host) + 1];
       char *host = 0, *display = 0;
@@ -189,9 +189,12 @@ print_entry (const STRUCT_UTMP *utmp_ent
       if (display)
        *display++ = '\0';
 
-      if (*ut_host)
-       /* See if we can canonicalize it.  */
-       host = canon_host (ut_host);
+      if (*ut_host && do_lookup)
+       {
+         /* See if we can canonicalize it.  */
+         host = canon_host (ut_host);
+       }
+
       if (! host)
        host = ut_host;
 

Reply via email to