Commit Graph

151 Commits

Author SHA1 Message Date
Yuri Pankov
2d3725d62a w: use locale-based string format specifiers
Use locale-based string format specifiers when printing
the process names/arguments.

Reviewed by:	pstef
Differential Revision:	https://reviews.freebsd.org/D25174
2020-06-21 11:42:49 +00:00
Mike Karels
ae3353515b Fix address annotation in xml output from w
The libxo xml feature of adding an annotation with the "original"
address from the utmpx file if it is different than the final "from"
field was broken by r351379. This was pointed out by the gcc error
that save_p might be used uninitialized. Save the original address
as needed in each entry, don't just use the last one from the previous
loop.

Reviewed by:	marcel@
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21390
2019-08-29 02:44:18 +00:00
Bjoern A. Zeeb
fada51254f w: initialize save_p to silence 'may be used uninitilized'
After r351379 save_p may be used uninitialized.  Set it to NULL before
first assignment so that a later NULL check will work correctly.

Reported by:		CI system for gcc platforms
MFC after:		1 week
X-MFC with:		351379 (karels)
2019-08-22 07:52:06 +00:00
Mike Karels
ec9801de1e Change w(1) to compute FROM (host) field size dynamically
It's nice to be able to display a full IPv6 host address if
needed, but it's also nice to display more than 3 characters of a command
line. Compute the needed size for the FROM column in an earlier pass,
and determine the maximum, then print what fits for the command.

Reviewed by:	marcel@ (markm@ previous revision)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21211
2019-08-22 03:28:31 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Alexander Motin
ba86ca7c84 Fix singular/plural "users" output.
It was broken during libxo'fication.

PR:		221039
Submitted by:	timur@
MFC after:	1 week
2017-07-27 14:34:57 +00:00
Warner Losh
a35f04fba2 Adopt SRCTOP in usr.bin
Prefer ${SRCTOP}/foo over ${.CURDIR}/../../foo and ${SRCTOP}/usr.bin/foo
over ${.CURDIR}/../foo for paths in Makefiles.

Differential Revision:	https://reviews.freebsd.org/D9932
Sponsored by:		Netflix
Silence on:		arch@ (twice)
2017-03-12 18:58:44 +00:00
Marcelo Araujo
807bd0d9f0 Use nitems() from sys/param.h.
Reviewed by:	ume
MFC after:	3 weeks.
Differential Revision:	https://reviews.freebsd.org/D9938
2017-03-10 04:30:31 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Hajimu UMEMOTO
2279a9a428 When -n is specified, don't make bogus DNS queries. Instead,
when -n is specified more than once, hostnames stored in utmp
are attempted to resolve to display them as network addresses.

PR:		212272
2016-09-02 18:28:14 +00:00
Craig Rodrigues
06691045ba Add more text to explain --libxo flag. 2015-12-01 19:18:53 +00:00
Bryan Drewery
cf990407e1 Update dependencies after r291406 added libelf to libkvm.
Unfortunately filemon/meta mode tracks all indirect dependencies here
since ld(1) is reading libelf when linking in libkvm.  Churn would be
reduced if this was able to be limited to direct dependencies.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:18:48 +00:00
Xin LI
ab9cee11d6 w(1) is not setgid binary since r53279, so remove the setgid() call.
Reviewed By:	wollman
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D3541
2015-09-09 05:17:04 +00:00
Marcel Moolenaar
d1a0d267b7 Upgrade libxo to 0.4.5.
Local changes incorporated by 0.4.5: r284340
Local changes retained: r276260, r282117

Obtained from:	https://github.com/Juniper/libxo
2015-08-24 16:26:20 +00:00
Mark Murray
339ce033d2 Widen the host field so that a full IPv6 address will be seen. 2015-07-14 18:53:24 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Allan Jude
630a02daae Fix libxo output from uptime command
the libxo output for uptime returned multiple 'uptime' keys, one each for number of days, hours, and minutes of uptime.
This is invalid JSON.
This patch makes the output the raw number of seconds, as well as adding keys for the individual unit values
A string of the original output from the plain-text uptime command is also added

