Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Mar 2001 11:04:43 +0000
From:      Jordan DeLong <fracture@allusion.net>
To:        freebsd-hackers@freebsd.org
Subject:   /bin/ps thing
Message-ID:  <20010316110443.A20103@cx420564-b.tucson1.az.home.com>

next in thread | raw e-mail | index | archive | help

--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

First let me state that I really don't know the proper place to be
putting this.  If this is the wrong list, I appologize, please let
me know the prefered method for submitting minor patches.  It seemed
that send-pr was just for reporting issues, not for fixing them also,
if this should've gone through send-pr....well...oops :P

this is just a fix for this:

a common way to look for pids
ps aux | grep myps

but even though stdout isn't a tty ps tries to use 79 col, and I
don't like typeing ps wwaux | grep myps.

so this patch just checks if stdout is a tty, if not it defaults to
UNLIMITED.

-Jordan

--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ps.diff"

diff -crN /usr/src/bin/ps/ps.c ps/ps.c
*** /usr/src/bin/ps/ps.c	Sat Jul  8 05:14:43 2000
--- ps/ps.c	Fri Mar 16 10:56:18 2001
***************
*** 127,139 ****
  
  	(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]);
--- 127,143 ----
  
  	(void) setlocale(LC_ALL, "");
  
! 	if (isatty(STDOUT_FILENO)) {
! 		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;
! 	} else {
! 		termwidth = UNLIMITED;
! 	}
  
  	if (argc > 1)
  		argv[1] = kludge_oldps_options(argv[1]);

--qDbXVdCdHGoSgWSk--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010316110443.A20103>