summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-03-04 11:50:59 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2010-03-04 11:50:59 (GMT)
commit917693b5b3d1ece0ade489bc4d922bfa368b979e (patch)
treefe26173703160dc3e50ec2d4f027ce9c0db3e01c
parent197202d435bcb3df7268c8fbb66c05ff78e645ac (diff)
downloadbusybox-917693b5b3d1ece0ade489bc4d922bfa368b979e.tar.gz
busybox-917693b5b3d1ece0ade489bc4d922bfa368b979e.tar.bz2
top: make 's' display easier to understand
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--procps/top.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/procps/top.c b/procps/top.c
index d76d9af..f5c0a12 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -696,12 +696,12 @@ static int topmem_sort(char *a, char *b)
return inverted ? -n : n;
}
-/* Cut "NNNN " out of " NNNN kb" */
+/* Cut "NNNN" out of " NNNN kb" */
static char *grab_number(char *str, const char *match, unsigned sz)
{
if (strncmp(str, match, sz) == 0) {
str = skip_whitespace(str + sz);
- (skip_non_whitespace(str))[1] = '\0';
+ (skip_non_whitespace(str))[0] = '\0';
return xstrdup(str);
}
return NULL;
@@ -768,19 +768,19 @@ static void display_topmem_header(int scr_width, int *lines_rem_p)
}
fclose(fp);
-#define S(s) (s ? s : "0 ")
+#define S(s) (s ? s : "0")
snprintf(linebuf, sizeof(linebuf),
- "Mem %stotal %sanon %smap %sfree",
+ "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);
snprintf(linebuf, sizeof(linebuf),
- " %sslab %sbuf %scache %sdirty %swrite",
+ " slab:%s buf:%s cache:%s dirty:%s write:%s",
S(slab), S(buf), S(cache), S(dirty), S(mwrite));
printf("%.*s\n", scr_width, linebuf);
snprintf(linebuf, sizeof(linebuf),
- "Swap %stotal %sfree", // TODO: % used?
+ "Swap total:%s free:%s", // TODO: % used?
S(swaptotal), S(swapfree));
printf("%.*s\n", scr_width, linebuf);