From ddf25cbcb76bccbfe28d15f1e73c637becaa54e7 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 9 Jan 2008 23:22:04 +0000 Subject: [PATCH] Compile without warnings on NetBSD --- src/rc/mountinfo.c | 29 ++++++++++++++++++++++------- src/rc/rc-logger.c | 5 ++++- src/rc/rc-misc.c | 4 ++-- src/rc/rc.c | 8 ++++---- src/rc/runscript.c | 2 ++ src/rc/start-stop-daemon.c | 2 +- 6 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c index 05ce8dd7..e7e29578 100644 --- a/src/rc/mountinfo.c +++ b/src/rc/mountinfo.c @@ -30,13 +30,16 @@ */ #include - -#if defined(__DragonFly__) || defined(__FreeBSD__) || \ - defined(__NetBSD__) || defined(__OpenBSD__) -#define BSD #include -#include -#include + +#if defined(__DragonFly__) || defined(__FreeBSD__) +# include +# include +# define F_FLAGS f_flags +#elif defined(BSD) +# include +# define statfs statvfs +# define F_FLAGS f_flag #elif defined (__linux__) #include #endif @@ -180,17 +183,29 @@ static struct opt { { MNT_NOATIME, "noatime" }, { MNT_NOEXEC, "noexec" }, { MNT_NOSUID, "nosuid" }, +#ifdef MNT_NOSYMFOLLOW { MNT_NOSYMFOLLOW, "nosymfollow" }, +#endif { MNT_QUOTA, "with quotas" }, { MNT_RDONLY, "read-only" }, { MNT_SYNCHRONOUS, "synchronous" }, { MNT_UNION, "union" }, +#ifdef MNT_NOCLUSTERR { MNT_NOCLUSTERR, "noclusterr" }, +#endif +#ifdef MNT_NOCLUSTERW { MNT_NOCLUSTERW, "noclusterw" }, +#endif +#ifdef MNT_SUIDDIR { MNT_SUIDDIR, "suiddir" }, +#endif { MNT_SOFTDEP, "soft-updates" }, +#ifdef MNT_MULTILABEL { MNT_MULTILABEL, "multilabel" }, +#endif +#ifdef MNT_ACLS { MNT_ACLS, "acls" }, +#endif #ifdef MNT_GJOURNAL { MNT_GJOURNAL, "gjournal" }, #endif @@ -212,7 +227,7 @@ static char **find_mounts (struct args *args) for (i = 0; i < nmnts; i++) { int netdev = 0; - flags = mnts[i].f_flags & MNT_VISFLAGMASK; + flags = mnts[i].F_FLAGS & MNT_VISFLAGMASK; for (o = optnames; flags && o->o_opt; o++) { if (flags & o->o_opt) { if (o->o_opt == MNT_LOCAL) diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c index f4c610a2..0c48e444 100644 --- a/src/rc/rc-logger.c +++ b/src/rc/rc-logger.c @@ -31,6 +31,7 @@ */ #include +#include #include #include #include @@ -44,6 +45,8 @@ #ifdef __linux__ # include +#elif defined(__NetBSD__) || defined(__OpenBSD__) +# include #else # include #endif @@ -99,7 +102,7 @@ static void write_log (int logfd, const char *buffer, size_t bytes) continue; } - if (! in_term || isalpha (*p)) + if (! in_term || isalpha ((int) *p)) in_escape = in_term = false; cont: p++; diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index 79db4323..3cfbe175 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -82,8 +82,8 @@ char *rc_conf_value (const char *setting) STRLIST_FOREACH (rc_conf, line, i) { char *p = line; while (p && *p && *p != '=') { - if (isupper (*p)) - *p = tolower (*p); + if (isupper ((int) *p)) + *p = tolower ((int) *p); p++; } } diff --git a/src/rc/rc.c b/src/rc/rc.c index c94bf11f..015dd86f 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -183,7 +183,7 @@ static int syslog_decode (char *name, CODE *codetab) { CODE *c; - if (isdigit (*name)) + if (isdigit ((int) *name)) return (atoi (name)); for (c = codetab; c->c_name; c++) @@ -465,7 +465,7 @@ static int do_shell_var (int argc, char **argv) while (*p) { char c = *p++; - if (! isalnum (c)) + if (! isalnum ((int) c)) c = '_'; putchar (c); } @@ -1239,13 +1239,13 @@ int main (int argc, char **argv) /* The mice are a little more tricky. If we coldplug anything else, we'll probably do it here. */ - if ((dp == opendir ("/dev"))) { + if ((dp = opendir ("/dev"))) { while ((d = readdir (dp))) { if (strncmp (d->d_name, "psm", 3) == 0 || strncmp (d->d_name, "ums", 3) == 0) { char *p = d->d_name + 3; - if (p && isdigit (*p)) { + if (p && isdigit ((int) *p)) { i = (strlen ("moused.") + strlen (d->d_name) + 1); tmp = xmalloc (sizeof (char) * i); snprintf (tmp, i, "moused.%s", d->d_name); diff --git a/src/rc/runscript.c b/src/rc/runscript.c index 0e750c54..c688da43 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -49,6 +49,8 @@ #ifdef __linux__ # include +#elif defined(__NetBSD__) || defined(__OpenBSD__) +# include #else # include #endif diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index bf03dbec..e0c55386 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -181,7 +181,7 @@ static void parse_schedule_item (schedulelist_t *item, const char *string) if (strcmp (string,"forever") == 0) item->type = schedule_forever; - else if (isdigit (string[0])) { + else if (isdigit ((int) string[0])) { item->type = schedule_timeout; errno = 0; if (sscanf (string, "%d", &item->value) != 1)