Compile without warnings on NetBSD

This commit is contained in:
Roy Marples 2008-01-09 23:22:04 +00:00
parent 06634f6309
commit ddf25cbcb7
6 changed files with 35 additions and 15 deletions

View File

@ -30,13 +30,16 @@
*/
#include <sys/types.h>
#if defined(__DragonFly__) || defined(__FreeBSD__) || \
defined(__NetBSD__) || defined(__OpenBSD__)
#define BSD
#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
#if defined(__DragonFly__) || defined(__FreeBSD__)
# include <sys/ucred.h>
# include <sys/mount.h>
# define F_FLAGS f_flags
#elif defined(BSD)
# include <sys/statvfs.h>
# define statfs statvfs
# define F_FLAGS f_flag
#elif defined (__linux__)
#include <mntent.h>
#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)

View File

@ -31,6 +31,7 @@
*/
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <fcntl.h>
@ -44,6 +45,8 @@
#ifdef __linux__
# include <pty.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
# include <util.h>
#else
# include <libutil.h>
#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++;

View File

@ -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++;
}
}

View File

@ -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);

View File

@ -49,6 +49,8 @@
#ifdef __linux__
# include <pty.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
# include <util.h>
#else
# include <libutil.h>
#endif

View File

@ -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)