Date: Fri, 17 Aug 2001 17:57:04 -0700 From: "Crist J. Clark" <cristjc@earthlink.net> To: Kevin Oberman <oberman@es.net> Cc: parv <parv_@yahoo.com>, cjclark@alum.mit.edu, f-q <freebsd-questions@FreeBSD.ORG> Subject: Re: ps & terminal width sensitivity inside a script Message-ID: <20010817175704.D306@blossom.cjclark.org> In-Reply-To: <200108172113.f7HLDuR30581@ptavv.es.net>; from oberman@es.net on Fri, Aug 17, 2001 at 02:13:55PM -0700 References: <20010817020514.B25092@moo.holy.cow> <200108172113.f7HLDuR30581@ptavv.es.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 17, 2001 at 02:13:55PM -0700, Kevin Oberman wrote: > > Date: Fri, 17 Aug 2001 02:05:14 -0400 > > From: parv <parv_@yahoo.com> > > Sender: owner-freebsd-questions@FreeBSD.ORG > > > > this was, on the fateful occasion around Aug 16 21:59 -0400, > > sent by Crist J. Clark > > > > > > On Thu, Aug 16, 2001 at 07:26:05PM -0400, parv wrote: > > > > why is ps sensitive to terminal width even when used inside a shell > > > > script? > > > > > > Just 'cause. > > > > what a dissapointment! i was expecting little more resonable > > reasons(s). > > OK. Here is something more reasonable (but just a bit). > > ps(1) is a very old utility dating at least back to the earliest days of > Unix. (It might even date to Multics, but I can't say for sure.) Back > in the days of Teletypes and big honkin' printers. Back in the days > when teletypes were 80 characters wide and line printers 132 > characters wide. Back in the days when there was nothing else. > > There was no termcap or terminfo. There were no windows or even > CRTs. Since everything was one or the other, ps(1) was written with > three options, default, w, and ww at 80, 132, and unlimited width, > respectively. Since LOTS of people wrote aliases and shell scripts that > were linked to this hard-coded behavior, the very idea of changing it > was met by screams of protest, so that's where we still are. Nit pick. The existing ps(1) definately does understand terminal width. The actual options are, - default: Get the width of the terminal and use the terminal width - 1. If we cannot get the terminal width, fall back to 80 - 1 columns. - w: Force lines to 132 - 1 characters. - ww: Unlimited line length. For our original poster, the ps(1) command does an ioctl(2) call on stdin, stderr, and stdin to find the terminal width. Thus, ps(1) should be able to find out your terminal width whenever those are attached to your terminal. -- Crist J. Clark cjclark@alum.mit.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010817175704.D306>