Date: Fri, 7 Oct 2022 16:21:57 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 307625842b02 - main - w: don't truncate if we're writing libxo json/xml Message-ID: <202210071621.297GLvSx023155@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=307625842b02ee4c898751dbeaa16eb370bbb7f7 commit 307625842b02ee4c898751dbeaa16eb370bbb7f7 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2022-10-07 16:14:02 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2022-10-07 16:21:27 +0000 w: don't truncate if we're writing libxo json/xml 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 --- usr.bin/w/w.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 916a77920160..42874242c5ba 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -390,6 +390,9 @@ main(int argc, char *argv[]) argwidth = ttywidth - WUSED; if (argwidth < 4) argwidth = 8; + /* Don't truncate if we're outputting json or XML. */ + if (xo_get_style(NULL) != XO_STYLE_TEXT) + argwidth = ARG_MAX; for (ep = ehead; ep != NULL; ep = ep->next) { if (ep->kp == NULL) { ep->args = strdup("-");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202210071621.297GLvSx023155>