From dfdc37e2fe2bad3d33c48afa95326a3467a7a12f Mon Sep 17 00:00:00 2001 From: dsl Date: Sat, 30 Oct 2004 20:56:20 +0000 Subject: [PATCH] Add (unsigned char) cast to ctype functions --- usr.bin/netstat/main.c | 6 +++--- usr.bin/newsyslog/newsyslog.c | 25 +++++++++++-------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 484ca0841ce0..906c6f2fbe85 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.47 2004/09/04 23:35:43 manu Exp $ */ +/* $NetBSD: main.c,v 1.48 2004/10/30 20:56:20 dsl Exp $ */ /* * Copyright (c) 1983, 1988, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n\ #if 0 static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94"; #else -__RCSID("$NetBSD: main.c,v 1.47 2004/09/04 23:35:43 manu Exp $"); +__RCSID("$NetBSD: main.c,v 1.48 2004/10/30 20:56:20 dsl Exp $"); #endif #endif /* not lint */ @@ -494,7 +494,7 @@ main(argc, argv) #define BACKWARD_COMPATIBILITY #ifdef BACKWARD_COMPATIBILITY if (*argv) { - if (isdigit(**argv)) { + if (isdigit((unsigned char)**argv)) { interval = atoi(*argv); if (interval <= 0) usage(); diff --git a/usr.bin/newsyslog/newsyslog.c b/usr.bin/newsyslog/newsyslog.c index fdb94eb2de61..46e28ada5428 100644 --- a/usr.bin/newsyslog/newsyslog.c +++ b/usr.bin/newsyslog/newsyslog.c @@ -1,4 +1,4 @@ -/* $NetBSD: newsyslog.c,v 1.47 2003/10/13 07:28:52 lukem Exp $ */ +/* $NetBSD: newsyslog.c,v 1.48 2004/10/30 21:03:36 dsl Exp $ */ /* * Copyright (c) 1999, 2000 Andrew Doran @@ -55,7 +55,7 @@ #include #ifndef lint -__RCSID("$NetBSD: newsyslog.c,v 1.47 2003/10/13 07:28:52 lukem Exp $"); +__RCSID("$NetBSD: newsyslog.c,v 1.48 2004/10/30 21:03:36 dsl Exp $"); #endif /* not lint */ #include @@ -297,17 +297,14 @@ parse_cfgline(struct conf_entry *log, FILE *fd, size_t *_lineno) } /* size */ - if (isdigit(**ap)) { + if (**ap == '*') + log->maxsize = (size_t)-1; + else { log->maxsize = (int)strtol(*ap, &q, 0); if (*q != '\0') { warnx("config line %d: bad log size", lineno); goto bad; } - } else if (**ap == '*') - log->maxsize = (size_t)-1; - else { - warnx("config line %d: bad log size", lineno); - goto bad; } ap++; @@ -317,7 +314,7 @@ parse_cfgline(struct conf_entry *log, FILE *fd, size_t *_lineno) q = *ap++; if (strcmp(q, "*") != 0) { - if (isdigit(*q)) + if (isdigit((unsigned char)*q)) log->maxage = (int)strtol(q, &q, 10); /* @@ -345,7 +342,7 @@ parse_cfgline(struct conf_entry *log, FILE *fd, size_t *_lineno) log->flags = (nosignal ? CE_NOSIGNAL : 0); for (q = *ap++; q != NULL && *q != '\0'; q++) { - switch (tolower(*q)) { + switch (tolower((unsigned char)*q)) { case 'b': log->flags |= CE_BINARY; break; @@ -713,7 +710,7 @@ int isnumber(const char *string) { - while (isdigit(*string)) + while (isdigit((unsigned char)*string)) string++; return (*string == '\0'); @@ -909,7 +906,7 @@ parse_dwm(char *s) return (-1); wmseen++; s++; - if (tolower(*s) == 'l') { + if (tolower((unsigned char)*s) == 'l') { tm.tm_mday = nd; s++; t = s; @@ -929,7 +926,7 @@ parse_dwm(char *s) break; } - if (*t == '\0' || isspace(*t)) + if (*t == '\0' || isspace((unsigned char)*t)) break; else s = t; @@ -1000,7 +997,7 @@ parse_iso8601(char *s) if (*t != '\0') { s = ++t; ul = strtoul(s, &t, 10); - if (*t != '\0' && !isspace(*t)) + if (*t != '\0' && !isspace((unsigned char)*t)) return ((time_t)-1); switch (t - s) {