From 757a8cd063d57fa1dc7628cac5e8cde9d45c10b9 Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Sun, 20 Dec 2015 00:32:18 +0300 Subject: [PATCH] daemon option --- linux/pulsecounter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linux/pulsecounter.c b/linux/pulsecounter.c index 77c77bb..89568c9 100644 --- a/linux/pulsecounter.c +++ b/linux/pulsecounter.c @@ -33,6 +33,7 @@ static int opt_mtu = 0; static int opt_psm = 0; static char *opt_sec_level = NULL; static char *opt_dbconffile = NULL; +static gboolean opt_daemon = FALSE; static GMainLoop *event_loop; @@ -49,7 +50,9 @@ static GOptionEntry options[] = { "Specify the PSM for GATT/ATT over BR/EDR", "PSM" }, { "sec-level", 'l', 0, G_OPTION_ARG_STRING, &opt_sec_level, "Set security level. Default: low", "[low | medium | high]"}, - { "dbconfig", 'c', 0, G_OPTION_ARG_STRING, &opt_dbconffile, + { "dbconfig", 'c', 0, G_OPTION_ARG_FILENAME, &opt_dbconffile, + "Specify file name with database configuration", "cfile"}, + { "daemon", 'd', 0, G_OPTION_ARG_NONE, &opt_daemon, "Specify file name with database configuration", "cfile"}, { NULL }, }; @@ -175,6 +178,7 @@ int main(int argc, char *argv[]) got_error = TRUE; goto done; } + if (opt_daemon) daemon(0, 0); while (1) { chan = gatt_connect(opt_src, opt_dst, opt_dst_type, opt_sec_level, opt_psm, opt_mtu, connect_cb, &gerr); -- 2.39.2