01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GETUT ( 3C ) GETUT ( 3C )<br />

NAME<br />

getutent, getutid, getutline, pututline, setutent, endutent, utmpname<br />

- access utmp file entry<br />

SYNOPSIS<br />

#include <br />

struct utmp •getutent ( )<br />

struct utmp *getutid (id)<br />

struct utmp •id;<br />

struct utmp •getutline (line)<br />

struct utmp •line;<br />

void pututline ( utmp)<br />

struct utmp •utmp;<br />

void setutent ( )<br />

void endutent ( )<br />

void utmpname (file)<br />

char •file;<br />

DESCRIPTION<br />

Getutent, getutid and getutline each return a pointer to a structure<br />

of the following type:<br />

struct utmp {<br />

char<br />

char<br />

char<br />

short<br />

short<br />

};<br />

struct<br />

short<br />

short<br />

} ut_exit;<br />

time_t<br />

ut_user[8j;<br />

ut_id[4j;<br />

ut_line[12j;<br />

ut_pid;<br />

ut_type;<br />

exit_stat us {<br />

e_termination;<br />

e_exit;<br />

ut_time;<br />

I* User login name *I<br />

I* letclinittab id (usually line #) *I<br />

I* device name (console, lnxx) *I<br />

I* process id *I<br />

I* type of entry •I<br />

I* Process termination status *I<br />

I* Process exit status *I<br />

I* The exit status of a process<br />

* marked as DEAD _.PROCESS. • I<br />

I* time entry was made •I<br />

Getutent reads in the next entry from a utmp-Jike file. If the file<br />

is not already open, it opens it. If it reaches the end of the file, it<br />

fails.<br />

Getutid searches forward from the current point in the utmp file<br />

until it finds an entry with a ut_type matching id- > ut_type if<br />

the type specified is RUN_LVL, BOOT_TIME, OLD_TIME or<br />

NEW_TIME. If the type specified in id is INIT_PROCESS,<br />

LOGIN_PROCESS, USER_PROCESS or DEAD_PROCESS, then getutid<br />

will return a pointer to the first entry whose type is one of<br />

these four and whose ut_id field matches id- > ut_id . If the end<br />

of file is reached without a match, it fails.<br />

Getutline searches forward from the current point in the utmp file<br />

until it finds an entry of the type LOGIN_PROCESS or<br />

USERJ>ROCESS which also has a ut_line string matching the<br />

- 1 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!