[Listener] Switch verbose mode to verbose level

This commit is contained in:
Matteo Cypriani 2011-07-24 17:58:40 +02:00
parent 371752ab98
commit a62387e465
2 changed files with 15 additions and 15 deletions

View File

@ -192,12 +192,12 @@ void print_version(void) ;
(cfg_getfloat(cfg, "my_position_z")) (cfg_getfloat(cfg, "my_position_z"))
#endif // USE_PTHREAD #endif // USE_PTHREAD
#define SET_VERBOSE() \ #define INCREMENT_VERBOSE() \
(cfg_setbool(cfg, "verbose", cfg_true)) (cfg_setint(cfg, "verbose", cfg_getint(cfg, "verbose") + 1))
#define UNSET_VERBOSE() \ #define RESET_VERBOSE() \
(cfg_setbool(cfg, "verbose", cfg_false)) (cfg_setint(cfg, "verbose", 0))
#define GET_VERBOSE() \ #define GET_VERBOSE() \
(cfg_getbool(cfg, "verbose")) (cfg_getint(cfg, "verbose"))
#define SET_DISPLAY_CAPTURED() \ #define SET_DISPLAY_CAPTURED() \
(cfg_setbool(cfg, "display_captured", cfg_true)) (cfg_setbool(cfg, "display_captured", cfg_true))
#define UNSET_DISPLAY_CAPTURED() \ #define UNSET_DISPLAY_CAPTURED() \
@ -285,10 +285,10 @@ void print_version(void) ;
(options.my_position_z) (options.my_position_z)
#endif // USE_PTHREAD #endif // USE_PTHREAD
#define SET_VERBOSE() \ #define INCREMENT_VERBOSE() \
(options.verbose = TRUE) (++options.verbose)
#define UNSET_VERBOSE() \ #define RESET_VERBOSE() \
(options.verbose = FALSE) (options.verbose = 0)
#define GET_VERBOSE() \ #define GET_VERBOSE() \
(options.verbose) (options.verbose)
#define SET_DISPLAY_CAPTURED() \ #define SET_DISPLAY_CAPTURED() \

View File

@ -79,7 +79,7 @@ struct {
float my_position_y ; float my_position_y ;
float my_position_z ; float my_position_z ;
#endif // USE_PTHREAD #endif // USE_PTHREAD
owl_bool verbose ; uint_fast8_t verbose ;
owl_bool display_captured ; owl_bool display_captured ;
} options = { // Initalise default options: } options = { // Initalise default options:
MODE_ACTIVE, MODE_ACTIVE,
@ -101,7 +101,7 @@ struct {
DEFAULT_AUTOCALIBRATION_NBPKT, DEFAULT_AUTOCALIBRATION_NBPKT,
0, 0, 0, 0, 0, 0, 0, 0,
#endif // USE_PTHREAD #endif // USE_PTHREAD
FALSE, 0,
FALSE FALSE
} ; } ;
#endif // USE_CONFIG_FILE #endif // USE_CONFIG_FILE
@ -307,8 +307,8 @@ void parse_config_file(int argc, char **argv)
// Position Z // Position Z
CFG_FLOAT("my_position_z", 0, CFGF_NONE), CFG_FLOAT("my_position_z", 0, CFGF_NONE),
#endif // USE_PTHREAD #endif // USE_PTHREAD
// Be verbose, or not: // Verbose level:
CFG_BOOL("verbose", cfg_false, CFGF_NONE), CFG_INT("verbose", 0, CFGF_NONE),
// Display captured packets, or not: // Display captured packets, or not:
CFG_BOOL("display_captured", cfg_false, CFGF_NONE), CFG_BOOL("display_captured", cfg_false, CFGF_NONE),
CFG_END() CFG_END()
@ -461,7 +461,7 @@ void parse_main_options(int argc, char **argv)
#endif // USE_PTHREAD #endif // USE_PTHREAD
break ; break ;
case 'q' : case 'q' :
UNSET_VERBOSE() ; RESET_VERBOSE() ;
break ; break ;
case 'Q' : case 'Q' :
UNSET_DISPLAY_CAPTURED() ; UNSET_DISPLAY_CAPTURED() ;
@ -475,7 +475,7 @@ void parse_main_options(int argc, char **argv)
#endif // USE_PTHREAD #endif // USE_PTHREAD
break ; break ;
case 'v' : case 'v' :
SET_VERBOSE() ; INCREMENT_VERBOSE() ;
break ; break ;
case 'V' : // Version case 'V' : // Version
break ; // (already parsed) break ; // (already parsed)