From 8efe967018dd79aacfe3ca1e2583f115d744e466 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 15 Sep 2003 08:33:45 +0000 Subject: Be entirely consistant when using ioctl(0, TIOCGWINSZ, &winsize) to ensure proper fallback behavior on, i.e. serial consoles. -Erik --- procps/ps.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'procps/ps.c') 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) { procps_status_t * p; int i, len; -#ifdef CONFIG_FEATURE_AUTOWIDTH - struct winsize win = { 0, 0, 0, 0 }; int terminal_width = TERMINAL_WIDTH; -#else -#define terminal_width TERMINAL_WIDTH -#endif #ifdef CONFIG_SELINUX int use_selinux = 0; @@ -58,12 +53,9 @@ extern int ps_main(int argc, char **argv) use_selinux = 1; #endif - -#ifdef CONFIG_FEATURE_AUTOWIDTH - ioctl(fileno(stdout), TIOCGWINSZ, &win); - if (win.ws_col > 0) - terminal_width = win.ws_col - 1; -#endif + get_terminal_width_height(0, &terminal_width, NULL); + /* Go one less... */ + terminal_width--; #ifdef CONFIG_SELINUX if(use_selinux) -- cgit v1.2.3