aboutsummaryrefslogtreecommitdiff
path: root/procps/top.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-09-13 22:48:30 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-09-13 22:48:30 +0200
commit8187e0143874e1bf0412263e716cf8c782a5aa16 (patch)
tree289b592b43a7226bbd355728798930c9ead45893 /procps/top.c
parent136946c3ea6a14d391b5045b5eb71fa8ec207077 (diff)
downloadbusybox-w32-8187e0143874e1bf0412263e716cf8c782a5aa16.tar.gz
busybox-w32-8187e0143874e1bf0412263e716cf8c782a5aa16.tar.bz2
busybox-w32-8187e0143874e1bf0412263e716cf8c782a5aa16.zip
*: use ESC define instead of "\033"; use ESC[m instead of ESC[0m
text data bss dec hex filename 922535 481 6832 929848 e3038 busybox_old 922534 481 6832 929847 e3037 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps/top.c')
-rw-r--r--procps/top.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/procps/top.c b/procps/top.c
index f97ded5d6..b777c494e 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -117,6 +117,7 @@
117 117
118#include "libbb.h" 118#include "libbb.h"
119 119
120#define ESC "\033"
120 121
121typedef struct top_status_t { 122typedef struct top_status_t {
122 unsigned long vsz; 123 unsigned long vsz;
@@ -580,7 +581,7 @@ static unsigned long display_header(int scr_width, int *lines_rem_p)
580 meminfo[MI_BUFFERS], 581 meminfo[MI_BUFFERS],
581 meminfo[MI_CACHED]); 582 meminfo[MI_CACHED]);
582 /* Go to top & clear to the end of screen */ 583 /* Go to top & clear to the end of screen */
583 printf(OPT_BATCH_MODE ? "%s\n" : "\033[H\033[J%s\n", scrbuf); 584 printf(OPT_BATCH_MODE ? "%s\n" : ESC"[H" ESC"[J" "%s\n", scrbuf);
584 (*lines_rem_p)--; 585 (*lines_rem_p)--;
585 586
586 /* Display CPU time split as percentage of total time. 587 /* Display CPU time split as percentage of total time.
@@ -618,7 +619,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
618#endif 619#endif
619 620
620 /* what info of the processes is shown */ 621 /* what info of the processes is shown */
621 printf(OPT_BATCH_MODE ? "%.*s" : "\033[7m%.*s\033[0m", scr_width, 622 printf(OPT_BATCH_MODE ? "%.*s" : ESC"[7m" "%.*s" ESC"[m", scr_width,
622 " PID PPID USER STAT VSZ %VSZ" 623 " PID PPID USER STAT VSZ %VSZ"
623 IF_FEATURE_TOP_SMP_PROCESS(" CPU") 624 IF_FEATURE_TOP_SMP_PROCESS(" CPU")
624 IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(" %CPU") 625 IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(" %CPU")
@@ -802,7 +803,7 @@ static void display_topmem_header(int scr_width, int *lines_rem_p)
802 meminfo[MI_ANONPAGES], 803 meminfo[MI_ANONPAGES],
803 meminfo[MI_MAPPED], 804 meminfo[MI_MAPPED],
804 meminfo[MI_MEMFREE]); 805 meminfo[MI_MEMFREE]);
805 printf(OPT_BATCH_MODE ? "%.*s\n" : "\033[H\033[J%.*s\n", scr_width, line_buf); 806 printf(OPT_BATCH_MODE ? "%.*s\n" : ESC"[H" ESC"[J" "%.*s\n", scr_width, line_buf);
806 807
807 snprintf(line_buf, LINE_BUF_SIZE, 808 snprintf(line_buf, LINE_BUF_SIZE,
808 " slab:%lu buf:%lu cache:%lu dirty:%lu write:%lu", 809 " slab:%lu buf:%lu cache:%lu dirty:%lu write:%lu",
@@ -844,7 +845,7 @@ static NOINLINE void display_topmem_process_list(int lines_rem, int scr_width)
844 cp[6] = ch; 845 cp[6] = ch;
845 do *cp++ = ch; while (*cp == ' '); 846 do *cp++ = ch; while (*cp == ' ');
846 847
847 printf(OPT_BATCH_MODE ? "%.*s" : "\e[7m%.*s\e[0m", scr_width, line_buf); 848 printf(OPT_BATCH_MODE ? "%.*s" : ESC"[7m" "%.*s" ESC"[m", scr_width, line_buf);
848 lines_rem--; 849 lines_rem--;
849 850
850 if (lines_rem > ntop - G_scroll_ofs) 851 if (lines_rem > ntop - G_scroll_ofs)