#include "config.h" #include #include #include #include #include #include #include #include #if HAVE_NCURSES_H #include #else #include #endif #if HAVE_TERMIO_H #include #endif #if HAVE_TERM_H #include #elif HAVE_NCURSES_TERM_H #include #endif #include #ifdef HAVE_GETOPT_H #include #endif #if HAVE_LIBINTL_H #include #endif #include "fallback.h" #include "print_help.h" /* Small utility for setting the color. Usage: set_color COLOR where COLOR is either an integer from 0 to seven or one of the strings in the col array. */ #define COLORS (sizeof(col)/sizeof(char *)) /** Program name */ #define SET_COLOR "set_color" /** Getopt short switches for set_color */ #define GETOPT_STRING "b:hvocu" #ifdef USE_GETTEXT #define _(string) gettext(string) #else #define _(string) (string) #endif char *col[]= { "black", "red", "green", "brown", "yellow", "blue", "magenta", "purple", "cyan", "white", "normal" } ; int col_idx[]= { 0, 1, 2, 3, 3, 4, 5, 5, 6, 7, 8 } ; int translate_color( char *str ) { char *endptr; int color; if( !str ) return -1; color = strtol( str, &endptr, 10 ); if(endptr<=str) { int i; color = -1; for( i=0; i