From d3981804f31fb842d37607c7db58f9b977ba366e Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 21 Oct 2011 14:30:36 +0200 Subject: added some config possibilities --- src/main.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index e408a33..2df76a6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -53,7 +53,12 @@ int main(int argc, char *argv[]) { required_argument, NULL, 'u' }, { "download", required_argument, NULL, 'd' }, { "serial", required_argument, NULL, 's' }, { "trigger", required_argument, NULL, 't' }, { "debug", required_argument, NULL, 'D' }, { "help", no_argument, NULL, 'h' }, { "log", - required_argument, NULL, 'l' } }; + required_argument, NULL, 'l' }, + { "server", required_argument, NULL, 'S' }, + { "autoup", no_argument, NULL, 'a' }, + { "socketserverpath", required_argument, NULL, 'p' }, + { "pathtoexe", required_argument, NULL, 'e' } + }; int opt = getopt_long(argc, argv, optString, longOpts, &longIndex); while (opt != -1) { switch (opt) { @@ -81,6 +86,18 @@ int main(int argc, char *argv[]) { case 'h': clOpts.insert("help", "help"); break; + case 'S': + clOpts.insert("server", optarg); + break; + case 'a': + clOpts.insert("autoup", "autoup"); + break; + case 'p': + clOpts.insert("socketserverpath", optarg); + break; + case 'e': + clOpts.insert("pathtoexe", optarg); + break; } opt = getopt_long(argc, argv, optString, longOpts, &longIndex); } @@ -175,6 +192,32 @@ int main(int argc, char *argv[]) { else logFilePath = DEFAULT_LOG_FILE_PATH; + // + if (clOpts.contains("server")) + gServerIp = clOpts.value("server"); + else + gServerIp = "209.85.148.105"; //that is a google server. change this to a proper default address + + // + if (clOpts.contains("autoup")) + gAutoUp = true; + else + gAutoUp = false; + + // + if (clOpts.contains("socketserverpath")) + gSocketServerPath = clOpts.value("socketserverpath"); + else + gSocketServerPath = DEFAULT_QTSOCKETADDRESS; + + // + if (clOpts.contains("pathtoexe")) + gPathToDhcpExe = clOpts.value("pathtoexe"); + else + gPathToDhcpExe = DEFAULT_PATHTODHCPCDEXE; + + + // write always a log file // // activate file logger if debug mode activated. // if (debugMode > -1) { -- cgit v1.2.3-55-g7522