ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/saidar/saidar.c
(Generate patch)

Comparing projects/libstatgrab/src/saidar/saidar.c (file contents):
Revision 1.36 by tdb, Thu Nov 30 23:42:43 2006 UTC vs.
Revision 1.38 by tdb, Fri Dec 1 01:03:59 2006 UTC

# Line 40 | Line 40
40  
41   #ifdef HAVE_NCURSES_H
42   #include <ncurses.h>
43 + #define COLOR_SUPPORT
44   #else
45   #include <curses.h>
46   #endif
# Line 310 | Line 311 | void display_data(int colors){
311                  move(4,33);
312                  if (colors && stats.cpu_percents->user + stats.cpu_percents->nice > THRESHOLD_ALERT_CPU) {
313                          attron(A_STANDOUT);
314 +                        attron(A_BOLD);
315                  }
316                  else if (colors && stats.cpu_percents->user + stats.cpu_percents->nice > THRESHOLD_WARN_CPU) {
317                          attron(A_BOLD);
# Line 329 | Line 331 | void display_data(int colors){
331                  move(2,74);
332                  if (colors && stats.process_count->zombie > THRESHOLD_WARN_ZMB) {
333                          attron(A_STANDOUT);
334 +                        attron(A_BOLD);
335                  }
336                  printw("%5d", stats.process_count->zombie);
337                  if(colors) {
338                          attroff(A_STANDOUT);
339 <                        attron(COLOR_PAIR(6));
339 >                        attroff(A_BOLD);
340                  }
341                  move(3, 54);
342                  printw("%5d", stats.process_count->sleeping);
# Line 376 | Line 379 | void display_data(int colors){
379                  float f = 100.00 * (float)(stats.mem_stats->used)/stats.mem_stats->total;
380                  if (colors && f > THRESHOLD_ALERT_MEM) {
381                          attron(A_STANDOUT);
382 +                        attron(A_BOLD);
383                  }
384                  else if (colors && f > THRESHOLD_WARN_MEM) {
385                          attron(A_BOLD);
# Line 392 | Line 396 | void display_data(int colors){
396                  float f = 100.00 * (float)(stats.swap_stats->used)/stats.swap_stats->total;
397                  if (colors && f > THRESHOLD_ALERT_SWAP) {
398                          attron(A_STANDOUT);
399 +                        attron(A_BOLD);
400                  }
401                  else if (colors && f > THRESHOLD_WARN_SWAP) {
402                          attron(A_BOLD);
# Line 510 | Line 515 | void display_data(int colors){
515                          move(line, 73);
516                          if(colors && 100.00 * ((float) disk_stat_ptr->used / (float) (disk_stat_ptr->used + disk_stat_ptr->avail)) > THRESHOLD_ALERT_DISK) {
517                                  attron(A_STANDOUT);
518 +                                attron(A_BOLD);
519                          } else if (colors && 100.00 * ((float) disk_stat_ptr->used / (float) (disk_stat_ptr->used + disk_stat_ptr->avail)) > THRESHOLD_WARN_DISK) {
520                                  attron(A_BOLD);
521                          }
# Line 557 | Line 563 | void version_num(char *progname){
563   }
564  
565   void usage(char *progname){
566 + #ifdef COLOR_SUPPORT
567          fprintf(stderr, "Usage: %s [-d delay] [-c] [-v] [-h]\n\n", progname);
568 + #else
569 +        fprintf(stderr, "Usage: %s [-d delay] [-v] [-h]\n\n", progname);
570 + #endif
571          fprintf(stderr, "  -d    Sets the update time in seconds\n");
572 + #ifdef COLOR_SUPPORT
573          fprintf(stderr, "  -c    Enables coloured output\n");
574 + #endif
575          fprintf(stderr, "  -v    Prints version number\n");
576          fprintf(stderr, "  -h    Displays this help information.\n");
577          fprintf(stderr, "\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT);
# Line 585 | Line 597 | int main(int argc, char **argv){
597                  return 1;
598          }
599  
600 + #ifdef COLOR_SUPPORT
601          while ((c = getopt(argc, argv, "d:cvh")) != -1){
602 + #else
603 +        while ((c = getopt(argc, argv, "d:vh")) != -1){
604 + #endif
605                  switch (c){
606                          case 'd':
607                                  delay = atoi(optarg);
# Line 594 | Line 610 | int main(int argc, char **argv){
610                                          exit(1);
611                                  }
612                                  break;
613 + #ifdef COLOR_SUPPORT
614                          case 'c':
615                                  colouron = 1;
616                                  break;
617 + #endif
618                          case 'v':
619                                  version_num(argv[0]);
620                                  break;
# Line 610 | Line 628 | int main(int argc, char **argv){
628  
629          signal(SIGWINCH, sig_winch_handler);
630          initscr();
631 + #ifdef COLOR_SUPPORT
632          /* turn on colour */
633          if (colouron) {
634                  if (has_colors()) {
# Line 626 | Line 645 | int main(int argc, char **argv){
645                          colouron = 0;
646                  }
647          }
648 + #endif
649          nonl();
650          cbreak();
651          noecho();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines