Commit Graph

104 Commits

Author SHA1 Message Date
kim 077ff6605b One third of screen looks much better than half, for default maxhost. 2005-03-13 04:08:16 +00:00
wiz 36cdbd4840 Bump date for recent changes. 2005-01-11 09:39:12 +00:00
kim 61f9450361 Make -w flag apply to the WHAT field also (command and args).
Use at most half of ttywidth for WHERE field (hostname) instead
of a hardcoded maximum width.  (XXX: this is still not a good
default for displays under 80 columns.  Should probably count
the width of all the other columns, using 8 for the WHAT field.)
2005-01-08 05:08:53 +00:00
kim 2bb4a74034 Line up "days" style output in the IDLE field. 2005-01-08 05:04:34 +00:00
kim ee64b0d712 The w command does not display a CPU time, so don't talk about it. 2005-01-08 04:58:08 +00:00
wiz 3c75d39ba0 New sentence, new line. Add a comma. 2004-12-23 01:55:30 +00:00
christos 25c67c975f Fix usage, and call setprogname()! 2004-12-22 17:20:30 +00:00
christos 5df4136a03 PR/28751: Ed Ravin: Limit host field output by default to 35 characters so
that things don't wrap. Add -w flag to enable full output. Delete mention
of the old and not supported flags. This was 11 years ago, and very few
people even remember what these flags did.
2004-12-22 17:16:07 +00:00
christos 6b2a6f8a02 Be a bit more careful with errors; if you cannot find the pty to stat for
time, then report ? instead of the previous random contents of struct stat.
2004-11-19 13:17:06 +00:00
christos 280dbafe67 PR/28185: Brian Marcotte: w command broken when user specified 2004-11-11 00:09:07 +00:00
christos c7ead5d42d Don't print just two characters for the tty; change the field width of the
tty to 7.
2004-11-10 16:58:10 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
wiz 9b45ab8153 Remove superfluous max() macro.
Noted by Jeff Ito in PR 23932.
2004-01-03 01:18:14 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
itojun 28f506f3a2 strlcpy 2003-07-12 13:57:49 +00:00
christos 0d2dc54013 keep track of the two proc entries significant to the utmp entry. The one
indicated by the pid in struct utmpx [or ftpd hack], and the one that is
associated with the controlling tty, is in the foreground process group,
and has most cpu. If the second one exists, use that one, else use the first
one.
2003-02-26 19:10:28 +00:00
fredb 1709947012 Print the command in parenthesis, if kvm_getargv2() returns no
arguments. This lets "xterm -e command" display as "(command)".
Reviewed by christos.
2003-02-26 19:01:54 +00:00
christos 8399be1bba keep track which entries are utmp and which are utmpx, so we can print
them on the stale message.
2003-02-26 15:04:10 +00:00
christos c7d4de107a - Remove SUPPORT_FTPD_UTMP flag. Enable it only for utmp entries, utmpx does
not need it since it can get the pid from the utmpx structure.
- If the line is not found, and the pid is present (from utmpx) use that to
  determine the process information for that particular entry.
