Urgent : WTMP structure

Urgent : WTMP structure

Post by Jonathan Len » Sat, 16 Mar 1996 04:00:00




> I'm really stuck on a UNIX/C assignemnt, that emulates the WHO command by
> using the wtmp file. I know the structure defined in <utmp.h>, however, I
> find that there are far more logins than logouts (indicated by a blank
> username).

> What I'm doing is creating a doubly linked list, and inserting each
> username into it. Later, when I encounter logouts, I disconnect and free
> the entry which has been logged out.  But there are so many more logins
> than logouts, that people who aren't on the system (by the who command)
> still show up in my program.

> Is there something that I'm missing here? If anyone has suggestions, I'd
> really appreciate your help.

> Thanks,
> David

David,

Are you allowed to use the utmp or utmpx(Sun) files instead of wtmp?  the utmp
file is the closest thing to a list of current users that you can get.  In
fact, who and a number of other commands use it for their information.  It can
get a little confused sometimes if someone does an unclean logout, but even
the writers of "who" couldn't circumvent that problem.

Using getutent() and ttyslot() you could even code "whoami".  I hope some of
this was at least partially useful. Good luck.

Respectfully,

Jonathan Lent
JCPenney Company AIT/TS

 
 
 

Urgent : WTMP structure

Post by David Reill » Sat, 16 Mar 1996 04:00:00


I'm really stuck on a UNIX/C assignemnt, that emulates the WHO command by
using the wtmp file. I know the structure defined in <utmp.h>, however, I
find that there are far more logins than logouts (indicated by a blank
username).

What I'm doing is creating a doubly linked list, and inserting each
username into it. Later, when I encounter logouts, I disconnect and free
the entry which has been logged out.  But there are so many more logins
than logouts, that people who aren't on the system (by the who command)
still show up in my program.

Is there something that I'm missing here? If anyone has suggestions, I'd
really appreciate your help.

Thanks,
David

 
 
 

1. /var/adm/wtmp structure?

What is the structure of the /var/adm/wtmp file?

(I'd like to get a report somewhat more detailed than ''ac'' for
my login times).

Thanks!

--
Alex Ramos            | Electrical Engineering | Fala-se Portugues, tche!

"Weiner's Law of Libraries:
        There are no answers, only cross references."

2. LaBrea for firewalled machine

3. ftp/urgent/urgent/urgent

4. deny root telnet access

5. URGENT URGENT URGENT

6. Sec. Bulletin: mediainit(1) in HP-UX 9.X & 10.X

7. ftp problem/urgent/urgent/urgent

8. Defragmentation?

9. wtmp /var/adm/wtmp No such file or directory

10. Structures in structures

11. URGENT URGENT LU0

12. A *** URGENT COMPILING URGENT ***

13. URGENT URGENT dlopen() help needed...