From 298e7bff0718eb01c51d671140191e2b99869779 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 18 Jan 2009 21:07:36 +0100 Subject: [PATCH] src/common.h: Add the IS_TRUE and IS_FALSE macros. They should be used to check if a string is "true|yes|on" or "false|no|off" from now on. --- src/common.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common.h b/src/common.h index aefc2cc6..d372872a 100644 --- 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); -- 2.11.0