2003-02-26 15:01:09 +00:00
thorpej 3fdac2b8c5 Merge the nathanw_sa branch. 2003-01-18 10:52:16 +00:00
enami b579228888 Fix whitespace usage. 2002-10-21 10:18:23 +00:00
enami f594d61275 If utmpx support is enabled, use sockaddr field to get numeric address. 2002-10-21 10:10:26 +00:00
lukem 5d4973fe97 makefile delint. use NETBSDSRCDIR as appropriate 2002-09-18 14:00:33 +00:00
christos b3ac19283d Make uptime show the correct number of users. 2002-09-16 04:02:21 +00:00
mycroft 2f85ba247c uptime(1) is NOT supposed to always say `1 user'. 2002-09-16 01:49:06 +00:00
christos 52f955bcfd fixed user miscounting. reported by kim. 2002-08-22 14:52:55 +00:00
christos 156b33bc4e skip blank entries. 2002-07-28 20:47:57 +00:00
christos 1e703dc185 add utmpx support. 2002-07-27 23:58:40 +00:00
wiz d765b90d71 Sort SEE ALSO and sections. 2001-12-08 19:24:10 +00:00
wiz aded0d2cce Whitespace cleanup. 2001-12-01 16:43:07 +00:00
enami f7a77f5cca Fix whitespace usage. 2001-11-05 03:35:49 +00:00
wiz e26cad44d7 Appeared in .Bx 3.0, not .Ux 3.0. 2001-10-19 17:37:32 +00:00
cgd a8ec668ddf convert to use getprogname() 2001-02-19 23:03:42 +00:00
mjl 3d418a4a73 ANSIfy. 2001-01-05 04:59:21 +00:00
mjl 96015e4766 (From FreeBSD)
Get things right for tty names of length UT_LINESIZE. (FreeBSD PR 3638)
If the utmp login time is greater than the tty atime, use it to calculate
the idle time instead of the atime.
Fix -n with 16-chars hostnames (FreeBSD PR 11286).
Domain names are case insensitive.
2001-01-05 04:54:53 +00:00
cgd 2af1e46eab __CONCAT does token pasting, not string concatnation. if something like:
__CONCAT("foo","bar");
actually works to concantate strings, it's because the preprocessor expands
it into "foo""bar" as separate strings, and then ANSI string concatenation
is performed on that.  It's more straightforward to just use ANSI string
concatenation directly, and newer GCCs complain (rightly) about misuse
of token pasting.
2000-12-20 01:17:49 +00:00
is 135600f947 More format string cleanup by sommerfeld. 2000-10-11 14:46:00 +00:00
jdolecek f8031c2d6d add code to recognize special ftpd utmp entries and match corresponding
process accordingly, so that w parses entries made by "ftpd -U" correctly

the new code is conditionalized upon define SUPPORT_FTPD_UTMP, turned
on by default in w(1)'s Makefile

This addresses bin/11095 by Daniel Hagerty.
2000-09-28 18:20:29 +00:00
christos 2120a34cd6 - Don't core dump when we have stale utmp entries; warn the user instead.
- Make this work again in single user when invoked as uptime and utmp is
  not present.
2000-08-21 00:19:06 +00:00
simonb 0afebfffdf Redo previous slightly differently - restore the behaviour of two
characters for the tty name and the first 'T' of 'TTY' hanging over
the blank column at the end of the username field.
2000-07-22 03:14:06 +00:00
enami ce5e5c761e - Set the minimum width for login name to 4, the width of "USER".
- Fix the number of colmuns left for proc. args.  Previously, an effect of
  NUL was canceled implicitly, but now we must handle it explicitly.
- Fix the width for tty name.
2000-07-15 22:45:14 +00:00
simonb 34d4c12031 Use KERN_CONSDEV for determining the console device instead of CPU_CONSDEV
which is not available on all ports.
2000-07-13 14:28:07 +00:00
simonb b00d9cf6cc Use p_login from struct proc instead of ut_name from struct utmp so
that a truncated name isn't used if the login name is over 8 characters
long.  Size USER field to suit.

Fixes PR bin/2459 from Neil McRae.
2000-06-25 13:41:12 +00:00
enami 4dc07f088a Pass the size of struct kinfo_proc2 instead of kinfo_proc to kvm_getproc2
so that w(1) displays what commands are running as before.
2000-06-08 02:37:28 +00:00
simonb ea74487218 Use new sysctl/kvm interfaces and remove sgid bit. 2000-05-26 03:10:31 +00:00
thorpej 06b81d67f4 Handle SONPROC state. 2000-05-26 00:42:34 +00:00
pk 9c865e3e82 No need for <machine/cpu.h> here. 1999-11-29 11:15:13 +00:00
drochner 85cbf55d16 Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.
1999-11-09 15:06:30 +00:00
mrg 45cd15f3ed recognise "dty" the same as we do "tty" 1999-10-11 11:55:27 +00:00
chs 21eedb0ec1 the PMAP_NEW option is gone as the new interface is no longer optional. 1999-09-12 01:19:23 +00:00