| 39 |
|
#include <math.h> |
| 40 |
|
|
| 41 |
|
#ifdef HAVE_NCURSES_H |
| 42 |
< |
#include <ncurses.h> |
| 43 |
< |
#else |
| 44 |
< |
#include <curses.h> |
| 42 |
> |
#define COLOR_SUPPORT |
| 43 |
|
#endif |
| 44 |
+ |
#include CURSES_HEADER_FILE |
| 45 |
|
|
| 46 |
|
#define THRESHOLD_LOAD 1.0 |
| 47 |
|
|
| 561 |
|
} |
| 562 |
|
|
| 563 |
|
void usage(char *progname){ |
| 564 |
+ |
#ifdef COLOR_SUPPORT |
| 565 |
|
fprintf(stderr, "Usage: %s [-d delay] [-c] [-v] [-h]\n\n", progname); |
| 566 |
+ |
#else |
| 567 |
+ |
fprintf(stderr, "Usage: %s [-d delay] [-v] [-h]\n\n", progname); |
| 568 |
+ |
#endif |
| 569 |
|
fprintf(stderr, " -d Sets the update time in seconds\n"); |
| 570 |
+ |
#ifdef COLOR_SUPPORT |
| 571 |
|
fprintf(stderr, " -c Enables coloured output\n"); |
| 572 |
+ |
#endif |
| 573 |
|
fprintf(stderr, " -v Prints version number\n"); |
| 574 |
|
fprintf(stderr, " -h Displays this help information.\n"); |
| 575 |
|
fprintf(stderr, "\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); |
| 595 |
|
return 1; |
| 596 |
|
} |
| 597 |
|
|
| 598 |
+ |
#ifdef COLOR_SUPPORT |
| 599 |
|
while ((c = getopt(argc, argv, "d:cvh")) != -1){ |
| 600 |
+ |
#else |
| 601 |
+ |
while ((c = getopt(argc, argv, "d:vh")) != -1){ |
| 602 |
+ |
#endif |
| 603 |
|
switch (c){ |
| 604 |
|
case 'd': |
| 605 |
|
delay = atoi(optarg); |
| 608 |
|
exit(1); |
| 609 |
|
} |
| 610 |
|
break; |
| 611 |
+ |
#ifdef COLOR_SUPPORT |
| 612 |
|
case 'c': |
| 613 |
|
colouron = 1; |
| 614 |
|
break; |
| 615 |
+ |
#endif |
| 616 |
|
case 'v': |
| 617 |
|
version_num(argv[0]); |
| 618 |
|
break; |
| 626 |
|
|
| 627 |
|
signal(SIGWINCH, sig_winch_handler); |
| 628 |
|
initscr(); |
| 629 |
+ |
#ifdef COLOR_SUPPORT |
| 630 |
|
/* turn on colour */ |
| 631 |
|
if (colouron) { |
| 632 |
|
if (has_colors()) { |
| 643 |
|
colouron = 0; |
| 644 |
|
} |
| 645 |
|
} |
| 646 |
+ |
#endif |
| 647 |
|
nonl(); |
| 648 |
|
cbreak(); |
| 649 |
|
noecho(); |