On Mon, Sep 23, 2002 at 04:18:51PM +0100, Andrew Gordon wrote:

[...]
> 3) This patch doesn't fix the problem, it just avoids it.
>    While it would be useful to have inactivity information about
>    X terminals, I can't see any way to get at it.  Certainly, there
>    is nothing on the local machine that holds the information
>    (the user might be interacting with an application running on
>    another machine), so 'w' would need to ask the X server, and
>    I don't believe that a mechanism exists for it to do so.
> 
> 
> --- usr.bin/w/w.c       12 Mar 2002 19:51:51 -0000      1.38.2.6
> +++ usr.bin/w/w.c       23 Sep 2002 15:00:45 -0000
> @@ -504,6 +504,12 @@
>         static struct stat sb;
>         char ttybuf[MAXPATHLEN];
> 
> +       if (line[0] == ':') {
> +               /* Assume an X login via sessreg        */
> +               time(&sb.st_atime);
> +               sb.st_rdev = -1;
> +               return (&sb);
> +       }
>         (void)snprintf(ttybuf, sizeof(ttybuf), "%s%.*s", _PATH_DEV, sz,
> line);
>         if (stat(ttybuf, &sb)) {
>                 warn("%s", ttybuf);
> 

The patch doesn't work if you have a remote X-server logging onto the
system, as $DISPLAY will be "host:0.0" in most cases. Perhaps an
index(3) on line?

Cheers.
-- 
Jonathan Chen <[EMAIL PROTECTED]>
----------------------------------------------------------------------
                         Power corrupts, Absolute Power is pretty neat

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-stable" in the body of the message

Reply via email to