summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenys Vlasenko2010-05-16 23:42:13 +0200
committerDenys Vlasenko2010-05-16 23:42:13 +0200
commitd9a3e89f501800c3e7c779b7e9545a5c80134593 (patch)
treeba3b65ce2d512542a27e78f4820d799008bc0b4c /procps
parent26e2c1db0df35df1affa558efc12d2bcfd7718e2 (diff)
downloadbusybox-d9a3e89f501800c3e7c779b7e9545a5c80134593.zip
busybox-d9a3e89f501800c3e7c779b7e9545a5c80134593.tar.gz
consolidate ESC sequences
function old new delta bell 2 - -2 CMdown 2 - -2 Ceos 4 - -4 Ceol 4 - -4 CMup 4 - -4 SOs 5 - -5 SOn 5 - -5 CMrc 9 - -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r--procps/top.c8
-rw-r--r--procps/watch.c3
2 files changed, 6 insertions, 5 deletions
diff --git a/procps/top.c b/procps/top.c
index f5c0a12..e4afafc 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -478,8 +478,8 @@ static unsigned long display_header(int scr_width, int *lines_rem_p)
snprintf(scrbuf, scr_width,
"Mem: %luK used, %luK free, %luK shrd, %luK buff, %luK cached",
used, mfree, shared, buffers, cached);
- /* clear screen & go to top */
- printf(OPT_BATCH_MODE ? "%s\n" : "\e[H\e[J%s\n", scrbuf);
+ /* go to top & clear to the end of screen */
+ printf(OPT_BATCH_MODE ? "%s\n" : "\033[H\033[J%s\n", scrbuf);
(*lines_rem_p)--;
/* Display CPU time split as percentage of total time
@@ -518,7 +518,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
#endif
/* what info of the processes is shown */
- printf(OPT_BATCH_MODE ? "%.*s" : "\e[7m%.*s\e[0m", scr_width,
+ printf(OPT_BATCH_MODE ? "%.*s" : "\033[7m%.*s\033[0m", scr_width,
" PID PPID USER STAT VSZ %MEM"
IF_FEATURE_TOP_SMP_PROCESS(" CPU")
IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(" %CPU")
@@ -772,7 +772,7 @@ static void display_topmem_header(int scr_width, int *lines_rem_p)
snprintf(linebuf, sizeof(linebuf),
"Mem total:%s anon:%s map:%s free:%s",
S(total), S(anon), S(map), S(mfree));
- printf(OPT_BATCH_MODE ? "%.*s\n" : "\e[H\e[J%.*s\n", scr_width, linebuf);
+ printf(OPT_BATCH_MODE ? "%.*s\n" : "\033[H\033[J%.*s\n", scr_width, linebuf);
snprintf(linebuf, sizeof(linebuf),
" slab:%s buf:%s cache:%s dirty:%s write:%s",
diff --git a/procps/watch.c b/procps/watch.c
index 126945c..a1cde9e 100644
--- a/procps/watch.c
+++ b/procps/watch.c
@@ -52,7 +52,8 @@ int watch_main(int argc UNUSED_PARAM, char **argv)
width = (unsigned)-1; // make sure first time new_width != width
header = NULL;
while (1) {
- printf("\033[H\033[J");
+ /* home; clear to the end of screen */
+ printf("\033[H""\033[J");
if (!(opt & 0x2)) { // no -t
const unsigned time_len = sizeof("1234-67-90 23:56:89");
time_t t;