From owner-freebsd-bugs Thu Sep 26 5:50: 5 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1C36A37B401 for ; Thu, 26 Sep 2002 05:50:03 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 55CC043E77 for ; Thu, 26 Sep 2002 05:50:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8QCo2Co028277 for ; Thu, 26 Sep 2002 05:50:02 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8QCo2LB028276; Thu, 26 Sep 2002 05:50:02 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BFE4937B401 for ; Thu, 26 Sep 2002 05:47:28 -0700 (PDT) Received: from mail.kerna.ie (ns.kerna.ie [194.106.143.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD29543E6A for ; Thu, 26 Sep 2002 05:47:19 -0700 (PDT) (envelope-from james@now.ie) Received: from ram.kerna.ie (ram.kerna.ie [194.106.143.99]) by mail.kerna.ie (8.9.3/8.9.3) with ESMTP id NAA10146 for ; Thu, 26 Sep 2002 13:47:18 +0100 (BST) Received: from bender.kerna.ie (68mj4dtyfga35nel@bender.kerna.ie [192.168.42.133]) by ram.kerna.ie (8.9.3/8.9.3) with ESMTP id NAA00746 for ; Thu, 26 Sep 2002 13:47:15 +0100 Received: (from james@localhost) by bender.kerna.ie (8.11.6/8.11.6) id g8QClAG71375; Thu, 26 Sep 2002 13:47:10 +0100 (IST) (envelope-from james@now.ie) Message-Id: <200209261247.g8QClAG71375@bender.kerna.ie> Date: Thu, 26 Sep 2002 13:47:10 +0100 (IST) From: James Raftery Reply-To: James Raftery To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/43389: [PATCH] ps(1) prints blank line if no headers specified Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 43389 >Category: bin >Synopsis: [PATCH] ps(1) prints blank line if no headers specified >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Sep 26 05:50:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: James Raftery >Release: FreeBSD 4.5-RELEASE-p18 i386 >Organization: >Environment: System: FreeBSD bender.kerna.ie 4.5-RELEASE-p18 FreeBSD 4.5-RELEASE-p18 #2: Wed Aug 7 10:16:16 IST 2002 root@bender.kerna.ie:/usr/obj/usr/src/sys/BENDER i386 >Description: ps(1) prints a blank line when no column headers are specified. >How-To-Repeat: With headers: ocelot:lecter$ ps -o pid=p -o cpu=c -p 1 p c 1 0 ocelot:lecter$ Without headers: ocelot:lecter$ ps -o pid= -o cpu= -p 1 1 0 ocelot:lecter$ >Fix: Patch below which scans the header list and stops printheader() if there are no headers to print. # # Verified to apply to: # /usr/src/bin/ps/print.c revisions 1.36.2.2 and 1.36.2.3 # # This patch stops ps(1) from printing a blank line when no/empty # headers are specified. Apply the patch, then 'make all install' in # /usr/src/bin/ps. # # James Raftery # --- print.c.orig Thu Sep 26 11:35:36 2002 +++ print.c Thu Sep 26 12:56:42 2002 @@ -67,6 +67,16 @@ { VAR *v; struct varent *vent; + int i; + + for (vent = vhead; vent; vent = vent->next) { + v = vent->var; + if (strlen(v->header) > 0) + i = 1; + } + + if (i != 1) + return; for (vent = vhead; vent; vent = vent->next) { v = vent->var; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message