Package: acpi-support-base
Version: 0.109-9
Severity: minor
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

getXuser() just switched from finger to w a month ago, and that was a Good 
Thing.
But w has a problem as well:

- -f   Toggle  printing the from (remote hostname) field.  The default as
     released is for the from field to not be  printed,  although  your
     system  administrator or distribution maintainer may have compiled
     a version in which the from field is shown by default.

(from man w)

There is not a way to force w to show the From field; just a way to toggle from 
the default behavior.
And it looks like the default behaviour in debian is diverted from mainstream 
at compile time.
I guess things could change without any prior notice, leaving us with a broken 
script; maybe it's better to rely on pinky.

$ pinky -fw
root     *tty2     00:04  2008-10-13 22:46
luca      tty7            2008-10-13 20:58 :0
root      pts/5    00:02  2008-10-13 22:46 :0.0
luca      pts/6    00:02  2008-10-13 22:47 :0.0

We need to pick the second and the last fields, which makes:
user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == 
":'$displaynum'" ) { print $1; exit; } }'`
Since we check the strict equality to :displaynum, it doesn't matter if some 
lines do not have the From field and we read the login time.
Pinky is included in coreutils, so we don't need to depend on it; debian 
version does not divert from the mainstream behaviour; furthermore, it has a 
funny name.
Comments?
Luca

P.S.
I use gdm; can someone using xdm test it please? I don't see why it shouldn't 
work, but you never know...
P.P.S.
I think it's still quite ugly to get the display owner this way; but I was not 
able to find a sane way to do it.
I'll propose this also for a script in fglrx-atieventsd that is using finger at 
the moment.

- -- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages acpi-support-base depends on:
ii  acpid                    1.0.6-13        Utilities for using ACPI power man
ii  console-tools [console-u 1:0.2.3dbs-65.1 Linux console and font utilities

acpi-support-base recommends no packages.

Versions of packages acpi-support-base suggests:
ii  acpi-support                  0.109-9    scripts for handling many ACPI eve

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkjzu6oACgkQ4OR+1T4ba9hf5wCfTwDypnyhM6nXniuqLUMZHJ6d
nEYAnRxPIZnx+hhEBRC9XJrAGU7L9M44
=lGH4
-----END PGP SIGNATURE-----



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to