[Listener] Use verbosity instead of #ifdef DEBUG

Whenever possible, test the value of GET_VERBOSE() instead of a #ifdef
DEBUG.
This commit is contained in:
Matteo Cypriani 2011-02-23 14:42:44 +01:00
parent 80f17b08b7
commit ac8438a33b
1 changed files with 16 additions and 18 deletions

View File

@ -354,6 +354,7 @@ void check_configuration()
print_usage() ; print_usage() ;
exit(ERR_BAD_USAGE) ; exit(ERR_BAD_USAGE) ;
} }
if (GET_RTAP_IFACE()[0] == '\0') if (GET_RTAP_IFACE()[0] == '\0')
{ {
fprintf(stderr, "Error! You must specify a radiotap interface" fprintf(stderr, "Error! You must specify a radiotap interface"
@ -361,15 +362,16 @@ void check_configuration()
print_usage() ; print_usage() ;
exit(ERR_BAD_USAGE) ; exit(ERR_BAD_USAGE) ;
} }
if (GET_WIFI_IFACE()[0] == '\0') if (GET_WIFI_IFACE()[0] == '\0')
{ {
#ifdef DEBUG if (GET_VERBOSE())
fprintf(stderr, "Warning! No Wi-Fi was specified. Failing back to" fprintf(stderr, "No Wi-Fi interface was specified. Failing back"
" the radiotap interface (%s) instead.\n", " to the radiotap interface (%s) instead.\n",
GET_RTAP_IFACE()) ; GET_RTAP_IFACE()) ;
#endif // DEBUG
SET_WIFI_IFACE(GET_RTAP_IFACE()) ; SET_WIFI_IFACE(GET_RTAP_IFACE()) ;
} }
} }
@ -429,9 +431,8 @@ void print_configuration()
*/ */
void keep_mode_monitor(char *iface) void keep_mode_monitor(char *iface)
{ {
#ifdef DEBUG if (GET_VERBOSE())
fprintf(stderr, "Thread for keeping monitor mode launched.\n") ; fprintf(stderr, "Thread for keeping monitor mode launched.\n") ;
#endif // DEBUG
while (run) while (run)
{ {
@ -885,9 +886,8 @@ void autocalibrate_hello()
struct sockaddr_in serv; struct sockaddr_in serv;
autocalibration_hello message ; autocalibration_hello message ;
#ifdef DEBUG if (GET_VERBOSE())
fprintf(stderr, "Autocalibration Hello thread launched.\n") ; fprintf(stderr, "Autocalibration Hello thread launched.\n") ;
#endif // DEBUG
send_sockfd = send_sockfd =
owlps_create_socket_to_aggregator(GET_AGGREGATION_IP(), owlps_create_socket_to_aggregator(GET_AGGREGATION_IP(),
@ -916,9 +916,8 @@ void autocalibrate()
int listen_sockfd ; int listen_sockfd ;
autocalibration_order message ; autocalibration_order message ;
#ifdef DEBUG if (GET_VERBOSE())
fprintf(stderr, "Autocalibration thread launched.\n") ; fprintf(stderr, "Autocalibration thread launched.\n") ;
#endif // DEBUG
// Socket to send autocalibration positioning requests // Socket to send autocalibration positioning requests
autocalibration_send_sockfd = autocalibration_send_sockfd =
@ -951,10 +950,9 @@ void autocalibrate()
if (ntohl(message.order) == AUTOCALIBRATION_ORDER_SEND) if (ntohl(message.order) == AUTOCALIBRATION_ORDER_SEND)
{ {
#ifdef DEBUG if (GET_VERBOSE())
fprintf(stderr, "I just was ordered to send an autocalibration" fprintf(stderr, "I was just ordered to send an"
" request...\n") ; " autocalibration request...\n") ;
#endif // DEBUG
send_autocalibration_request() ; send_autocalibration_request() ;
} }
else else