*BSD News Article 30824


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!newshost.anu.edu.au!munnari.oz.au!bunyip.cc.uq.oz.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!EU.net!sun4nl!relay.philips.nl!misf1!gvrooij
From: gvrooij@ms.philips.nl (Guido van Rooij)
Subject: Re: ?Perl/C access to wtmp,utmp?
Message-ID: <1994May24.090558.9473@ms.philips.nl>
Sender: news@ms.philips.nl
Organization: Philips Medical Systems, Best
X-Newsreader: TIN [version 1.2 PL2]
References: <Cq8tnv.EvA@scu.edu.au>
Date: Tue, 24 May 1994 09:05:58 GMT
Lines: 13

Philip Shepherd (pshepher@scu.edu.au) wrote:
: Is there any easy way to access the info stored in the 'wtmp' and 'utmp'
: files from Perl or C?

: In particular, I'm interested in the number of minutes a user has been 
: logged in ... this CAN be deduced from the 'login at' field of the 'w'
: command but ends up being very inefficient (especially in perl).

You can
	open HANDLE "last|"
and look at teh output of the last command.

-Guido