aboutsummaryrefslogtreecommitdiff
path: root/procps/ps.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-09-15 08:33:45 +0000
committerEric Andersen <andersen@codepoet.org>2003-09-15 08:33:45 +0000
commit8efe967018dd79aacfe3ca1e2583f115d744e466 (patch)
tree7590704be6cf03c87242043f5909e12eb4150356 /procps/ps.c
parentc4f72d1426e03f046ac54a00d733a4a52c3a5d4b (diff)
downloadbusybox-w32-8efe967018dd79aacfe3ca1e2583f115d744e466.tar.gz
busybox-w32-8efe967018dd79aacfe3ca1e2583f115d744e466.tar.bz2
busybox-w32-8efe967018dd79aacfe3ca1e2583f115d744e466.zip
Be entirely consistant when using ioctl(0, TIOCGWINSZ, &winsize)
to ensure proper fallback behavior on, i.e. serial consoles. -Erik
Diffstat (limited to 'procps/ps.c')
-rw-r--r--procps/ps.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/procps/ps.c b/procps/ps.c
index 9dc45d35d..b9d15b861 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -44,12 +44,7 @@ extern int ps_main(int argc, char **argv)
44{ 44{
45 procps_status_t * p; 45 procps_status_t * p;
46 int i, len; 46 int i, len;
47#ifdef CONFIG_FEATURE_AUTOWIDTH
48 struct winsize win = { 0, 0, 0, 0 };
49 int terminal_width = TERMINAL_WIDTH; 47 int terminal_width = TERMINAL_WIDTH;
50#else
51#define terminal_width TERMINAL_WIDTH
52#endif
53 48
54#ifdef CONFIG_SELINUX 49#ifdef CONFIG_SELINUX
55 int use_selinux = 0; 50 int use_selinux = 0;
@@ -58,12 +53,9 @@ extern int ps_main(int argc, char **argv)
58 use_selinux = 1; 53 use_selinux = 1;
59#endif 54#endif
60 55
61 56 get_terminal_width_height(0, &terminal_width, NULL);
62#ifdef CONFIG_FEATURE_AUTOWIDTH 57 /* Go one less... */
63 ioctl(fileno(stdout), TIOCGWINSZ, &win); 58 terminal_width--;
64 if (win.ws_col > 0)
65 terminal_width = win.ws_col - 1;
66#endif
67 59
68#ifdef CONFIG_SELINUX 60#ifdef CONFIG_SELINUX
69 if(use_selinux) 61 if(use_selinux)