Page MenuHomeFreeBSD

D14614.id.diff
No OneTemporary

D14614.id.diff

Index: head/bin/ps/ps.1
===================================================================
--- head/bin/ps/ps.1
+++ head/bin/ps/ps.1
@@ -101,6 +101,14 @@
controlling terminal, state, CPU time (including both user and system time)
and associated command.
.Pp
+If the
+.Nm
+process is associated with a terminal, the default output width is that of the
+terminal; otherwise the output width is unlimited.
+See also the
+.Fl w
+option.
+.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl -libxo
@@ -257,13 +265,15 @@
.Fl m
option.
.It Fl w
-Use 132 columns to display information, instead of the default which
-is your window size.
+Use at least 132 columns to display information, instead of the default which
+is the window size if
+.Nm
+is associated with a terminal.
If the
.Fl w
option is specified more than once,
.Nm
-will use as many columns as necessary without regard for your window size.
+will use as many columns as necessary without regard for the window size.
Note that this option has no effect if the
.Dq command
column is not the last column displayed.
Index: head/bin/ps/ps.c
===================================================================
--- head/bin/ps/ps.c
+++ head/bin/ps/ps.c
@@ -202,6 +202,11 @@
* any of stdout, stderr, or stdin is a terminal. The intent
* is that "ps", "ps | more", and "ps | grep" all use the same
* default line length unless -w is specified.
+ *
+ * If not interactive, the default length was traditionally 79.
+ * It has been changed to unlimited. This is mostly for the
+ * benefit of non-interactive scripts, which arguably should
+ * use -ww, but is compatible with Linux.
*/
if ((cols = getenv("COLUMNS")) != NULL && *cols != '\0')
termwidth = atoi(cols);
@@ -209,7 +214,7 @@
ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&
ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&ws) == -1) ||
ws.ws_col == 0)
- termwidth = 79;
+ termwidth = UNLIMITED;
else
termwidth = ws.ws_col - 1;

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 7, 10:59 AM (1 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31005472
Default Alt Text
D14614.id.diff (1 KB)

Event Timeline