Displaying fields in wtmp file?


 
Thread Tools Search this Thread
Top Forums Programming Displaying fields in wtmp file?
# 1  
Old 06-26-2004
Displaying fields in wtmp file?

Anyone have any idea on how to display the fields for each record stored in the wtmp file using C? Am I correct in thinking that the info stored in wtmp is in binary and that utmpx will be of some help? Being a beginner, I can come up with bits and pieces of what I might need in order to do the task, but have a harder time putting all the pieces together to form working code. I am assuming I need to include these bits of code:

#include <utmp.h>
#include <utmpx.h>

struct utmpx record;
fread(&record, sizeof(record), ???)

printf(??????)

Any assistance would be greatly appreciated. Thanks.
# 2  
Old 06-27-2004
Fantastic Driver!!! Thank you very much.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Not able to sort two fields and printf not displaying the correct values

Not able to sorting two fileds resolved printf issue 01-1000/9|JAN 01-0000/6|MAN 01-1010/2|JAN 01-1010/2|JAN 01-1010/2|JAN 01-1000/9|JAN 01-1000/9|JAN 01-1000/9|SAA 01-1000/9|SAA 01-0000/6|SAN 01-0000/6|SAN 1.sort -t'|' -k1,1n -k2,2 file (3 Replies)
Discussion started by: kalia4u
3 Replies

2. Shell Programming and Scripting

Comparing fields of two files and displaying results

Hello , I am trying to compare two files i.e one master file and the other exclusion file. If the second field of masterfile is oracle8 then I need to compare the 3rd field of master file with the 1st field of all the rows of exclusion file else I need to compare 2nd field from master file with... (2 Replies)
Discussion started by: rahul2662
2 Replies

3. AIX

wtmp file - is there a patch to export the data another file each day?

sorry for being a noob, i am trying to find which user accessed the server at what time and there ip address at first i used who command but the output didn't contain the ip address then i used the last command which provided me with the ip of the users but when i searched i searched and found that... (1 Reply)
Discussion started by: hercules_1010
1 Replies

4. UNIX for Dummies Questions & Answers

How can I append a text at end of file after displaying the file

I have a file "sample.txt" with the content as below: Hi This is a Sample Text. I need a single command using cat which serve the following purpose. 1.display the contents of sample.txt 2.append some text to it 3. and then exit But, all should be served by a sinle command.:confused: (1 Reply)
Discussion started by: g.ashok
1 Replies

5. AIX

Impacts of emptying /var/adm/wtmp file ?

In our operating procedures, if a workstation has a space problem in the /var filesystem, one of the most frequent case we were told is the size of the /var/adm/wtmp file. Someone once told me it is dangerous to do this. Is it ? I cannot say for certain that whomever wrote that procedure is... (2 Replies)
Discussion started by: Browser_ice
2 Replies

6. AIX

wtmp file

Hello everyone I have a problem with the file wtmp that is on /var/adm This file was not on this directory (adm). I try creating a new file with the correct rights (644) and owner (adm:adm) but It doesnt work. If I type the last command i get this last ora10g ... (4 Replies)
Discussion started by: lo-lp-kl
4 Replies

7. AIX

WTMP file cleared after upgrade

Hello, we recently upgraded from AIX 5.2.9 to 5.3.6 and in the process the wtmp file was cleared out. Before the upgrade the system had not been rebooted in a very long time, so i'm curious if the clearing of the file is related to the upgrade or the reboot? If it was related to the reboot is... (2 Replies)
Discussion started by: zuessh
2 Replies

8. UNIX for Dummies Questions & Answers

displaying mutliple fields on command line

This is probably the dumbest question you guys can get, but I'm trying, as a complete noob, to display the unix calendar for all the months without Saturday and Sunday showing. How can I remove those fields without having to type all the fields in individually such as: cal -y | awk '{print $2,... (3 Replies)
Discussion started by: Trellot
3 Replies

9. UNIX for Dummies Questions & Answers

manage the wtmp file

Here's a usefull perl script to trim the wtmp file, in case it got too big, which happens sometimes, or got curropted (which also happens often). You could learn from here how to parse the wtmp file... but of course for just reading its content always simply use "last" like Neo said.... ... (0 Replies)
Discussion started by: me2unix
0 Replies
Login or Register to Ask a Question