[Aggregator] Print version info with -V
This commit is contained in:
parent
7a95851795
commit
7123f02e82
|
@ -1,3 +1,8 @@
|
||||||
|
# Source version
|
||||||
|
ifndef OWLPS_VERSION
|
||||||
|
OWLPS_VERSION = $$(git describe || echo 'UNKNOWN_VERSION')
|
||||||
|
endif
|
||||||
|
|
||||||
# Répertoire d'installation
|
# Répertoire d'installation
|
||||||
PREFIX=/usr/local
|
PREFIX=/usr/local
|
||||||
INSTALL_DIR= $(PREFIX)/bin
|
INSTALL_DIR= $(PREFIX)/bin
|
||||||
|
@ -25,7 +30,7 @@ CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O -I$(LIBOWLPS_DIR)
|
||||||
DEPFLAGS=-MMD
|
DEPFLAGS=-MMD
|
||||||
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
PICFLAG=-fPIC
|
PICFLAG=-fPIC
|
||||||
#OWLPSFLAGS =
|
OWLPSFLAGS = -D OWLPS_VERSION=\"$(OWLPS_VERSION)\"
|
||||||
LIBS = -pthread -lconfuse -L$(LIBOWLPS_DIR) -lowlps
|
LIBS = -pthread -lconfuse -L$(LIBOWLPS_DIR) -lowlps
|
||||||
LDFLAGS = $(LIBS) $(OWLPSFLAGS)
|
LDFLAGS = $(LIBS) $(OWLPSFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* Arguments & program configuration */
|
/* Arguments & program configuration */
|
||||||
#define OPTIONS "Aa:c:C:f:hi:k:K:l:o:p:t:v" // getopt string
|
#define OPTIONS "Aa:c:C:f:hi:k:K:l:o:p:t:vV" // getopt string
|
||||||
#define DEFAULT_CONFIG_FILE "/usr/local/etc/owlps/owlps-aggregator.conf"
|
#define DEFAULT_CONFIG_FILE "/usr/local/etc/owlps/owlps-aggregator.conf"
|
||||||
#define DEFAULT_AGGREGATE_TIMEOUT 1500 // milliseconds
|
#define DEFAULT_AGGREGATE_TIMEOUT 1500 // milliseconds
|
||||||
#define DEFAULT_KEEP_TIMEOUT 3000 // milliseconds
|
#define DEFAULT_KEEP_TIMEOUT 3000 // milliseconds
|
||||||
|
@ -112,5 +112,6 @@ void order_send(ap_list *ap) ;
|
||||||
void free_ap_list(void) ;
|
void free_ap_list(void) ;
|
||||||
|
|
||||||
void print_usage(void) ;
|
void print_usage(void) ;
|
||||||
|
void print_version(void) ;
|
||||||
|
|
||||||
#endif // _OWLPS_AGGREGATOR_H_
|
#endif // _OWLPS_AGGREGATOR_H_
|
||||||
|
|
|
@ -190,7 +190,7 @@ void parse_config_file(int argc, char **argv)
|
||||||
|
|
||||||
char *config_file = NULL ; // Configuration file name
|
char *config_file = NULL ; // Configuration file name
|
||||||
|
|
||||||
// Option -f specifies a config file, -h exits the
|
// Option -f specifies a config file, options -h and -V exit the
|
||||||
// program, so we search for them first
|
// program, so we search for them first
|
||||||
int opt ;
|
int opt ;
|
||||||
while ((opt = getopt(argc, argv, OPTIONS)) != -1)
|
while ((opt = getopt(argc, argv, OPTIONS)) != -1)
|
||||||
|
@ -204,6 +204,9 @@ void parse_config_file(int argc, char **argv)
|
||||||
case 'h' :
|
case 'h' :
|
||||||
print_usage() ;
|
print_usage() ;
|
||||||
exit(0) ;
|
exit(0) ;
|
||||||
|
case 'V' :
|
||||||
|
print_version() ;
|
||||||
|
exit(0) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1239,9 +1242,12 @@ void print_usage()
|
||||||
" [-K ap_keep_timeout]"
|
" [-K ap_keep_timeout]"
|
||||||
" [-C ap_check_interval]"
|
" [-C ap_check_interval]"
|
||||||
"\n"
|
"\n"
|
||||||
|
"\t%s -h\n"
|
||||||
|
"\t%s -V\n"
|
||||||
|
|
||||||
"Main options:\n"
|
"Main options:\n"
|
||||||
"\t-h\t\tPrint this help.\n"
|
"\t-h\t\tPrint this help.\n"
|
||||||
|
"\t-V\t\tShow version information.\n"
|
||||||
"\t-f config_file\tUse 'config_file' instead of the default"
|
"\t-f config_file\tUse 'config_file' instead of the default"
|
||||||
" configuration file (%s).\n"
|
" configuration file (%s).\n"
|
||||||
"\t-v\t\tBe verbose (print detailed info on each received"
|
"\t-v\t\tBe verbose (print detailed info on each received"
|
||||||
|
@ -1260,7 +1266,7 @@ void print_usage()
|
||||||
" treated (default: %d).\n"
|
" treated (default: %d).\n"
|
||||||
"\t-t aggregate_timeout\tRequests are stored during"
|
"\t-t aggregate_timeout\tRequests are stored during"
|
||||||
" 'aggregate_timeout' milliseconds before to be grouped"
|
" 'aggregate_timeout' milliseconds before to be grouped"
|
||||||
" (default: %d ms).\n"
|
" (default: %d ms).\n"
|
||||||
"\t-k keep_timeout\t\tAggregated requests are kept during"
|
"\t-k keep_timeout\t\tAggregated requests are kept during"
|
||||||
" 'keep_timeout' milliseconds (default: %d ms).\n"
|
" 'keep_timeout' milliseconds (default: %d ms).\n"
|
||||||
"\t-c check_interval\tTime between two checks of the stored"
|
"\t-c check_interval\tTime between two checks of the stored"
|
||||||
|
@ -1276,6 +1282,8 @@ void print_usage()
|
||||||
" checks of the stored APs (default: %d ms).\n"
|
" checks of the stored APs (default: %d ms).\n"
|
||||||
,
|
,
|
||||||
program_name,
|
program_name,
|
||||||
|
program_name,
|
||||||
|
program_name,
|
||||||
DEFAULT_CONFIG_FILE,
|
DEFAULT_CONFIG_FILE,
|
||||||
POSITIONER_DEFAULT_IP,
|
POSITIONER_DEFAULT_IP,
|
||||||
POSITIONER_DEFAULT_PORT,
|
POSITIONER_DEFAULT_PORT,
|
||||||
|
@ -1288,3 +1296,17 @@ void print_usage()
|
||||||
DEFAULT_AP_CHECK_INTERVAL
|
DEFAULT_AP_CHECK_INTERVAL
|
||||||
) ;
|
) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void print_version()
|
||||||
|
{
|
||||||
|
printf("This is OwlPS Aggregator, part of the Open Wireless"
|
||||||
|
" Positioning System project.\n"
|
||||||
|
"Version: %s.\n",
|
||||||
|
#ifdef OWLPS_VERSION
|
||||||
|
OWLPS_VERSION
|
||||||
|
#else // OWLPS_VERSION
|
||||||
|
"unknown version"
|
||||||
|
#endif // OWLPS_VERSION
|
||||||
|
) ;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue