--- projects/libstatgrab/src/saidar/saidar.c 2006/12/01 00:38:39 1.37 +++ projects/libstatgrab/src/saidar/saidar.c 2006/12/01 14:21:17 1.39 @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: saidar.c,v 1.37 2006/12/01 00:38:39 tdb Exp $ + * $Id: saidar.c,v 1.39 2006/12/01 14:21:17 tdb Exp $ */ #ifdef HAVE_CONFIG_H @@ -39,10 +39,9 @@ #include #ifdef HAVE_NCURSES_H -#include -#else -#include +#define COLOR_SUPPORT #endif +#include CURSES_HEADER_FILE #define THRESHOLD_LOAD 1.0 @@ -562,9 +561,15 @@ void version_num(char *progname){ } void usage(char *progname){ +#ifdef COLOR_SUPPORT fprintf(stderr, "Usage: %s [-d delay] [-c] [-v] [-h]\n\n", progname); +#else + fprintf(stderr, "Usage: %s [-d delay] [-v] [-h]\n\n", progname); +#endif fprintf(stderr, " -d Sets the update time in seconds\n"); +#ifdef COLOR_SUPPORT fprintf(stderr, " -c Enables coloured output\n"); +#endif fprintf(stderr, " -v Prints version number\n"); fprintf(stderr, " -h Displays this help information.\n"); fprintf(stderr, "\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); @@ -590,7 +595,11 @@ int main(int argc, char **argv){ return 1; } +#ifdef COLOR_SUPPORT while ((c = getopt(argc, argv, "d:cvh")) != -1){ +#else + while ((c = getopt(argc, argv, "d:vh")) != -1){ +#endif switch (c){ case 'd': delay = atoi(optarg); @@ -599,9 +608,11 @@ int main(int argc, char **argv){ exit(1); } break; +#ifdef COLOR_SUPPORT case 'c': colouron = 1; break; +#endif case 'v': version_num(argv[0]); break; @@ -615,6 +626,7 @@ int main(int argc, char **argv){ signal(SIGWINCH, sig_winch_handler); initscr(); +#ifdef COLOR_SUPPORT /* turn on colour */ if (colouron) { if (has_colors()) { @@ -631,6 +643,7 @@ int main(int argc, char **argv){ colouron = 0; } } +#endif nonl(); cbreak(); noecho();