status-mem/mem.c
changeset 3 dae770da6416
parent 1 3e9290bf7249
child 13 d7ce3b1dddc4
equal deleted inserted replaced
2:f303b1affcff 3:dae770da6416
    44         }
    44         }
    45         fclose(fd);
    45         fclose(fd);
    46 
    46 
    47         int used = total - free;
    47         int used = total - free;
    48 
    48 
       
    49 #ifdef PANGO_MARKUP
    49         char *color;
    50         char *color;
    50         if (used*1.0/total < GREEN) color = "color='green'";
    51         if (used*1.0/total < GREEN) color = "color='green'";
    51         else if (used*1.0/total > RED) color = "color='red'";
    52         else if (used*1.0/total > RED) color = "color='red'";
    52         else if (used*1.0/total > ORANGE) color = "color='orange'";
    53         else if (used*1.0/total > ORANGE) color = "color='orange'";
    53         else color = "";
    54         else color = "";
    54         printf("<span %s>%d/%d</span>\n", color, used/1024, total/1024);
    55         printf("<span %s>%d/%d</span>\n", color, used/1024, total/1024);
       
    56 #else
       
    57         printf("%d/%d\n", used/1024, total/1024);
       
    58 #endif
    55         fflush(stdout);
    59         fflush(stdout);
    56 	sleep(UPDATE_PERIOD);
    60 	sleep(UPDATE_PERIOD);
    57     }
    61     }
    58 }
    62 }