aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-10-09 19:47:01 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-09 19:47:01 +0200
commita05b2b856bf095dfd5f575c106d1a9e5ac6edd3c (patch)
treea98223832e6a794f5b54e9b2f8793f28f78c6721 /procps
parentdea478855f8de7fe0974f5cbb5fa3f5968c46302 (diff)
downloadbusybox-a05b2b856bf095dfd5f575c106d1a9e5ac6edd3c.tar.gz
ps: show longer COMMAND
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r--procps/ps.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/procps/ps.c b/procps/ps.c
index d86ac6d2f..e94004541 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -303,7 +303,7 @@ static const ps_out_t out_spec[] = {
{ 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID },
{ 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID },
{ 16 , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM },
- { 256 , "args" ,"COMMAND",func_args ,PSSCAN_COMM },
+ { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM },
{ 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID },
{ 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID },
{ 5 , "pgid" ,"PGID" ,func_pgid ,PSSCAN_PGID },
@@ -383,7 +383,7 @@ static void parse_o(char* opt)
print_header = 1;
}
-static void post_process(void)
+static void alloc_line_buffer(void)
{
int i;
int width = 0;
@@ -393,6 +393,12 @@ static void post_process(void)
print_header = 1;
}
width += out[i].width + 1; /* "FIELD " */
+ if ((int)(width - terminal_width) > 0) {
+ /* The rest does not fit on the screen */
+ //out[i].width -= (width - terminal_width - 1);
+ out_cnt = i + 1;
+ break;
+ }
}
#if ENABLE_SELINUX
if (!is_selinux_enabled())
@@ -497,7 +503,6 @@ int ps_main(int argc UNUSED_PARAM, char **argv)
}
parse_o(default_o);
}
- post_process();
#if ENABLE_FEATURE_SHOW_THREADS
if (opt & OPT_T)
need_flags |= PSSCAN_TASKS;
@@ -511,6 +516,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv)
if (--terminal_width > MAX_WIDTH)
terminal_width = MAX_WIDTH;
}
+ alloc_line_buffer();
format_header();
p = NULL;