summaryrefslogtreecommitdiff
path: root/nslcd
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2014-12-16 14:33:52 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2014-12-16 14:33:52 -0500
commitb64145d71d09e64b2d5de3f99c7c695229aed897 (patch)
treefbf09df1df74d7991eaf94e9c0f52e3ff7bc07a8 /nslcd
parent79602e4b19dcb35febc5b3fd2ee8e6a65c1b701b (diff)
use stdbool
Diffstat (limited to 'nslcd')
-rw-r--r--nslcd/cfg.c15
-rw-r--r--nslcd/cfg.h5
-rw-r--r--nslcd/common.h1
3 files changed, 12 insertions, 9 deletions
diff --git a/nslcd/cfg.c b/nslcd/cfg.c
index b0a4847..45dc246 100644
--- a/nslcd/cfg.c
+++ b/nslcd/cfg.c
@@ -25,6 +25,7 @@
#include "config.h"
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -160,16 +161,16 @@ static int get_int(const char *filename, int lnr,
return atoi(token);
}
-static int parse_boolean(const char *filename, int lnr, const char *value)
+static bool parse_boolean(const char *filename, int lnr, const char *value)
{
if ((strcasecmp(value, "on") == 0) ||
(strcasecmp(value, "yes") == 0) ||
(strcasecmp(value, "true") == 0) || (strcasecmp(value, "1") == 0))
- return 1;
+ return true;
else if ((strcasecmp(value, "off") == 0) ||
(strcasecmp(value, "no") == 0) ||
(strcasecmp(value, "false") == 0) || (strcasecmp(value, "0") == 0))
- return 0;
+ return false;
else
{
log_log(LOG_ERR, "%s:%d: not a boolean argument: '%s'",
@@ -178,7 +179,7 @@ static int parse_boolean(const char *filename, int lnr, const char *value)
}
}
-static int get_boolean(const char *filename, int lnr,
+static bool get_boolean(const char *filename, int lnr,
const char *keyword, char **line)
{
char token[32];
@@ -187,10 +188,10 @@ static int get_boolean(const char *filename, int lnr,
return parse_boolean(filename, lnr, token);
}
-static const char *print_boolean(int bool)
+static const char *print_boolean(bool val)
{
- if (bool) return "yes";
- else return "no";
+ if (val) return "yes";
+ else return "no";
}
static int parse_loglevel(const char *filename, int lnr, const char *value)
diff --git a/nslcd/cfg.h b/nslcd/cfg.h
index 7e3e6ed..9a76084 100644
--- a/nslcd/cfg.h
+++ b/nslcd/cfg.h
@@ -27,6 +27,7 @@
#define NSLCD__CFG_H
#include <regex.h>
+#include <stdbool.h>
#include "compat/attrs.h"
#include "common/set.h"
@@ -56,10 +57,10 @@ struct nslcd_config {
int pagesize; /* set to a greater than 0 to enable handling of paged results with the specified size */
SET *nss_initgroups_ignoreusers; /* the users for which no initgroups() searches should be done */
uid_t nss_min_uid; /* minimum uid for users retrieved */
- int nss_nested_groups; /* whether to expand nested groups */
+ bool nss_nested_groups; /* whether to expand nested groups */
regex_t validnames; /* the regular expression to determine valid names */
char *validnames_str; /* string version of validnames regexp */
- int ignorecase; /* whether or not case should be ignored in lookups */
+ bool ignorecase; /* whether or not case should be ignored in lookups */
char *pam_password_prohibit_message; /* whether password changing should be denied and user prompted with this message */
char reconnect_invalidate[LM_NONE]; /* set to 1 if the corresponding map should be invalidated */
};
diff --git a/nslcd/common.h b/nslcd/common.h
index 61b2112..9364031 100644
--- a/nslcd/common.h
+++ b/nslcd/common.h
@@ -31,6 +31,7 @@
#include <stdint.h>
#endif /* HAVE_STDINT_H */
#include <sys/types.h>
+#include <stdbool.h>
#include "nslcd.h"
#include "common/nslcd-prot.h"