procps/procps-v3.3.3-columns.dif

62 lines
1.6 KiB
Plaintext

---
ps/global.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- ps/global.c
+++ ps/global.c 2016-07-11 13:04:59.600533764 +0000
@@ -147,8 +147,11 @@ 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;
+ 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){
@@ -290,6 +293,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 */
@@ -317,6 +321,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";
@@ -342,12 +347,14 @@ static const char *set_personality(void)
case_hp:
case_hpux:
personality = PER_HPUX_x;
+ personality |= PER_UNIX_COLS;
return NULL;
case_svr4:
case_sysv:
case_sco:
personality = PER_SVR4_x;
+ personality |= PER_UNIX_COLS;
return NULL;
case_posix:
@@ -365,8 +372,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;