From nobody Fri Oct 07 16:21:57 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MkYVF2yQzz4f4MS; Fri, 7 Oct 2022 16:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MkYVF2Xxyz3BnJ; Fri, 7 Oct 2022 16:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665159717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oAa8bss+woIiClQHYOCxHKCZllnUUCPm9XxDn+xJgNY=; b=iM4nauqLGPF7GSYBklsQgF4qD1FdOGUzQ2hLjOXZXXEjR+6ahdG0cvJsLDBXx6Hwj1be2r mQ/qe+QF7y1SdBRanovUrCFggB5KKMgfAXnNe7YdjEDPSESu/LeQH2aeKNz0D4pZUs5G1U XoxnLxx7ZfVp0XFfKp1S/eO+rUUBE2aVyDZrKoHEVbUDJs9tP6bg2a7k26AhJCF++erj60 JGnnmCVXvOfxela9cDrH7HeWD1prBk6B3LD6PjJgmnVFEh8WPb2fuAGkqrBiLSmGkRFggH DQIZNY2lMZ0pHpYkdIuhCajngM0I3NHUDTdLL9PCUCDSwsu7ehFq5/Gw+wAzhw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MkYVF1bGlzfdY; Fri, 7 Oct 2022 16:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 297GLvWP023156; Fri, 7 Oct 2022 16:21:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 297GLvSx023155; Fri, 7 Oct 2022 16:21:57 GMT (envelope-from git) Date: Fri, 7 Oct 2022 16:21:57 GMT Message-Id: <202210071621.297GLvSx023155@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 307625842b02 - main - w: don't truncate if we're writing libxo json/xml List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 307625842b02ee4c898751dbeaa16eb370bbb7f7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665159717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oAa8bss+woIiClQHYOCxHKCZllnUUCPm9XxDn+xJgNY=; b=xWB4RINKe9C/crTTFs0nmGfPjL38MFnheA9oyQ1RQZSftlEhZ2bKkZIE73aafELdvWuG9T GXA20u1ARNmSaFFn655eovjtEGf6rV30HDuisv6J2Upl/YSCalYDYEz6ctrIwZUeNKI/zv 2oeFuPT/dV1tnUQMA2p6KVbrMIyZVpt32khG6vBSYGPW2Bc3e0OtYeR7eFopn7D6S/wewW xLtGWUGPhmrUC9GJEnIQ00ZzNCDbIZ9GTAXEKh27lJjqV9q0NaZxHxPOFUlxaPpgrx+/Ku Nd7JyBYFXEYHkVImLzDRzRs1/Y784OB1KFI1rw++CJjFRzEUJp8vNxnubiOfaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665159717; a=rsa-sha256; cv=none; b=tXSQNC/etRGsUdJ0yX/dJJg0d/fc5Z2WD2TqbmXXFsAeg3Rx2o6MEcovoOfXSI7+G6O7bQ Prp6c7GmsHrPl/46WWFdIpkBjvmI6KgkHRNuJ3FMXxnaxmlj9yvDEln86QLB0g9fj00w28 vrM823YKE9taQDAj3Wn+nUqn7wAZBO72HI4X6H6YutAlpdEsYidTbYhydZgRHqM98+og+u LUPMajnnUKsNT7CHO9SGchCamJd27EMo54X1QCoROhd0JWXAv6lzejbXkez4ocIss1CDCA ney01Y40eNsn/FSesjEH8tnXE8IWe4639O+0mf/JOz2XCyikuqAgCV0PySj/WQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=307625842b02ee4c898751dbeaa16eb370bbb7f7 commit 307625842b02ee4c898751dbeaa16eb370bbb7f7 Author: Kristof Provost AuthorDate: 2022-10-07 16:14:02 +0000 Commit: Kristof Provost 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("-");