projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0b6de87
)
src/common.h: Add the IS_TRUE and IS_FALSE macros.
author
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Sun, 18 Jan 2009 20:07:36 +0000
(21:07 +0100)
committer
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Sun, 18 Jan 2009 20:07:36 +0000
(21:07 +0100)
They should be used to check if a string is "true|yes|on" or
"false|no|off" from now on.
src/common.h
patch
|
blob
|
history
diff --git
a/src/common.h
b/src/common.h
index
aefc2cc
..
d372872
100644
(file)
--- a/
src/common.h
+++ b/
src/common.h
@@
-40,6
+40,13
@@
#define STATIC_ARRAY_SIZE(a) (sizeof (a) / sizeof (*(a)))
+#define IS_TRUE(s) ((strcasecmp ("true", (s)) == 0) \
+ || (strcasecmp ("yes", (s)) == 0) \
+ || (strcasecmp ("on", (s)) == 0))
+#define IS_FALSE(s) ((strcasecmp ("false", (s)) == 0) \
+ || (strcasecmp ("no", (s)) == 0) \
+ || (strcasecmp ("off", (s)) == 0))
+
char *sstrncpy (char *dest, const char *src, size_t n);
int ssnprintf (char *dest, size_t n, const char *format, ...);
char *sstrdup(const char *s);