From owner-freebsd-bugs Fri Dec 28 5:30:10 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8DDFD37B419 for ; Fri, 28 Dec 2001 05:30:00 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id fBSDU0H51255; Fri, 28 Dec 2001 05:30:00 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0DFD937B416 for ; Fri, 28 Dec 2001 05:29:16 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id fBSDTGR51108; Fri, 28 Dec 2001 05:29:16 -0800 (PST) (envelope-from nobody) Message-Id: <200112281329.fBSDTGR51108@freefall.freebsd.org> Date: Fri, 28 Dec 2001 05:29:16 -0800 (PST) From: Dimitri Lommers To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/33275: ps(1) should ignore termwidth when output is not to a tty (patch) 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: 33275 >Category: bin >Synopsis: ps(1) should ignore termwidth when output is not to a tty (patch) >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: Fri Dec 28 05:30:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Dimitri Lommers >Release: 4.3-RELEASE >Organization: Hinttech Internetwork Technologies >Environment: ps.c version: $FreeBSD: src/bin/ps/ps.c,v 1.30.2.2 2001/01/23 15:08:37 asmodai Exp $ >Description: When ps(1) is called and output is not to a terminal, it should not limit the line length to the size of the terminal it was called from. This problem prevents i.e. 'ps aux | grep ' from working if the output is larger than the (x)terminal window size. >How-To-Repeat: >Fix: # diff -c ps.c.org ps.c *** ps.c.org Tue Jan 23 16:08:37 2001 --- ps.c Fri Dec 28 14:51:22 2001 *************** *** 130,142 **** (void) setlocale(LC_ALL, ""); ! if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && ! ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && ! ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&ws) == -1) || ! ws.ws_col == 0) ! termwidth = 79; else ! termwidth = ws.ws_col - 1; if (argc > 1) argv[1] = kludge_oldps_options(argv[1]); --- 130,141 ---- (void) setlocale(LC_ALL, ""); ! if (isatty(STDOUT_FILENO)) ! if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1) || ! ws.ws_col == 0) termwidth = 79; ! else termwidth = ws.ws_col - 1; else ! termwidth = UNLIMITED; if (argc > 1) argv[1] = kludge_oldps_options(argv[1]); *************** *** 266,275 **** dropgid = 1; break; case 'w': ! if (wflag) ! termwidth = UNLIMITED; ! else if (termwidth < 131) ! termwidth = 131; wflag++; break; case 'x': --- 265,275 ---- dropgid = 1; break; case 'w': ! if (termwidth != UNLIMITED) ! if (wflag) ! termwidth = UNLIMITED; ! else if (termwidth < 131) ! termwidth = 131; wflag++; break; case 'x': --- UUENCODED PATCH: --- begin 644 patch M*BHJ('!S+F,N;W)G"51U92!*86X@,C,@,38Z,#@Z,S<@,C`P,0HM+2T@<',N M8PE&Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message