After the previous quick responses... I have one more small query again!
Now , I want to query the X servers.. See.. what I have to do is this: I have a deamon running... Now I give it some username It first checks if the user is presntly logged in... (either on tty or on pts ). Then I determine the delay for which the user was idle on the terminals on which he has logged in... Currently , I am doing this for tty and pts only. Now, I pop up a window on the terminal(tty ; using ncurses) on which the user is logged on and has least idle time (similar to write command's working). My deamon also has the property to popup GUI windows on X screens. But now, I have this problem : How do I determine if the user is presently logged on X ? And if he is , which DISPLAY is he using ???
Is there something like utmp (which works for tty and pts records )... for X ? I want to determine if the user has least idle time on X or on tty/pts .. I wrote the code for tty.. but what abt X ??? Please guide me.. Thanx in advance !