.TH pututline() "" "" "General Function (libc)"
.PC "Write a record into a logging file"
.B "#include <utmp.h>"
\fBstruct utmp *\fIpututline(\fIrecord\^\fB)\fR
\fBconst struct utmp *\fIrecord\^\fB;\fR
.PP
.II utmp
Function
.B pututline()
writes
.I record
into the file that logs login events.
It is designed to update a record within the logging file.
.PP
.I record
points to the record to be insert into the logging file.
It is of type
.BR utmp ,
which is a structure whose fields describe a login event.
(For a detailed description of this structure, see the Lexicon entry for
.BR utmp.h .)
.PP
.B pututline()
assumes
that you have first called
.BR getutent() ,
.BR getutid() ,
or
.B getutline()
to open the logging file, and that the file's seek pointer is
is at or before the record you wish to update.
.B pututline()
looks for the first record within the logging file whose field
.B ut_line
matches \fIrecord\fB.ut_line\fR.
If it finds such a record,
.B pututline()
overwrites it with the contents of
.IR record ;
otherwise, it appends
.I record
onto the end of the logging file.
.PP
If all goes well,
.B pututline()
returns the address
.IR record .
It returns NULL if the logging file had not been opened, or if it could not
write
.I record
into the logging file.
.PP
By default,
.B getutid()
updates record in the logging file
.BR /etc/utmp .
If you wish to manipulate another file, use the function
.BR utmpname() .
.SH "See Also"
.Xr "libc," libc
.Xr "utmp.h" utmp.h
