Updates for mbmon

This commit is contained in:
Michiel Broek 2004-03-21 13:40:25 +00:00
parent 85c892cc12
commit 4c4a5f7bef
3 changed files with 9 additions and 8 deletions

View File

@ -118,7 +118,7 @@ v0.51.2 06-Mar-2004
On screen 2 added disk status. On screen 2 added disk status.
On screen 3, the warning colors for diskspace are now triggered On screen 3, the warning colors for diskspace are now triggered
by the global config setting, red for the upper limit, and 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: mbtask:
Added communication commands for disk watch thread. Added communication commands for disk watch thread.

View File

@ -328,7 +328,7 @@ void system_stat(void)
void disk_stat(void) void disk_stat(void)
{ {
int ch, i; int ch, i, ro;
char buf[1024], *cnt, *type, *fs, *p, sign; char buf[1024], *cnt, *type, *fs, *p, sign;
unsigned long last[10], size, used, perc, avail; unsigned long last[10], size, used, perc, avail;
@ -336,7 +336,7 @@ void disk_stat(void)
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
mvprintw( 5, 6, "3. FILESYSTEM USAGE"); mvprintw( 5, 6, "3. FILESYSTEM USAGE");
set_color(YELLOW, RED); 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); set_color(CYAN, BLACK);
mvprintw(lines - 2, 6, "Press any key"); mvprintw(lines - 2, 6, "Press any key");
IsDoing("Filesystem Usage"); IsDoing("Filesystem Usage");
@ -361,7 +361,8 @@ void disk_stat(void)
perc = (used * 100) / size; perc = (used * 100) / size;
sign = ' '; sign = ' ';
fs = strtok(NULL, " "); fs = strtok(NULL, " ");
type = strtok(NULL, ",;"); type = strtok(NULL, " ");
ro = atoi(strtok(NULL, ",;"));
if (used > last[i]) if (used > last[i])
sign = '^'; sign = '^';
if (used < last[i]) if (used < last[i])
@ -373,7 +374,7 @@ void disk_stat(void)
mvprintw(i+8, 1, "%8lu %8lu ", size, used); mvprintw(i+8, 1, "%8lu %8lu ", size, used);
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
printf("%c ", sign); printf("%c ", sign);
if ((strstr(type, "iso") == NULL) && (strstr(type, "9660") == NULL)) { if (ro == 0) {
if (avail <= CFG.freespace) if (avail <= CFG.freespace)
set_color(LIGHTRED, BLACK); set_color(LIGHTRED, BLACK);
else if (avail <= (CFG.freespace * 4)) else if (avail <= (CFG.freespace * 4))
@ -381,12 +382,12 @@ void disk_stat(void)
else else
set_color(CYAN, BLACK); set_color(CYAN, BLACK);
} else { } else {
set_color(CYAN, BLACK); set_color(GREEN, BLACK);
} }
printf("%3lu", perc); printf("%3lu", perc);
putchar('%'); putchar('%');
set_color(CYAN, BLACK); set_color(CYAN, BLACK);
printf(" %-8s %-40s", type, fs); printf(" %-8s %s %-37s", type, ro ?"RO":"RW", fs);
} }
locate(i+8, 1); locate(i+8, 1);
clrtoeol(); clrtoeol();

View File

@ -197,7 +197,7 @@ char *disk_getfs()
else else
ans = xstrcat(ans, (char *)","); ans = xstrcat(ans, (char *)",");
tt[0] = '\0'; 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); ans = xstrcat(ans, tt);
if (i == 10) /* No more then 10 filesystems */ if (i == 10) /* No more then 10 filesystems */
break; break;