Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Oct 2004 16:14:18 -0600
From:      Tillman Hodgson <tillman@seekingfire.com>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: getloadavg and source for /usr/bin/uptime
Message-ID:  <20041027221418.GO94897@seekingfire.com>
In-Reply-To: <9395922d04102715094411ac2d@mail.gmail.com>
References:  <9395922d04102715094411ac2d@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 27, 2004 at 11:09:46PM +0100, David Jenkins wrote:
> NB - I don't want to pipe uptime into awk or use a perl script etc,
> I'd much prefer it to be C based.

If you *did* want to do it that way, something like

  uptime | sed -e 's/.*: \([0-9.]*\).*/\1/'

is handy.

> If any knows where it's hiding (or why it's not there) I'd be very
> grateful if you could share it with me.

Probably because /usr/bin/uptime is a hard link to the /usr/bin/w
binary. I think you want the code from /usr/src/usr.bin/w/w.c.

-T


-- 
"It is not always the same thing to be a good man and a good citizen."
    -- Nicomachean Ethics, 325 B.C. by Aristotle



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041027221418.GO94897>