From owner-freebsd-arch@FreeBSD.ORG Thu Jul 31 09:19:01 2014 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EFDCCBF0; Thu, 31 Jul 2014 09:19:00 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1blp0190.outbound.protection.outlook.com [207.46.163.190]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DF812F95; Thu, 31 Jul 2014 09:18:59 +0000 (UTC) Received: from BLUPR05CA006.namprd05.prod.outlook.com (10.255.219.164) by BLUPR05MB722.namprd05.prod.outlook.com (10.141.207.150) with Microsoft SMTP Server (TLS) id 15.0.995.14; Thu, 31 Jul 2014 09:18:50 +0000 Received: from BN1AFFO11FD047.protection.gbl (2a01:111:f400:7c10::145) by BLUPR05CA006.outlook.office365.com (2a01:111:e400:83f::36) with Microsoft SMTP Server (TLS) id 15.0.995.14 via Frontend Transport; Thu, 31 Jul 2014 09:18:50 +0000 Received: from P-EMF02-SAC.jnpr.net (66.129.239.16) by BN1AFFO11FD047.mail.protection.outlook.com (10.58.53.62) with Microsoft SMTP Server (TLS) id 15.0.990.10 via Frontend Transport; Thu, 31 Jul 2014 09:18:50 +0000 Received: from magenta.juniper.net (172.17.27.123) by P-EMF02-SAC.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.146.0; Thu, 31 Jul 2014 02:18:48 -0700 Received: from idle.juniper.net (idleski.juniper.net [172.25.4.26]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id s6V9Iin49714; Thu, 31 Jul 2014 02:18:44 -0700 (PDT) (envelope-from phil@juniper.net) Received: from idle.juniper.net (localhost [127.0.0.1]) by idle.juniper.net (8.14.4/8.14.3) with ESMTP id s6V9IRj5092988; Thu, 31 Jul 2014 05:18:31 -0400 (EDT) (envelope-from phil@idle.juniper.net) Message-ID: <201407310918.s6V9IRj5092988@idle.juniper.net> To: "Simon J. Gerraty" Subject: Re: XML Output: libxo - provide single API to output TXT, XML, JSON and HTML In-Reply-To: <20140731034031.B2FC5580A2@chaos.jnpr.net> Date: Thu, 31 Jul 2014 05:18:27 -0400 From: Phil Shafer MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:66.129.239.16; CTRY:US; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(164054003)(189002)(199002)(69596002)(83322001)(105596002)(1941001)(44976005)(103666002)(79102001)(85306003)(83072002)(68736004)(81156004)(6806004)(87936001)(92566001)(95666004)(4396001)(76506005)(85852003)(92726001)(106466001)(46102001)(110136001)(50986999)(74502001)(81342001)(74662001)(54356999)(86362001)(102836001)(99396002)(64706001)(21056001)(77982001)(81542001)(76482001)(97736001)(48376002)(53416004)(84676001)(50466002)(20776003)(107046002)(31966008)(80022001)(47776003); DIR:OUT; SFP:; SCL:1; SRVR:BLUPR05MB722; H:P-EMF02-SAC.jnpr.net; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; MX:1; LANG:en; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 0289B6431E Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.16 as permitted sender) Authentication-Results: spf=softfail (sender IP is 66.129.239.16) smtp.mailfrom=phil@juniper.net; X-OriginatorOrg: juniper.net Cc: arch@freebsd.org, marcel@freebsd.org, Garance A Drosehn X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 09:19:01 -0000 "Simon J. Gerraty" writes: >w(1) sizes those strings based on its expectation of the width of the >tty. That can obviously be fixed/improved - but involves exposing >knowledge of the out format (or at least that it isn't TXT) to the >application. libxo allows the field description to carry two distinct format descriptors, one for text/html and one for xml/json. The latter defaults to the former: xo_emit(" {:words/%7ju/%ju}", twordct); For "w", this is does the right thing; in text mode, the command string is truncated: 5:08AM up 27 days, 12:22, 11 user%s, load averages: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE WHAT phil pts/1 76.182.32.73 05Jul14 - /usr/bin/perl /u/phil/bin/plum ( ... In XML mode, the command is not truncated. 5:09AM 27 days 12:22 11 0.00 0.00 0.00 phil pts/1 76.182.32.73 05Jul14 1 /usr/bin/perl /u/phil/bin/plum (perl5.12.4) ... (Yes, I'm likely the only plum user left in the wild.) Thanks, Phil