procps/procps-3.2.8-columns.dif

67 lines
1.8 KiB
Plaintext

--- ps/global.c
+++ ps/global.c 2009-11-17 16:59:38.279430039 +0000
@@ -139,8 +139,12 @@ static void set_screen_size(void){
screen_cols = ws.ws_col; // hmmm, NetBSD subtracts 1
screen_rows = ws.ws_row;
- // TODO: delete this line
- if(!isatty(STDOUT_FILENO)) screen_cols = OUTBUF_SIZE;
+ // override COLUMNS setting if not a tty
+ if(!isatty(STDOUT_FILENO)){
+ screen_cols = OUTBUF_SIZE;
+ screen_rows = OUTBUF_SIZE;
+ if (personality&PER_UNIX_COLS) return; // SysV/UNIX98 based personality
+ }
columns = getenv("COLUMNS");
if(columns && *columns){
@@ -286,6 +290,7 @@ static const char *set_personality(void)
return NULL;
case_aix:
+ personality |= PER_UNIX_COLS;
bsd_j_format = "FB_j";
bsd_l_format = "FB_l";
/* bsd_s_format not used */
@@ -313,6 +318,7 @@ static const char *set_personality(void)
case_sunos4:
personality = PER_NO_DEFAULT_g;
+ personality |= PER_UNIX_COLS;
prefer_bsd_defaults = 1;
bsd_j_format = "FB_j";
bsd_l_format = "FB_l";
@@ -337,12 +343,14 @@ static const char *set_personality(void)
case_hp:
case_hpux:
personality = PER_BROKEN_o | PER_HPUX_x;
+ personality |= PER_UNIX_COLS;
return NULL;
case_svr4:
case_sysv:
case_sco:
personality = PER_BROKEN_o | PER_SVR4_x;
+ personality |= PER_UNIX_COLS;
return NULL;
case_posix:
@@ -351,6 +359,7 @@ static const char *set_personality(void)
case_unix98:
case_unix:
personality = PER_BROKEN_o;
+ personality |= PER_UNIX_COLS;
return NULL;
}
@@ -361,8 +370,8 @@ void reset_global(void){
double uptime_secs;
reset_selection_list();
look_up_our_self(&p);
- set_screen_size();
set_personality();
+ set_screen_size();
all_processes = 0;
bsd_c_option = 0;