diff options
| author | luqiuwen <[email protected]> | 2019-06-22 21:03:33 +0800 |
|---|---|---|
| committer | luqiuwen <[email protected]> | 2019-06-22 21:03:33 +0800 |
| commit | c7ecf014275efdf7650edf1c560520e89880a247 (patch) | |
| tree | 40d5ab44fabba4dc45f967b33a47ae231fbab992 /platform/src/proxy.cpp | |
| parent | aa276e99cf2db5423ab604d42b77e3fd3e33773f (diff) | |
增加命令行查询版本号的功能v4.0.1-20190622
Diffstat (limited to 'platform/src/proxy.cpp')
| -rw-r--r-- | platform/src/proxy.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/platform/src/proxy.cpp b/platform/src/proxy.cpp index d623291..7f9b136 100644 --- a/platform/src/proxy.cpp +++ b/platform/src/proxy.cpp @@ -14,6 +14,7 @@ #include <string.h> #include <errno.h> #include <pthread.h> +#include <getopt.h> #include <event2/event.h> #include <event2/dns.h> @@ -379,7 +380,21 @@ int main(int argc, char * argv[]) const char * main_profile = "./conf/tfe/tfe.conf"; const char * future_profile= "./conf/tfe/future.conf"; - /* adds locking, only required if accessed from separate threads */ + int ret = 0; + int opt = 0; + while ((opt = getopt(argc, argv, "v")) != -1) + { + switch (opt) + { + case 'v': + fprintf(stderr, "Tango Frontend Engine, Version: %s\n", tfe_version()); + return 0; + default: + break; + } + } + + /* adds locking, only required if accessed from separate threads */ evthread_use_pthreads(); unsigned int __log_level = RLOG_LV_INFO; @@ -402,8 +417,9 @@ int main(int argc, char * argv[]) g_default_proxy = ALLOC(struct tfe_proxy, 1); assert(g_default_proxy); strcpy(g_default_proxy->name, "tfe3a"); + /* CONFIG */ - int ret = tfe_proxy_config(g_default_proxy, main_profile); + ret = tfe_proxy_config(g_default_proxy, main_profile); CHECK_OR_EXIT(ret == 0, "Failed at loading profile %s, Exit.", main_profile); /* PERFOMANCE MONITOR */ |
