diff options
author | 4-FLOSS-Free-Libre-Open-Source-Software <46166740+4-FLOSS-Free-Libre-Open-Source-Software@users.noreply.github.com> | 2019-07-19 14:00:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-19 14:00:25 +0200 |
commit | 53d22e59ad08799c54fb8021954fd267deddfc5d (patch) | |
tree | 84a3c61911ca1f99184339f798d31a3c3f1afe51 | |
parent | 05082ae12051821b1d969e6672d9e4e5afe1bc07 (diff) | |
download | twinkle-53d22e59ad08799c54fb8021954fd267deddfc5d.tar twinkle-53d22e59ad08799c54fb8021954fd267deddfc5d.tar.gz twinkle-53d22e59ad08799c54fb8021954fd267deddfc5d.tar.lz twinkle-53d22e59ad08799c54fb8021954fd267deddfc5d.tar.xz twinkle-53d22e59ad08799c54fb8021954fd267deddfc5d.zip |
Add twinkle-console option --sip-port --rtp-port
-rw-r--r-- | src/main.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 20ee366..d8d363f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -241,14 +241,33 @@ int main(int argc, char *argv[]) { // Take default user profile if there are is no default is sys settings if (config_files.empty()) config_files.push_back(USER_CONFIG_FILE); - // Read user configurations. if (argc >= 2) { config_files.clear(); - for (int i = 1; i < argc; i++) { + for (int i = 1; i < argc && i < 2; i++) { config_files.push_back(argv[i]); } } + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "--sip-port") == 0) { + if (i < argc - 1) { + i++; + sys_config->set_override_sip_port(atoi(argv[i])); + } else { + cout << argv[0] << ": "; + cout << "Port missing for option '--sip-port'\n"; + } + } else if (strcmp(argv[i], "--rtp-port") == 0) { + if (i < argc - 1) { + i++; + sys_config->set_override_rtp_port(atoi(argv[i])); + } else { + cout << argv[0] << ": "; + cout << "Port missing for option '--rtp-port'\n"; + } + } + } + // Activate users for (list<string>::iterator i = config_files.begin(); i != config_files.end(); i++) |