systat - Ensure vmmeter output separates fields by at least one space.
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 24 Sep 2012 17:31:47 +0000 (10:31 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 24 Sep 2012 17:34:36 +0000 (10:34 -0700)
* Ensure vmmeter output separates fields by at least one space.

* Fix minor formatting issue with token names.

usr.bin/systat/vmmeter.c

index f0cc955..55b9635 100644 (file)
 
 #define DRAW_ROW(n, y, w, fmt, args...) \
 do { \
-       mvprintw(y, n, fmt, w, args); \
+       mvprintw(y, n, fmt, w - 1, args); \
+       n += w; \
+} while (0)
+
+#define DRAW_ROW2(n, y, w, fmt, args...) \
+do { \
+       mvprintw(y, n, fmt, w - 1, w - 1, args); \
        n += w; \
 } while (0)
 
@@ -113,12 +119,17 @@ do { \
                 * Display token collision count and the last-colliding
                 * token name.
                 */
-               DRAW_ROW(n, CPU_START + i, 8, "%*u", D(i, v_token_colls));
+               if (D(i, v_token_colls) > 9999999)
+                       DRAW_ROW(n, CPU_START + i, 8, "%*u", 9999999);
+               else
+                       DRAW_ROW(n, CPU_START + i, 8, "%*u",
+                                D(i, v_token_colls));
+
                if (D(i, v_token_colls) == 0) {
-                       DRAW_ROW(n, CPU_START + i, 8, "%*s", "");
+                       DRAW_ROW2(n, CPU_START + i, 8, "%*.*s", "");
                } else {
-                       DRAW_ROW(n, CPU_START + i, 8, "%*s",
-                                vmm_cur[i].v_token_name);
+                       DRAW_ROW2(n, CPU_START + i, 8, "%*.*s",
+                                 vmm_cur[i].v_token_name);
                }
 
 #undef D