From b64145d71d09e64b2d5de3f99c7c695229aed897 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 16 Dec 2014 14:33:52 -0500 Subject: use stdbool --- nslcd/cfg.c | 15 ++++++++------- nslcd/cfg.h | 5 +++-- nslcd/common.h | 1 + 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'nslcd') 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 #include #include #include @@ -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 +#include #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 #endif /* HAVE_STDINT_H */ #include +#include #include "nslcd.h" #include "common/nslcd-prot.h" -- cgit v1.2.2