On Sat, 4 Mar 2017, Conrad Meyer wrote:
On Sat, Mar 4, 2017 at 6:50 PM, Bruce Evans <b...@optusnet.com.au> wrote:
Author: cem
Date: Sat Mar 4 22:38:10 2017
New Revision: 314685
URL: https://svnweb.freebsd.org/changeset/base/314685
Log:
ps(1): Only detect terminal width if stdout is a tty
If stdout isn't a tty, use unlimited width output rather than truncating
to
79 characters. This is helpful for shell scripts or e.g., 'ps | grep
foo'.
This breaks many interactive uses, e.g., 'ps l | less', to work around a
user error.
Can you illustrate what breaks here? less(1) doesn't wrap lines and
instead supports side-to-side scrolling with left/right arrow keys.
less does wrap long lines.
However, it has an option -S to cause long lines to be chopped. Also,
if you use side-to-side scrolling then it switches to -S mode except
at the leftmost column. Thus, less acts like you say if started with
-S. If not started with -S, it makes a mess of the leftmost screen.
Other display utilities might not have the sideways scrolling. I normally
use an old version of less that doesn't have it, and sometimes vi to just
read things. It does have -S. vi doesn't have it or even truncation
AFAIK. I often use the display method of dropping large output into the
terminal's history buffer and scrolling back using the terminal's scroll
keys. This works better than less for many purposes. It doesn't do
sideways scrolling. With syscons, some of the history survives a frame
buffer geometry change but the history is raw so line breaks cannot be
recovered, and the current screen is cleared together with its history
instead of redrawn. With xterm, there is no bogus clearing but the
line breaks are not recovered.
Another broken use is ps l | grep where the output is sent to the screen.
It is now wide, so hard to read without piping it further through a
viewer with sideways scrolling.
Sideways scrolling is not too bad for tabular formats like ps's where you
often want to look at 1 column at a time, but I don't like it for
general use and prefer truncation. less in an xterm can be resized with
recoverable line breaks but I rarely use X.
Truncation by the viewer is not as good as truncation by the producer.
ps should expand leading field widths so as to truncates leading fields
less if the output is wide. This would move important later fields into
the truncated region if the viewer truncates.
The user should get basically the same output with 'ps l | less' as
with 'ps l', aside from ability to scroll up/down and left/right.
This takes a nonstandard version of less (perhaps an alias). So
some users would notice this change more than others. It is interesting
that ps -ww doesn't work as an alias for ps for users who are used to
typing ps args without a '-'. ps -ww -l works, but ps -ww l is a syntax
error.
Bruce
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"