summaryrefslogtreecommitdiffstats
path: root/patches/procps-3.2.7/generic/30_w-columns.dpatch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/procps-3.2.7/generic/30_w-columns.dpatch')
-rw-r--r--patches/procps-3.2.7/generic/30_w-columns.dpatch34
1 files changed, 34 insertions, 0 deletions
diff --git a/patches/procps-3.2.7/generic/30_w-columns.dpatch b/patches/procps-3.2.7/generic/30_w-columns.dpatch
new file mode 100644
index 000000000..57c94aeda
--- /dev/null
+++ b/patches/procps-3.2.7/generic/30_w-columns.dpatch
@@ -0,0 +1,34 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 30_w-columns.dpatch by <csmall@localhost.localdomain>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: use COLUMNS environment if TIOCGWINSZ fails
+
+@DPATCH@
+diff -urNad --exclude=CVS --exclude=.svn ./w.c /tmp/dpep-work.0retPU/procps-3.2.6/w.c
+--- ./w.c 2005-10-31 12:41:33.000000000 +1100
++++ /tmp/dpep-work.0retPU/procps-3.2.6/w.c 2005-10-31 12:41:55.000000000 +1100
+@@ -231,10 +231,10 @@
+
+ /***** main */
+ int main(int argc, char **argv) {
+- char *user = NULL;
++ char *user = NULL, *p;
+ utmp_t *u;
+ struct winsize win;
+- int header=1, longform=1, from=1, args, maxcmd=80, ch;
++ int header=1, longform=1, from=1, args, maxcmd, ch;
+
+ #ifndef W_SHOWFROM
+ from = 0;
+@@ -267,6 +267,10 @@
+
+ if (ioctl(1, TIOCGWINSZ, &win) != -1 && win.ws_col > 0)
+ maxcmd = win.ws_col;
++ else if (p = getenv("COLUMNS"))
++ maxcmd = atoi(p);
++ else
++ maxcmd = 80;
+ if (maxcmd < 71) {
+ fprintf(stderr, "%d column window is too narrow\n", maxcmd);
+ exit(1);