From 4c4a5f7befba0e2558ab52366719dfb3d034a5fb Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 21 Mar 2004 13:40:25 +0000 Subject: [PATCH] Updates for mbmon --- ChangeLog | 2 +- mbmon/mbmon.c | 13 +++++++------ mbtask/taskdisk.c | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a027221..68d2ad5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -118,7 +118,7 @@ v0.51.2 06-Mar-2004 On screen 2 added disk status. On screen 3, the warning colors for diskspace are now triggered by the global config setting, red for the upper limit, and - yellow for the upper limit * 4. + yellow for the upper limit * 4. Added RO/RW status indicator. mbtask: Added communication commands for disk watch thread. diff --git a/mbmon/mbmon.c b/mbmon/mbmon.c index f9a188a3..54b997ab 100644 --- a/mbmon/mbmon.c +++ b/mbmon/mbmon.c @@ -328,7 +328,7 @@ void system_stat(void) void disk_stat(void) { - int ch, i; + int ch, i, ro; char buf[1024], *cnt, *type, *fs, *p, sign; unsigned long last[10], size, used, perc, avail; @@ -336,7 +336,7 @@ void disk_stat(void) set_color(WHITE, BLACK); mvprintw( 5, 6, "3. FILESYSTEM USAGE"); set_color(YELLOW, RED); - mvprintw( 7, 1, " Size MB Used MB Perc. FS-Type Mountpoint "); + mvprintw( 7, 1, " Size MB Used MB Perc. FS-Type St Mountpoint "); set_color(CYAN, BLACK); mvprintw(lines - 2, 6, "Press any key"); IsDoing("Filesystem Usage"); @@ -361,7 +361,8 @@ void disk_stat(void) perc = (used * 100) / size; sign = ' '; fs = strtok(NULL, " "); - type = strtok(NULL, ",;"); + type = strtok(NULL, " "); + ro = atoi(strtok(NULL, ",;")); if (used > last[i]) sign = '^'; if (used < last[i]) @@ -373,7 +374,7 @@ void disk_stat(void) mvprintw(i+8, 1, "%8lu %8lu ", size, used); set_color(WHITE, BLACK); printf("%c ", sign); - if ((strstr(type, "iso") == NULL) && (strstr(type, "9660") == NULL)) { + if (ro == 0) { if (avail <= CFG.freespace) set_color(LIGHTRED, BLACK); else if (avail <= (CFG.freespace * 4)) @@ -381,12 +382,12 @@ void disk_stat(void) else set_color(CYAN, BLACK); } else { - set_color(CYAN, BLACK); + set_color(GREEN, BLACK); } printf("%3lu", perc); putchar('%'); set_color(CYAN, BLACK); - printf(" %-8s %-40s", type, fs); + printf(" %-8s %s %-37s", type, ro ?"RO":"RW", fs); } locate(i+8, 1); clrtoeol(); diff --git a/mbtask/taskdisk.c b/mbtask/taskdisk.c index dded2eb3..03e5682a 100644 --- a/mbtask/taskdisk.c +++ b/mbtask/taskdisk.c @@ -197,7 +197,7 @@ char *disk_getfs() else ans = xstrcat(ans, (char *)","); tt[0] = '\0'; - sprintf(tt, "%lu %lu %s %s", tmp->size, tmp->avail, tmp->mountpoint, tmp->fstype); + sprintf(tt, "%lu %lu %s %s %d", tmp->size, tmp->avail, tmp->mountpoint, tmp->fstype, tmp->ro); ans = xstrcat(ans, tt); if (i == 10) /* No more then 10 filesystems */ break;