aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/w
Commit message (Collapse)AuthorAgeFilesLines
* w: Trim whitespace and commas from time and uptimeDag-Erling Smørgrav2025-10-231-8/+25
| | | | | | | | | | | When producing formatted output, trim leading whitespace and trailing commas from the human-readable time and uptime before emitting them. The text output remains unchanged. PR: 290089 Fixes: 6e6febb54da9 ("w: Fix idle time in json output, add login/idle times to json output") Reviewed by: marius.h_lden.org Differential Revision: https://reviews.freebsd.org/D53167
* uptime: Mention libxo support in manual pageDag-Erling Smørgrav2025-09-112-4/+18
| | | | | | | MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D52489
* w: Fix idle time in json output, add login/idle times to json outputMarius Halden2025-08-291-7/+19
| | | | | | | | | | | | | | | | | | Currently the idle time will show as `true` part of the time in the json output and quoting depends on what is being printed. Make sure it's always printed correctly and for consistency treated as a string in the json output. Login time delta and since times are currently exposed in the xml output, expose these times in the json output as well. In the json and xml outputs expose the number of seconds idle as a new field or attribute respectively. MFC after: 1 week Sponsored by: Modirum MDPay Event: Oslo Hackathon 202508 Differential Revision: https://reviews.freebsd.org/D52237
* manpages: prefer linking to xo_options.7 over xo_parse_args.3Alan Somers2025-07-161-3/+3
| | | | | | | | | | | | | | | Most libxo-enabled utilities link to xo_parse_args.3. But that man page doesn't actually describe how to format command-line arguments. Rather, xo_options.7 does. I suspect that these utilities link to the former because the latter man page did not exist until libxo-0.7.2 (8a6eceff3ce). And newer utilities have probably been copy/pasting the same text from older ones. But the superior man page does exist now, so we should link to it instead. MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D51354
* w(1): fix libxo output being locale dependantBaptiste Daroussin2024-10-141-3/+5
| | | | | | | | | | | | | by being locale dependant the json export is invalid in locales where the separator for float is a comma. The Json and the XML are invalid for login-time when days contains contains characters which are not unicode. Forcing locale to be C, makes this json and xml output valid and also identical accross locales, so reliable for parsers PR: 276304 Reported by: Vedran Miletic <vedran@miletic.net>
* w: Add version information to libxo outputBram2024-09-061-0/+3
| | | | | | | | Add version information to libxo output so that libxo content consumers can track changes. Reviewed by: imp, markj Pull Request: https://github.com/freebsd/freebsd-src/pull/1350
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* usr.bin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-4/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-8/+0
| | | | | | | | | | | We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require). Sponsored by: Netflix
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-277-16/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .c patternWarner Losh2023-08-162-6/+0
| | | | Remove /^#include\s+<sys/cdefs.h>.*$\n\s+__FBSDID\("\$FreeBSD\$"\);\n/
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-3/+1
|
* w: Unlike err(3), xo_err(3) won't accept a null format string.Dag-Erling Smørgrav2023-01-251-1/+1
| | | | | | | | MFC after: 1 week X-MFC-with: d90ff31ae5cd Sponsored by: Klara, Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D38192
* w: Complete libxo transition.Dag-Erling Smørgrav2023-01-251-8/+9
| | | | | | | MFC after: 1 week Sponsred by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D38172
* w: Fix premature rounding.Dag-Erling Smørgrav2022-10-261-25/+34
| | | | | | | | | | | | | | If the system has been up more longer than a minute, we add 30 seconds to the uptime so that subsequent calculations will round to the nearest minute rather than truncate. However, since the introduction of libxo, we output the raw value after performing the adjustment. Rewrite so that we output the raw value first, then perform the adjustment and recalculate before outputting the humanized value. While there, reduce stack usage and avoid needless allocations. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37128
* w: cosmetic fixes.Dag-Erling Smørgrav2022-10-212-27/+26
| | | | Sponsored by: Klara, Inc.
* w: don't truncate if we're writing libxo json/xmlKristof Provost2022-10-071-0/+3
| | | | | | | | | | | | | If we're writing structured output (i.e. json or xml) we shouldn't worry about terminal width, and instead always output full width information. This means that, for example, if we're called from crontab with 'w --libxo json' we'll provide full the command field rather than pointlessly truncating it. Suggested by: Phil Shafer Event: Aberdeen Hackathon 2022 Differential Revision: https://reviews.freebsd.org/D25013
* w(1): Add EXAMPLES to man pageFernando Apesteguía2020-08-241-4/+37
| | | | | | | | | | Add small example section showing general use and -d and -h flags Approved by: manpages (bcr@) Differential Revision: https://reviews.freebsd.org/D26172 Notes: svn path=/head/; revision=364719
* uptime(1): Add EXAMPLES sectionFernando Apesteguía2020-08-181-1/+6
| | | | | | | | | | Add a simple example Approved by: manpages (bcr@) Differential Revision: https://reviews.freebsd.org/D26063 Notes: svn path=/head/; revision=364350
* w: use locale-based string format specifiersYuri Pankov2020-06-211-3/+3
| | | | | | | | | | | Use locale-based string format specifiers when printing the process names/arguments. Reviewed by: pstef Differential Revision: https://reviews.freebsd.org/D25174 Notes: svn path=/head/; revision=362464
* Fix address annotation in xml output from wMike Karels2019-08-291-3/+5
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=351592
* w: initialize save_p to silence 'may be used uninitilized'Bjoern A. Zeeb2019-08-221-0/+1
| | | | | | | | | | | | 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) Notes: svn path=/head/; revision=351385
* Change w(1) to compute FROM (host) field size dynamicallyMike Karels2019-08-221-65/+80
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=351379
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-204-0/+8
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Fix singular/plural "users" output.Alexander Motin2017-07-271-1/+1
| | | | | | | | | | | It was broken during libxo'fication. PR: 221039 Submitted by: timur@ MFC after: 1 week Notes: svn path=/head/; revision=321620
* Adopt SRCTOP in usr.binWarner Losh2017-03-121-1/+1
| | | | | | | | | | | | 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) Notes: svn path=/head/; revision=315170
* Use nitems() from sys/param.h.Marcelo Araujo2017-03-101-2/+2
| | | | | | | | | Reviewed by: ume MFC after: 3 weeks. Differential Revision: https://reviews.freebsd.org/D9938 Notes: svn path=/head/; revision=314988
* Renumber copyright clause 4Warner Losh2017-02-286-6/+6
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=314436
* When -n is specified, don't make bogus DNS queries. Instead,Hajimu UMEMOTO2016-09-022-3/+7
| | | | | | | | | | when -n is specified more than once, hostnames stored in utmp are attempted to resolve to display them as network addresses. PR: 212272 Notes: svn path=/head/; revision=305289
* Add more text to explain --libxo flag.Craig Rodrigues2015-12-011-1/+8
| | | | Notes: svn path=/head/; revision=291607
* Update dependencies after r291406 added libelf to libkvm.Bryan Drewery2015-12-011-0/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=291558
* w(1) is not setgid binary since r53279, so remove the setgid() call.Xin LI2015-09-092-13/+1
| | | | | | | | | Reviewed By: wollman MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D3541 Notes: svn path=/head/; revision=287590
* Upgrade libxo to 0.4.5.Marcel Moolenaar2015-08-241-1/+1
| | | | | | | | | | Local changes incorporated by 0.4.5: r284340 Local changes retained: r276260, r282117 Obtained from: https://github.com/Juniper/libxo Notes: svn path=/head/; revision=287111
* Widen the host field so that a full IPv6 address will be seen.Mark Murray2015-07-141-1/+1
| | | | Notes: svn path=/head/; revision=285550
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-273-10/+23
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Updated/new dependenciesSimon J. Gerraty2014-11-191-0/+1
| | | | | | | | Notes: svn path=/projects/bmake/; revision=274694
| * Merge from head@274682Simon J. Gerraty2014-11-194-55/+89
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=274683
| * | Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * | Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | Sync with HEAD.David E. O'Brien2013-02-083-10/+9
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246555
| * \ \ Sync from headSimon J. Gerraty2012-11-042-2/+2
| |\ \ \ | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=242545