Differential Revision:	https://reviews.freebsd.org/D2063
Reviewed by:	jmg
Approved by:	marcel
Sponsored by:	ScaleEngine Inc.
2015-04-16 22:09:37 +00:00
Mark Johnston
10b92369a1 Call xo_finish(3) before exiting in usage(). 2015-03-09 03:31:26 +00:00
Michael Gmelin
441ee032a3 Add xo_finish() to w.c in case it's invoked as uptime
Reviewed by:	marcel
Approved by:	marcel
Differential Revision: https://reviews.freebsd.org/D1821
2015-02-10 22:23:52 +00:00
Baptiste Daroussin
3e11bd9e2a Convert to usr.bin/ to LIBADD
Reduce overlinking
2014-11-25 14:29:10 +00:00
Simon J. Gerraty
488c975a1f Updated/new dependencies 2014-11-19 07:10:38 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Marcel Moolenaar
bab0558297 Fix text output for the uptime command.
Reported by: "Max N. Boyarov" <zotrix@bsd.by>, ae@
2014-11-11 21:52:10 +00:00
Marcel Moolenaar
a01ced3391 Sort the references in "SEE ALSO" by section first; then alphabetically.
Pointed out by: brueffer@
2014-11-06 16:17:41 +00:00
Marcel Moolenaar
d6112c71c6 Document that w(1) supports libxo(3). 2014-11-05 23:59:52 +00:00
Marcel Moolenaar
76c0abf129 Convert to use libxo.
Obtained from:  Phil Shafer <phil@juniper.net>
Sponsored by:   Juniper Networks, Inc.
2014-11-05 23:54:33 +00:00
Eitan Adler
920aa23dad don't reinvent the wheel: rely on basename(3)
Reviewed by:	nwhitehorn
2014-10-08 05:04:31 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Andriy Gapon
a29cc9a34b Revert r253748,253749
This WIP should not have been committed yet.

Pointyhat to:	avg
2013-07-28 18:44:17 +00:00
Andriy Gapon
c722ec3a51 remove needless inclusion of machine/cpu.h in userland
MFC after:	21 days
2013-07-28 18:35:43 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
John Baldwin
9f0b6e5e27 - Move 'showthreads' check out of fmt.c.
- Update shadow copy of fmt_argv() prototype in w.c and fix calls for
  additional parameter.
2013-01-19 00:21:55 +00:00
Xin LI
c3a1bb32f4 Set showthread = 0 for w(1).
X-MFC:	together with r245610
2013-01-18 23:54:27 +00:00
Ed Schouten
dbd1414ddc Fix whitespace.
MFC after:	1 week
2012-11-17 16:47:05 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Ed Maste
b6eec535d3 Use CLOCK_UPTIME to get the uptime. 2012-10-12 15:03:28 +00:00
Eitan Adler
eae8be706e Bump date missed in r202756
PR:		docs/171624
Submitted by:	bdrewery
Approved by:	gabor
MFC after:	3 days
2012-09-14 17:50:42 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Ed Schouten
d11cba9c89 Add missing static keywords to w(1) 2011-11-06 08:18:47 +00:00
Ed Schouten
21632754d6 Only print entries for which ut_host points to a character device.
Now that we use utmpx, we more often have entries for which the ut_line
is left blank. To prevent us from returning struct stat for "/dev/",
check that the resulting stat structure belongs to a character device.
2011-07-05 14:12:48 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Rebecca Cran
c08dcaf147 Initialize the execfile argument to NULL instead of _PATH_DEVNULL. This allows the -M option to be used without specifying -N.
PR:	bin/138146
Approved by:	rrs (mentor)
MFC after:	3 days
2010-02-08 21:23:48 +00:00
Ed Schouten
0806dd9238 Remove stale references to utmp(5) and its corresponding filenames.
I removed utmp and its manpage, but not other manpages referring to it.
2010-01-21 17:25:12 +00:00
Ed Schouten
1131779fb3 Port w(1) to utmpx.
Let it print "-" when the TTY string is empty. In this case, it must
also make sure it doesn't match processes who also have no controlling
TTY. Otherwise it will print random kernel processes when trying to pick
the best matching process.

Eventually it should look at the value of ut_pid as well.
2010-01-13 18:09:21 +00:00