DEBUG compile-time option -> OWLPS_DEBUG
The former DEBUG compilation-time option was renamed OWLPS_DEBUG to be consistent with the other options.
This commit is contained in:
parent
245c7f38b2
commit
9aa9099e6a
|
@ -68,11 +68,11 @@ if (NOT CMAKE_BUILD_TYPE)
|
|||
CACHE STRING "Set the default configuration" FORCE)
|
||||
endif()
|
||||
|
||||
option (DEBUG
|
||||
option (OWLPS_DEBUG
|
||||
"Enable debug code"
|
||||
on)
|
||||
if (DEBUG)
|
||||
add_definitions(-DDEBUG)
|
||||
if (OWLPS_DEBUG)
|
||||
add_definitions(-DOWLPS_DEBUG)
|
||||
endif()
|
||||
|
||||
|
||||
|
|
2
TODO.t2t
2
TODO.t2t
|
@ -47,7 +47,7 @@ Work to do in OwlPS
|
|||
|
||||
See also select_tut(2).
|
||||
|
||||
- Option -V should tell if DEBUG is enabled or not.
|
||||
- Option -V should tell if OWLPS_DEBUG is enabled or not.
|
||||
|
||||
- Eliminate remaining exit() calls to avoid memory leaks on exit.
|
||||
|
||||
|
|
|
@ -124,9 +124,9 @@ void owl_send_request(const int sockfd,
|
|||
if (nb_pkt == 0 || !owl_run)
|
||||
return ;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
printf("Sent packets: ") ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
|
||||
// Transmit first packet:
|
||||
owl_send_packet(sockfd, server, packet, packet_size) ;
|
||||
|
@ -143,9 +143,9 @@ void owl_send_request(const int sockfd,
|
|||
owl_send_packet(sockfd, server, packet, packet_size) ;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
putchar('\n') ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
}
|
||||
|
||||
|
||||
|
@ -164,8 +164,8 @@ void owl_send_packet(const int sockfd,
|
|||
exit(OWL_ERR_SOCKET_SEND) ;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
putchar('.') ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
}
|
||||
|
|
|
@ -84,9 +84,9 @@ void parse_main_options(int argc, char **argv) ;
|
|||
void check_destination_ip(void) ;
|
||||
void parse_calibration_data(int argc, char **argv) ;
|
||||
void check_configuration(void) ;
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
void print_configuration(void) ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
void create_socket(void) ;
|
||||
void send_request(void) ;
|
||||
void make_packet(void) ;
|
||||
|
@ -204,9 +204,9 @@ void parse_command_line(int argc, char **argv)
|
|||
parse_calibration_data(argc, argv) ;
|
||||
check_configuration() ;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
print_configuration() ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
}
|
||||
|
||||
|
||||
|
@ -350,10 +350,10 @@ void check_configuration()
|
|||
// Delay not specified (or bad delay):
|
||||
if (options.delay < 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
fprintf(stderr,
|
||||
"Warning! delay: failing back to default value.\n") ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
if (is_calibration_request)
|
||||
options.delay = DEFAULT_DELAY_CALIB ;
|
||||
else
|
||||
|
@ -363,10 +363,10 @@ void check_configuration()
|
|||
// Number of packet not specified (or bad number)
|
||||
if (options.nb_pkt < 1)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
fprintf(stderr,
|
||||
"Warning! nb_pkt: failing back to default value.\n") ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
if (is_calibration_request)
|
||||
options.nb_pkt = DEFAULT_NBPKT_CALIB ;
|
||||
else
|
||||
|
@ -376,11 +376,11 @@ void check_configuration()
|
|||
// Packet size too big
|
||||
if (options.pkt_size > MAX_PKT_SIZE)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
fprintf(stderr,
|
||||
"Warning! pkt_size cannot be greater than %d bytes:"
|
||||
" failing back to %d.\n", MAX_PKT_SIZE, MAX_PKT_SIZE) ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
options.pkt_size = MAX_PKT_SIZE ;
|
||||
}
|
||||
|
||||
|
@ -397,28 +397,28 @@ void check_configuration()
|
|||
// Check port numbers
|
||||
if (options.dest_port < 1 || options.dest_port > 65535)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
fprintf(stderr, "Warning! Bad dest_port:"
|
||||
" failing back to default value.\n") ;
|
||||
options.dest_port = OWL_DEFAULT_REQUEST_PORT ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
}
|
||||
if (options.listening_port > 65535)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
fprintf(stderr, "Warning! listening_port too high: ignored.\n") ;
|
||||
options.listening_port = 0 ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
}
|
||||
|
||||
// We want to send a calibration request AND to be located, which is
|
||||
// not allowed:
|
||||
if (is_calibration_request && options.listening_port > 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
fprintf(stderr, "Warning! You cannot wait for a server answer when"
|
||||
" you calibrate. Option -l ignored.\n") ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
options.listening_port = 0 ;
|
||||
}
|
||||
|
||||
|
@ -427,10 +427,10 @@ void check_configuration()
|
|||
// We want to flood AND to be located, which is not allowed:
|
||||
if (options.listening_port > 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
fprintf(stderr, "Warning! You cannot wait for a server answer"
|
||||
" when you flood. Option -l ignored.\n") ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
options.listening_port = 0 ;
|
||||
}
|
||||
}
|
||||
|
@ -438,19 +438,19 @@ void check_configuration()
|
|||
{
|
||||
if (options.nb_requests)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
fprintf(stderr, "Warning! The -N option can be used only along"
|
||||
" with -F. Option -N ignored.\n") ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
options.nb_requests = 0 ;
|
||||
}
|
||||
if (options.daemon)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
fprintf(stderr, "Warning! It is useless to detach from"
|
||||
" the foreground if the flood mode is not activated"
|
||||
" Option -D ignored.\n") ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
options.daemon = false ;
|
||||
}
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ void check_configuration()
|
|||
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
void print_configuration()
|
||||
{
|
||||
fprintf(stderr, "Options:\n"
|
||||
|
@ -489,7 +489,7 @@ void print_configuration()
|
|||
options.z
|
||||
) ;
|
||||
}
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
|
||||
|
||||
|
||||
|
@ -628,10 +628,10 @@ uint_fast16_t initialise_calibration_fields(uint_fast16_t offset)
|
|||
// Direction:
|
||||
packet[offset++] = options.direction ;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
printf("Direction = %d, X = %f, Y = %f, Z = %f\n",
|
||||
packet[offset - 1], options.x, options.y, options.z) ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
|
||||
// Convert the coordinates to the network endianness:
|
||||
x = owl_htonf(options.x) ;
|
||||
|
|
|
@ -354,18 +354,18 @@ void* tcp_server(void *NULL_value)
|
|||
}
|
||||
client_message[nbytes] = '\0' ;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
printf("Got a message from the client:\n"
|
||||
"\"%s\"\n", client_message) ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
|
||||
request_id =
|
||||
extract_request_from_message(client_request, client_message) ;
|
||||
prepare_answer(request_id) ;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef OWLPS_DEBUG
|
||||
printf("Answer to send:\n\"%s\"\n", answer) ;
|
||||
#endif // DEBUG
|
||||
#endif // OWLPS_DEBUG
|
||||
|
||||
/* Send the answer */
|
||||
nbytes = send(newsockfd, answer, answer_strlen, 0) ;
|
||||
|
|
Loading…
Reference in New Issue