2019-05-05 13:38:48 +00:00
|
|
|
#include <iostream>
|
2019-08-02 20:44:42 +00:00
|
|
|
#include <IPRefresher.h>
|
2019-10-26 12:41:43 +00:00
|
|
|
#include <Version.h>
|
|
|
|
#include <Logger.h>
|
2019-05-05 13:38:48 +00:00
|
|
|
|
2019-05-06 10:55:01 +00:00
|
|
|
int main(int argc, char *argv[]) {
|
2019-05-06 16:49:38 +00:00
|
|
|
if (argc > 1) {
|
2019-05-06 10:55:01 +00:00
|
|
|
std::string firstarg(argv[1]);
|
2019-05-06 16:49:38 +00:00
|
|
|
if (firstarg == "-h" || firstarg == "--help") {
|
|
|
|
std::cout << "help page: " << std::endl << "[-h] [--help] print this help page" << std::endl
|
|
|
|
<< "[-v] [--version] print the software version" << std::endl
|
2019-10-23 07:24:35 +00:00
|
|
|
<< "[-f] [--force] force refresh of ip" << std::endl
|
|
|
|
<< "[-l] [--loop] infinite loop to refresh ip every five minutes" << std::endl
|
2019-05-06 16:49:38 +00:00
|
|
|
<< "[no argument] normal ip check and refresh" << std::endl;
|
|
|
|
} else if (firstarg == "-v" || firstarg == "--version") {
|
2019-10-26 12:41:43 +00:00
|
|
|
Logger::message("Version "+Version::VERSION);
|
2019-10-23 07:24:35 +00:00
|
|
|
} else if (firstarg == "-f" || firstarg == "--force") {
|
|
|
|
IPRefresher ipr;
|
|
|
|
ipr.checkIPAdress(true);
|
|
|
|
} else if (firstarg == "-l" || firstarg == "--loop") {
|
|
|
|
IPRefresher ipr(true);
|
2019-05-06 16:49:38 +00:00
|
|
|
} else {
|
2019-10-26 12:41:43 +00:00
|
|
|
Logger::message("wrong arguments! -h for help");
|
2019-05-06 10:55:01 +00:00
|
|
|
}
|
2019-05-06 16:49:38 +00:00
|
|
|
} else {
|
2019-08-02 20:44:42 +00:00
|
|
|
IPRefresher ipr;
|
2019-10-26 12:41:43 +00:00
|
|
|
Logger::message("starting check");
|
2019-10-23 07:24:35 +00:00
|
|
|
ipr.checkIPAdress(false);
|
|
|
|
|
2019-05-05 16:50:10 +00:00
|
|
|
}
|
2019-05-05 13:38:48 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|