Module: kamailio Branch: master Commit: 38d61e4c7cc35f0b0b8fffc7725a882bff3e79b1 URL: https://github.com/kamailio/kamailio/commit/38d61e4c7cc35f0b0b8fffc7725a882b...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2019-05-14T17:00:07+02:00
core: command line parameters for adding substdef and substdefs
* --substdef="expression" - like a #!substdef "expression" * --substdefis="expression" - like a #!substdefs "expression"
---
Modified: src/main.c
---
Diff: https://github.com/kamailio/kamailio/commit/38d61e4c7cc35f0b0b8fffc7725a882b... Patch: https://github.com/kamailio/kamailio/commit/38d61e4c7cc35f0b0b8fffc7725a882b...
---
diff --git a/src/main.c b/src/main.c index a97fb6dba0..e124f6857e 100644 --- a/src/main.c +++ b/src/main.c @@ -204,6 +204,8 @@ Options:\n\ #ifdef STATS " -s file File where to write internal statistics on SIGUSR1\n" #endif +" --substdef=exp set a substdef preprocessor directive\n\ + --substdefs=exp set a substdefs preprocessor directive\n" #ifdef USE_SCTP " -S disable sctp\n" #endif @@ -1899,7 +1901,9 @@ int main(int argc, char** argv) {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, /* long options without short variant */ - {"alias", required_argument, 0, KARGOPTVAL}, + {"alias", required_argument, 0, KARGOPTVAL}, + {"substdef", required_argument, 0, KARGOPTVAL + 1}, + {"substdefs", required_argument, 0, KARGOPTVAL + 2}, {0, 0, 0, 0 } };
@@ -2133,6 +2137,18 @@ int main(int argc, char** argv) goto error; } break; + case KARGOPTVAL+1: + if(pp_substdef_add(optarg, 0)<0) { + LM_ERR("failed to add substdef: %s\n", optarg); + goto error; + } + break; + case KARGOPTVAL+2: + if(pp_substdef_add(optarg, 1)<0) { + LM_ERR("failed to add substdefs: %s\n", optarg); + goto error; + } + break;
/* special cases */ case '?':