summaryrefslogtreecommitdiff
path: root/access/src/main.cpp
diff options
context:
space:
mode:
author崔一鸣 <[email protected]>2018-12-09 22:25:34 +0800
committer崔一鸣 <[email protected]>2018-12-09 22:25:34 +0800
commit1e16fbaf51236ffcb6b0ed5e272c28c3ea8cb0e2 (patch)
tree1c724cc6daca9503d18d973b5da0730936ae0670 /access/src/main.cpp
parent218e00b13e68f327bf3a01a78989d47f2746f85a (diff)
添加systemd启动脚本
Diffstat (limited to 'access/src/main.cpp')
-rw-r--r--access/src/main.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/access/src/main.cpp b/access/src/main.cpp
index 9d2be8e..cfdd20a 100644
--- a/access/src/main.cpp
+++ b/access/src/main.cpp
@@ -250,11 +250,12 @@ static struct field_stat_handle * fs_init(const char *profile, void *logger)
}
-static struct mgw_handle * mgw_init()
+static struct mgw_handle * mgw_init(char *conf_path)
{
struct mgw_handle *_mgw_handle = ALLOC(struct mgw_handle, 1);
char *profile = ALLOC(char, MGW_SYMBOL_MAX);
- strncpy(profile, "./conf/mgw.conf", MGW_SYMBOL_MAX);
+ strncpy(profile, conf_path, MGW_SYMBOL_MAX);
+ printf("profile is %s\n", profile);
const char *section = "global";
//init srand
@@ -429,7 +430,12 @@ static void mgw_run(struct mgw_handle *handle)
int main(int argc, char* argv[])
{
- struct mgw_handle *handle = mgw_init();
+ char *conf_path = (char *)"./conf/mgw.conf";
+ if(argc > 1)
+ {
+ conf_path = argv[1];
+ }
+ struct mgw_handle *handle = mgw_init(conf_path);
mgw_run(handle);
mgw_destroy(handle);
}