Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Feb 2011 18:57:09 +0100 (CET)
From:      Eivind E <eivinde@terraplane.org>
To:        freebsd-stable@freebsd.org
Subject:   who vs who am i output
Message-ID:  <20110203185238.W82140@rumrunner.mine.nu>

next in thread | raw e-mail | index | archive | help
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
  \/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110203185238.W82140>