[sr-dev] git:master:04fffc77: pdbt and pdb_server: add version output to help and as a dedicated switch
Henning Westerholt
hw at kamailio.org
Wed Jun 20 17:44:26 CEST 2018
Module: kamailio
Branch: master
Commit: 04fffc77bb0dba4c13d76347a3352894b2821846
URL: https://github.com/kamailio/kamailio/commit/04fffc77bb0dba4c13d76347a3352894b2821846
Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2018-06-20T17:43:43+02:00
pdbt and pdb_server: add version output to help and as a dedicated switch
---
Modified: utils/pdbt/pdb_server.c
Modified: utils/pdbt/pdbt.c
---
Diff: https://github.com/kamailio/kamailio/commit/04fffc77bb0dba4c13d76347a3352894b2821846.diff
Patch: https://github.com/kamailio/kamailio/commit/04fffc77bb0dba4c13d76347a3352894b2821846.patch
---
diff --git a/utils/pdbt/pdb_server.c b/utils/pdbt/pdb_server.c
index 4dac0ce13a..7f25cb01ae 100644
--- a/utils/pdbt/pdb_server.c
+++ b/utils/pdbt/pdb_server.c
@@ -40,8 +40,8 @@
void print_usage(char *program) {
set_log_level(LOG_INFO);
- LINFO("Listens on a UDP port for queries and sends answer UDP\n");
- LINFO("packets back.\n");
+ LINFO("version: pdb_server %d\n", PDB_VERSION);
+ LINFO("Listens on a UDP port for queries and sends answer UDP packets back.\n");
LINFO("\n");
LINFO("Usage: %s [<option>...]\n", program);
LINFO(" %s -m <data file> [-i <bind addr>] [-p <port>] [-d <log level>]\n", program);
@@ -62,6 +62,7 @@ void print_usage(char *program) {
LINFO(" %ld for emergency level.\n", LOG_EMERG);
LINFO(" %ld to disable all messages.\n", LOG_EMERG-1);
LINFO(" Default is warning level.\n");
+ LINFO(" -v: Print the version\n");
LINFO(" -h: Print this help.\n");
}
@@ -212,7 +213,7 @@ int main(int argc, char *argv[]) {
int so;
struct sockaddr_in sa;
- while ((opt = getopt(argc, argv, "m:i:p:hdl:")) != -1) {
+ while ((opt = getopt(argc, argv, "m:i:p:vhdl:")) != -1) {
switch (opt) {
case 'm':
backend_data_filename = optarg;
@@ -229,6 +230,11 @@ int main(int argc, char *argv[]) {
}
bind_port=ret;
break;
+ case 'v':
+ set_log_level(LOG_INFO);
+ LINFO("version: pdb_server %d\n", PDB_VERSION);
+ return 0;
+ break;
case 'h':
init_log("pdb_server", use_syslog);
print_usage(argv[0]);
diff --git a/utils/pdbt/pdbt.c b/utils/pdbt/pdbt.c
index afd36956b2..6521985b2b 100644
--- a/utils/pdbt/pdbt.c
+++ b/utils/pdbt/pdbt.c
@@ -50,6 +50,7 @@ typedef int (*query_func_t)(char *number, char *comment, void *data);
void print_usage(char *program) {
set_log_level(LOG_INFO);
+ LINFO("version: pdbt %d\n", PDB_VERSION);
LINFO("Usage: %s [<option>...] <command> [<param>...]\n", program);
LINFO(" %s -s <csv file> -m <mmap file> [-k <ids>] [-o] [-u <tree file>] [-l <log level>] build\n", program);
LINFO(" %s (-m <mmap file>|-r <host>:<port>) [-q <timeout>] [-f <query file>] [-t <carrier text file>] [-l <log level>] query <number>...\n", program);
@@ -93,6 +94,7 @@ void print_usage(char *program) {
LINFO(" %ld for emergency level.\n", LOG_EMERG);
LINFO(" %ld to disable all messages.\n", LOG_EMERG-1);
LINFO(" Default is info level.\n");
+ LINFO(" -v: Print the version\n");
LINFO(" -h: Print this help.\n");
}
@@ -678,7 +680,7 @@ int main(int argc, char *argv[]) {
init_log("pdbt", 0);
- while ((opt = getopt(argc, argv, "s:m:f:u:t:r:q:k:ol:h")) != -1) {
+ while ((opt = getopt(argc, argv, "s:m:f:u:t:r:q:k:ol:vh")) != -1) {
switch (opt) {
case 's':
csv_file = optarg;
@@ -752,6 +754,11 @@ int main(int argc, char *argv[]) {
}
log_level=ret;
break;
+ case 'v':
+ set_log_level(LOG_INFO);
+ LINFO("version: pdbt %d\n", PDB_VERSION);
+ return 0;
+ break;
case 'h':
print_usage(argv[0]);
return 0;
More information about the sr-dev
mailing list