40 |
|
|
41 |
|
#ifdef HAVE_NCURSES_H |
42 |
|
#include <ncurses.h> |
43 |
+ |
#define COLOR_SUPPORT |
44 |
|
#else |
45 |
|
#include <curses.h> |
46 |
|
#endif |
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); |
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); |
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; |
628 |
|
|
629 |
|
signal(SIGWINCH, sig_winch_handler); |
630 |
|
initscr(); |
631 |
+ |
#ifdef COLOR_SUPPORT |
632 |
|
/* turn on colour */ |
633 |
|
if (colouron) { |
634 |
|
if (has_colors()) { |
645 |
|
colouron = 0; |
646 |
|
} |
647 |
|
} |
648 |
+ |
#endif |
649 |
|
nonl(); |
650 |
|
cbreak(); |
651 |
|
noecho(); |