who vs who am i output

Eivind E eivinde at terraplane.org
Thu Feb 3 18:12:40 UTC 2011


On freebsd 7.x and previous the output from "who am i" was
formatted just like who :

<klump> [rumrunner] ---> who;who am i
rumrunner        ttyp0     3 feb 18:45 (elg)
rumrunner        ttyp0     3 feb 18:45 (elg)

On 8.x there's a difference :

<elg> [rumrunner] ---> who;who am i
rumrunner        pts/1     3 feb 17:53 (:0.0)
rumrunner        1         3 feb 18:45

Is this intended or would something like the patch below be
correct?


Index: usr.bin/who/who.c
===================================================================
--- usr.bin/who/who.c	2011-01-20 14:25:17.000000000 +0100
+++ usr.bin/who/who.c	2011-01-20 14:35:25.000000000 +0100
@@ -266,8 +266,8 @@

  	if ((tty = ttyname(STDIN_FILENO)) == NULL)
  		tty = "tty??";
-	else if ((p = strrchr(tty, '/')) != NULL)
-		tty = p + 1;
+	else
+		tty = strchr(tty+1,'/')+1;

  	/* Search utmp for our tty, dump first matching record. */
  	while (fread(&ut, sizeof(ut), 1, fp) == 1)

-- 
     _
_  //
\\//   Eivind Evensen
  \/


More information about the freebsd-stable mailing list