about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-01-31 06:46:39 +0000
committerEric Wong <normalperson@yhbt.net>2013-01-31 06:46:39 +0000
commit459d163514766653d28d8964a7e2e25d27f7c873 (patch)
tree052b9ef1a16ddc24a0b2098391fe48546fd8d87e
parentdffe6b3dc226cafb0a6107443f9d7e23095dd789 (diff)
downloadcmogstored-459d163514766653d28d8964a7e2e25d27f7c873.tar.gz
This project uses C99 features (and some GNU extensions),
so bool is usable.
-rw-r--r--cfg.h2
-rw-r--r--cfg_parser.rl2
-rw-r--r--cmogstored.c2
-rw-r--r--test/cfg-parser-1.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/cfg.h b/cfg.h
index 657b613..bf65d29 100644
--- a/cfg.h
+++ b/cfg.h
@@ -5,7 +5,7 @@
 struct mog_svc;
 struct mog_cfg {
         const char *docroot;
-        int daemonize;
+        bool daemonize;
         unsigned long maxconns;
         const char *pidfile;
         const char *configfile;
diff --git a/cfg_parser.rl b/cfg_parser.rl
index 843a216..0c495f7 100644
--- a/cfg_parser.rl
+++ b/cfg_parser.rl
@@ -63,7 +63,7 @@ static char *mystrdup(const char *key, char *mark_beg, const char *p)
                 cfg->pidfile = mystrdup("pidfile", mark_beg, fpc);
                 if (!cfg->pidfile) return -1;
         };
-        daemonize = lws* "daemonize" comment* eor > { cfg->daemonize = 1; };
+        daemonize = lws* "daemonize" comment* eor > { cfg->daemonize = true; };
         maxconns = lws* "maxconns" sep
                 (digit+) > { mark_beg = fpc; }
                 (comment* eor) > {
diff --git a/cmogstored.c b/cmogstored.c
index 5d8b61c..c96ee0b 100644
--- a/cmogstored.c
+++ b/cmogstored.c
@@ -105,7 +105,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
         int rv = 0;
 
         switch (key) {
-        case 'd': cfg->daemonize = 1; break;
+        case 'd': cfg->daemonize = true; break;
         case 's': /* no-op, we don't load the default config file */; break;
         case CFG_KEY(docroot): cfg->docroot = xstrdup(arg); break;
         case CFG_KEY(pidfile): cfg->pidfile = xstrdup(arg); break;
diff --git a/test/cfg-parser-1.c b/test/cfg-parser-1.c
index 2bd5e2a..af3e176 100644
--- a/test/cfg-parser-1.c
+++ b/test/cfg-parser-1.c
@@ -61,7 +61,7 @@ int main(void)
                 assert(cfg.httplisten && "httplisten unset");
                 assert(cfg.mgmtlisten && "mgmtlisten set");
                 assert(cfg.httpgetlisten && "httpgetlisten set");
-                assert(cfg.daemonize == 1 && "daemonize set");
+                assert(cfg.daemonize && "daemonize set");
                 assert(cfg.maxconns == 666666 && "maxconns set");
                 assert(cfg.docroot && "docroot set");
                 assert(strcmp(cfg.docroot, "/var/mogdata") == 0 &&