summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/calendar/day.c10
-rw-r--r--usr.bin/calendar/io.c17
-rw-r--r--usr.bin/chpass/edit.c7
-rw-r--r--usr.bin/chpass/field.c6
-rw-r--r--usr.bin/column/column.c4
-rw-r--r--usr.bin/ctags/fortran.c18
-rw-r--r--usr.bin/ctags/lisp.c6
-rw-r--r--usr.bin/expand/expand.c5
-rw-r--r--usr.bin/finger/util.c6
-rw-r--r--usr.bin/fmt/fmt.c14
-rw-r--r--usr.bin/from/from.c16
-rw-r--r--usr.bin/fsplit/fsplit.c4
-rw-r--r--usr.bin/lastcomm/lastcomm.c4
-rw-r--r--usr.bin/leave/leave.c4
-rw-r--r--usr.bin/logger/logger.c4
-rw-r--r--usr.bin/look/look.c10
-rw-r--r--usr.bin/newsyslog/newsyslog.c17
-rw-r--r--usr.bin/nm/elf.c4
-rw-r--r--usr.bin/nm/nm.c4
-rw-r--r--usr.bin/patch/backupfile.c7
-rw-r--r--usr.bin/patch/inp.c9
-rw-r--r--usr.bin/patch/patch.c14
-rw-r--r--usr.bin/patch/pch.c53
-rw-r--r--usr.bin/patch/util.c10
-rw-r--r--usr.bin/pr/egetopt.c8
-rw-r--r--usr.bin/pr/pr.c14
-rw-r--r--usr.bin/quota/quota.c6
27 files changed, 146 insertions, 135 deletions
diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c
index 1bbddb7590f..4a164ba3062 100644
--- a/usr.bin/calendar/day.c
+++ b/usr.bin/calendar/day.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: day.c,v 1.26 2013/11/12 19:35:47 deraadt Exp $ */
+/* $OpenBSD: day.c,v 1.27 2013/11/26 13:18:53 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -88,7 +88,7 @@ setnnames(void)
for (i = 0; i < 7; i++) {
tm.tm_wday = i;
l = strftime(buf, sizeof(buf), "%a", &tm);
- for (; l > 0 && isspace((int)buf[l - 1]); l--)
+ for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--)
;
buf[l] = '\0';
if (ndays[i].name != NULL)
@@ -98,7 +98,7 @@ setnnames(void)
ndays[i].len = strlen(buf);
l = strftime(buf, sizeof(buf), "%A", &tm);
- for (; l > 0 && isspace((int)buf[l - 1]); l--)
+ for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--)
;
buf[l] = '\0';
if (fndays[i].name != NULL)
@@ -111,7 +111,7 @@ setnnames(void)
for (i = 0; i < 12; i++) {
tm.tm_mon = i;
l = strftime(buf, sizeof(buf), "%b", &tm);
- for (; l > 0 && isspace((int)buf[l - 1]); l--)
+ for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--)
;
buf[l] = '\0';
if (nmonths[i].name != NULL)
@@ -121,7 +121,7 @@ setnnames(void)
nmonths[i].len = strlen(buf);
l = strftime(buf, sizeof(buf), "%B", &tm);
- for (; l > 0 && isspace((int)buf[l - 1]); l--)
+ for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--)
;
buf[l] = '\0';
if (fnmonths[i].name != NULL)
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c
index 8cd3e94b01f..1d6ef58c8cf 100644
--- a/usr.bin/calendar/io.c
+++ b/usr.bin/calendar/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.35 2009/10/27 23:59:36 deraadt Exp $ */
+/* $OpenBSD: io.c,v 1.36 2013/11/26 13:18:53 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -222,26 +222,28 @@ getfield(char *p, char **endp, int *flags)
int val, var, i;
char *start, savech;
- for (; !isdigit(*p) && !isalpha(*p) && *p != '*' && *p != '\t'; ++p)
+ for (; !isdigit((unsigned char)*p) && !isalpha((unsigned char)*p) &&
+ *p != '*' && *p != '\t'; ++p)
;
if (*p == '*') { /* `*' is every month */
*flags |= F_ISMONTH;
*endp = p+1;
return (-1); /* means 'every month' */
}
- if (isdigit(*p)) {
+ if (isdigit((unsigned char)*p)) {
val = strtol(p, &p, 10); /* if 0, it's failure */
- for (; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p)
+ for (; !isdigit((unsigned char)*p) &&
+ !isalpha((unsigned char)*p) && *p != '*'; ++p)
;
*endp = p;
return (val);
}
- for (start = p; isalpha(*++p);)
+ for (start = p; isalpha((unsigned char)*++p);)
;
/* Sunday-1 */
if (*p == '+' || *p == '-')
- for(; isdigit(*++p); )
+ for(; isdigit((unsigned char)*++p); )
;
savech = *p;
@@ -301,7 +303,8 @@ getfield(char *p, char **endp, int *flags)
return (0);
}
}
- for (*p = savech; !isdigit(*p) && !isalpha(*p) && *p != '*' && *p != '\t'; ++p)
+ for (*p = savech; !isdigit((unsigned char)*p) &&
+ !isalpha((unsigned char)*p) && *p != '*' && *p != '\t'; ++p)
;
*endp = p;
return (val);
diff --git a/usr.bin/chpass/edit.c b/usr.bin/chpass/edit.c
index e25e46344a6..2590d4c42d1 100644
--- a/usr.bin/chpass/edit.c
+++ b/usr.bin/chpass/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.33 2009/10/27 23:59:36 deraadt Exp $ */
+/* $OpenBSD: edit.c,v 1.34 2013/11/26 13:18:55 deraadt Exp $ */
/* $NetBSD: edit.c,v 1.6 1996/05/15 21:50:45 jtc Exp $ */
/*-
@@ -173,8 +173,9 @@ verify(char *tempname, struct passwd *pw)
warnx("line %u corrupted", line);
goto bad;
}
- while (isspace(*++p));
- for (q = p; isprint(*q); q++) {
+ while (isspace((unsigned char)*++p))
+ ;
+ for (q = p; isprint((unsigned char)*q); q++) {
if (ep->except && strchr(ep->except,*q))
break;
}
diff --git a/usr.bin/chpass/field.c b/usr.bin/chpass/field.c
index 27a61edb46b..b48c7951e5a 100644
--- a/usr.bin/chpass/field.c
+++ b/usr.bin/chpass/field.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: field.c,v 1.12 2009/10/27 23:59:36 deraadt Exp $ */
+/* $OpenBSD: field.c,v 1.13 2013/11/26 13:18:55 deraadt Exp $ */
/* $NetBSD: field.c,v 1.3 1995/03/26 04:55:28 glass Exp $ */
/*
@@ -69,7 +69,7 @@ p_login(char *p, struct passwd *pw, ENTRY *ep)
if (strchr(p, '.'))
warnx("\'.\' is dangerous in a login name");
for (; *p; ++p)
- if (isupper(*p)) {
+ if (isupper((unsigned char)*p)) {
warnx("upper-case letters are dangerous in a login name");
break;
}
@@ -122,7 +122,7 @@ p_gid(char *p, struct passwd *pw, ENTRY *ep)
warnx("empty gid field");
return (1);
}
- if (!isdigit(*p)) {
+ if (!isdigit((unsigned char)*p)) {
if (!(gr = getgrnam(p))) {
warnx("unknown group %s", p);
return (1);
diff --git a/usr.bin/column/column.c b/usr.bin/column/column.c
index d3b96a2822c..9cd597cab5d 100644
--- a/usr.bin/column/column.c
+++ b/usr.bin/column/column.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: column.c,v 1.15 2009/10/27 23:59:36 deraadt Exp $ */
+/* $OpenBSD: column.c,v 1.16 2013/11/26 13:18:55 deraadt Exp $ */
/* $NetBSD: column.c,v 1.4 1995/09/02 05:53:03 jtc Exp $ */
/*
@@ -256,7 +256,7 @@ input(FILE *fp)
if (!list)
list = emalloc((maxentry = DEFNUM) * sizeof(char *));
while (fgets(buf, MAXLINELEN, fp)) {
- for (p = buf; isspace(*p); ++p);
+ for (p = buf; isspace((unsigned char)*p); ++p);
if (!*p)
continue;
if (!(p = strchr(p, '\n'))) {
diff --git a/usr.bin/ctags/fortran.c b/usr.bin/ctags/fortran.c
index 61ed7c515e9..19bd57be641 100644
--- a/usr.bin/ctags/fortran.c
+++ b/usr.bin/ctags/fortran.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fortran.c,v 1.8 2012/03/04 04:05:15 fgsch Exp $ */
+/* $OpenBSD: fortran.c,v 1.9 2013/11/26 13:18:55 deraadt Exp $ */
/* $NetBSD: fortran.c,v 1.3 1995/03/26 20:14:08 glass Exp $ */
/*
@@ -56,7 +56,7 @@ PF_funcs(void)
lbp = lbuf;
if (*lbp == '%') /* Ratfor escape to fortran */
++lbp;
- for (; isspace(*lbp); ++lbp)
+ for (; isspace((unsigned char)*lbp); ++lbp)
continue;
if (!*lbp)
continue;
@@ -67,7 +67,7 @@ PF_funcs(void)
break;
case 'd':
if (cicmp("double")) {
- for (; isspace(*lbp); ++lbp)
+ for (; isspace((unsigned char)*lbp); ++lbp)
continue;
if (!*lbp)
continue;
@@ -89,7 +89,7 @@ PF_funcs(void)
takeprec();
break;
}
- for (; isspace(*lbp); ++lbp)
+ for (; isspace((unsigned char)*lbp); ++lbp)
continue;
if (!*lbp)
continue;
@@ -108,7 +108,7 @@ PF_funcs(void)
default:
continue;
}
- for (; isspace(*lbp); ++lbp)
+ for (; isspace((unsigned char)*lbp); ++lbp)
continue;
if (!*lbp)
continue;
@@ -148,15 +148,15 @@ cicmp(char *cp)
static void
takeprec(void)
{
- for (; isspace(*lbp); ++lbp)
+ for (; isspace((unsigned char)*lbp); ++lbp)
continue;
if (*lbp == '*') {
- for (++lbp; isspace(*lbp); ++lbp)
+ for (++lbp; isspace((unsigned char)*lbp); ++lbp)
continue;
- if (!isdigit(*lbp))
+ if (!isdigit((unsigned char)*lbp))
--lbp; /* force failure */
else
- while (isdigit(*++lbp))
+ while (isdigit((unsigned char)*++lbp))
continue;
}
}
diff --git a/usr.bin/ctags/lisp.c b/usr.bin/ctags/lisp.c
index e3d91f389c7..f4c2fa3812d 100644
--- a/usr.bin/ctags/lisp.c
+++ b/usr.bin/ctags/lisp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lisp.c,v 1.7 2012/03/04 04:05:15 fgsch Exp $ */
+/* $OpenBSD: lisp.c,v 1.8 2013/11/26 13:18:55 deraadt Exp $ */
/* $NetBSD: lisp.c,v 1.3 1995/03/26 20:14:09 glass Exp $ */
/*
@@ -67,9 +67,9 @@ l_entries(void)
if (cicmp("wrapper") || cicmp("whopper"))
special = YES;
}
- for (; !isspace(*lbp); ++lbp)
+ for (; !isspace((unsigned char)*lbp); ++lbp)
continue;
- for (; isspace(*lbp); ++lbp)
+ for (; isspace((unsigned char)*lbp); ++lbp)
continue;
for (cp = lbp; *cp && *cp != '\n'; ++cp)
continue;
diff --git a/usr.bin/expand/expand.c b/usr.bin/expand/expand.c
index 634b9e758d7..44cadfbd042 100644
--- a/usr.bin/expand/expand.c
+++ b/usr.bin/expand/expand.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: expand.c,v 1.11 2009/10/27 23:59:37 deraadt Exp $ */
+/* $OpenBSD: expand.c,v 1.12 2013/11/26 13:18:55 deraadt Exp $ */
/* $NetBSD: expand.c,v 1.5 1995/09/02 06:19:46 jtc Exp $ */
/*
@@ -52,7 +52,8 @@ main(int argc, char *argv[])
int n;
/* handle obsolete syntax */
- while (argc > 1 && argv[1][0] == '-' && isdigit(argv[1][1])) {
+ while (argc > 1 && argv[1][0] == '-' &&
+ isdigit((unsigned char)argv[1][1])) {
getstops(&argv[1][1]);
argc--; argv++;
}
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c
index 8cf7997a554..8edbfa483aa 100644
--- a/usr.bin/finger/util.c
+++ b/usr.bin/finger/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.23 2009/10/27 23:59:38 deraadt Exp $ */
+/* $OpenBSD: util.c,v 1.24 2013/11/26 13:18:55 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -182,7 +182,7 @@ expandusername(char *gecos, char *login, char *buf, int buflen)
if (*p == '&') {
/* interpolate full name */
strlcpy(bp, login, buflen - (bp - buf));
- *bp = toupper(*bp);
+ *bp = toupper((unsigned char)*bp);
bp += strlen(bp);
}
else
@@ -342,7 +342,7 @@ prphone(char *num)
/* don't touch anything if the user has their own formatting */
for (p = num; *p; ++p)
- if (!isdigit(*p))
+ if (!isdigit((unsigned char)*p))
return (num);
len = p - num;
p = pbuf;
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c
index 4a6cc1909ff..be4083ad80a 100644
--- a/usr.bin/fmt/fmt.c
+++ b/usr.bin/fmt/fmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fmt.c,v 1.29 2012/01/17 04:26:28 lum Exp $ */
+/* $OpenBSD: fmt.c,v 1.30 2013/11/26 13:18:55 deraadt Exp $ */
/* Sensible version of fmt
*
@@ -233,7 +233,7 @@ static int output_in_paragraph = 0; /* Any of current para written out yet? */
static void process_named_file(const char *);
static void process_stream(FILE *, const char *);
static size_t indent_length(const char *, size_t);
-static int might_be_header(const unsigned char *);
+static int might_be_header(const char *);
static void new_paragraph(size_t, size_t);
static void output_word(size_t, size_t, const char *, size_t, size_t);
static void output_indent(size_t);
@@ -385,7 +385,7 @@ process_stream(FILE *stream, const char *name)
HdrType header_type;
/* ^-- header_type of previous line; -1 at para start */
- char *line;
+ const char *line;
size_t length;
if (centerP) {
@@ -486,14 +486,14 @@ indent_length(const char *line, size_t length)
* conservative to avoid mangling ordinary civilised text.
*/
static int
-might_be_header(const unsigned char *line)
+might_be_header(const char *line)
{
- if (!isupper(*line++))
+ if (!isupper((unsigned char)*line++))
return 0;
- while (isalnum(*line) || *line == '-')
+ while (isalnum((unsigned char)*line) || *line == '-')
++line;
- return (*line == ':' && isspace(line[1]));
+ return (*line == ':' && isspace((unsigned char)line[1]));
}
/* Begin a new paragraph with an indent of |indent| spaces.
diff --git a/usr.bin/from/from.c b/usr.bin/from/from.c
index b31dec53f79..1bda21e13c9 100644
--- a/usr.bin/from/from.c
+++ b/usr.bin/from/from.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: from.c,v 1.14 2009/10/27 23:59:38 deraadt Exp $ */
+/* $OpenBSD: from.c,v 1.15 2013/11/26 13:18:55 deraadt Exp $ */
/* $NetBSD: from.c,v 1.6 1995/09/01 01:39:10 jtc Exp $ */
/*
@@ -63,8 +63,8 @@ main(int argc, char *argv[])
case 's':
sender = optarg;
for (p = sender; *p; ++p)
- if (isupper(*p))
- *p = tolower(*p);
+ if (isupper((unsigned char)*p))
+ *p = tolower((unsigned char)*p);
break;
case '?':
default:
@@ -122,18 +122,18 @@ match(char *line, char *sender)
char ch, pch, first, *p, *t;
for (first = *sender++;;) {
- if (isspace(ch = *line))
+ if (isspace((unsigned char)(ch = *line)))
return(0);
++line;
- if (isupper(ch))
- ch = tolower(ch);
+ if (isupper((unsigned char)ch))
+ ch = tolower((unsigned char)ch);
if (ch != first)
continue;
for (p = sender, t = line;;) {
if (!(pch = *p++))
return(1);
- if (isupper(ch = *t++))
- ch = tolower(ch);
+ if (isupper((unsigned char)(ch = *t++)))
+ ch = tolower((unsigned char)ch);
if (ch != pch)
break;
}
diff --git a/usr.bin/fsplit/fsplit.c b/usr.bin/fsplit/fsplit.c
index c9fb6ca38c6..ab17b97f358 100644
--- a/usr.bin/fsplit/fsplit.c
+++ b/usr.bin/fsplit/fsplit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsplit.c,v 1.19 2012/03/04 04:05:15 fgsch Exp $ */
+/* $OpenBSD: fsplit.c,v 1.20 2013/11/26 13:18:55 deraadt Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -328,7 +328,7 @@ lname(char *s, size_t len)
/* copy to buffer and converting to lower case */
p = ptr;
while (*p && p <= &buf[71]) {
- *iptr = tolower(*p);
+ *iptr = tolower((unsigned char)*p);
iptr++;
p++;
}
diff --git a/usr.bin/lastcomm/lastcomm.c b/usr.bin/lastcomm/lastcomm.c
index 0b46389a6cb..c4c5cbd1464 100644
--- a/usr.bin/lastcomm/lastcomm.c
+++ b/usr.bin/lastcomm/lastcomm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lastcomm.c,v 1.17 2009/10/27 23:59:39 deraadt Exp $ */
+/* $OpenBSD: lastcomm.c,v 1.18 2013/11/26 13:19:05 deraadt Exp $ */
/* $NetBSD: lastcomm.c,v 1.9 1995/10/22 01:43:42 ghudson Exp $ */
/*
@@ -112,7 +112,7 @@ main(int argc, char *argv[])
} else
for (p = &ab.ac_comm[0];
p < &ab.ac_comm[fldsiz(acct, ac_comm)] && *p; ++p)
- if (!isprint(*p))
+ if (!isprint((unsigned char)*p))
*p = '?';
if (!*argv || requested(argv, &ab))
{
diff --git a/usr.bin/leave/leave.c b/usr.bin/leave/leave.c
index 133d43e81e3..888b648ba90 100644
--- a/usr.bin/leave/leave.c
+++ b/usr.bin/leave/leave.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: leave.c,v 1.12 2009/10/27 23:59:39 deraadt Exp $ */
+/* $OpenBSD: leave.c,v 1.13 2013/11/26 13:19:07 deraadt Exp $ */
/* $NetBSD: leave.c,v 1.4 1995/07/03 16:50:13 phil Exp $ */
/*
@@ -83,7 +83,7 @@ main(int argc, char *argv[])
}
for (hours = 0; (c = *cp) && c != '\n'; ++cp) {
- if (!isdigit(c))
+ if (!isdigit((unsigned char)c))
usage();
hours = hours * 10 + (c - '0');
}
diff --git a/usr.bin/logger/logger.c b/usr.bin/logger/logger.c
index c26b588393c..f87af059f5b 100644
--- a/usr.bin/logger/logger.c
+++ b/usr.bin/logger/logger.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logger.c,v 1.11 2009/10/27 23:59:40 deraadt Exp $ */
+/* $OpenBSD: logger.c,v 1.12 2013/11/26 13:19:07 deraadt Exp $ */
/* $NetBSD: logger.c,v 1.4 1994/12/22 06:27:00 jtc Exp $ */
/*
@@ -157,7 +157,7 @@ decode(char *name, CODE *codetab)
{
CODE *c;
- if (isdigit(*name))
+ if (isdigit((unsigned char)*name))
return (atoi(name));
for (c = codetab; c->c_name; c++)
diff --git a/usr.bin/look/look.c b/usr.bin/look/look.c
index cfce46f8e59..293e6527b8c 100644
--- a/usr.bin/look/look.c
+++ b/usr.bin/look/look.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: look.c,v 1.13 2009/10/27 23:59:40 deraadt Exp $ */
+/* $OpenBSD: look.c,v 1.14 2013/11/26 13:19:07 deraadt Exp $ */
/* $NetBSD: look.c,v 1.7 1995/08/31 22:41:02 jtc Exp $ */
/*-
@@ -144,9 +144,9 @@ look(char *string, char *front, char *back)
/* Reformat string to avoid doing it multiple times later. */
for (readp = writep = string; ch = *readp++;) {
if (fflag)
- ch = FOLD(ch);
+ ch = FOLD((unsigned char)ch);
if (dflag)
- ch = DICT(ch);
+ ch = DICT((unsigned char)ch);
if (ch != NO_COMPARE)
*(writep++) = ch;
}
@@ -291,9 +291,9 @@ compare(char *s1, char *s2, char *back)
for (; *s1 && s2 < back && *s2 != '\n'; ++s1, ++s2) {
ch = *s2;
if (fflag)
- ch = FOLD(ch);
+ ch = FOLD((unsigned char)ch);
if (dflag)
- ch = DICT(ch);
+ ch = DICT((unsigned char)ch);
if (ch == NO_COMPARE) {
++s2; /* Ignore character in comparison. */
diff --git a/usr.bin/newsyslog/newsyslog.c b/usr.bin/newsyslog/newsyslog.c
index 561b6be843a..2527c5a87d8 100644
--- a/usr.bin/newsyslog/newsyslog.c
+++ b/usr.bin/newsyslog/newsyslog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newsyslog.c,v 1.91 2013/04/05 01:29:07 tedu Exp $ */
+/* $OpenBSD: newsyslog.c,v 1.92 2013/11/26 13:19:07 deraadt Exp $ */
/*
* Copyright (c) 1999, 2002, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -569,7 +569,7 @@ parse_file(int *nentries)
q = parse = missing_field(sob(++parse), errline, lineno);
*(parse = son(parse)) = '\0';
- if (isdigit(*q))
+ if (isdigit((unsigned char)*q))
working->size = atoi(q) * 1024;
else
working->size = -1;
@@ -939,7 +939,7 @@ sob(char *p)
{
if (p == NULL)
return(p);
- while (isspace(*p))
+ while (isspace((unsigned char)*p))
p++;
return (p);
}
@@ -948,7 +948,7 @@ sob(char *p)
char *
son(char *p)
{
- while (p && *p && !isspace(*p))
+ while (p && *p && !isspace((unsigned char)*p))
p++;
return (p);
}
@@ -958,7 +958,7 @@ int
isnumberstr(char *string)
{
while (*string) {
- if (!isdigit(*string++))
+ if (!isdigit((unsigned char)*string++))
return (0);
}
return (1);
@@ -1193,7 +1193,8 @@ parse8601(char *s)
if (*t != '\0') {
s = ++t;
l = strtol(s, &t, 10);
- if (l < 0 || l >= INT_MAX || (*t != '\0' && !isspace(*t)))
+ if (l < 0 || l >= INT_MAX ||
+ (*t != '\0' && !isspace((unsigned char)*t)))
return (-1);
switch (t - s) {
@@ -1303,7 +1304,7 @@ parseDWM(char *s)
return (-1);
WMseen++;
s++;
- if (tolower(*s) == 'l') {
+ if (tolower((unsigned char)*s) == 'l') {
tm.tm_mday = nd;
s++;
t = s;
@@ -1325,7 +1326,7 @@ parseDWM(char *s)
break;
}
- if (*t == '\0' || isspace(*t))
+ if (*t == '\0' || isspace((unsigned char)*t))
break;
else
s = t;
diff --git a/usr.bin/nm/elf.c b/usr.bin/nm/elf.c
index a528588d1e3..7e323d31de8 100644
--- a/usr.bin/nm/elf.c
+++ b/usr.bin/nm/elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elf.c,v 1.22 2013/11/13 06:37:24 deraadt Exp $ */
+/* $OpenBSD: elf.c,v 1.23 2013/11/26 13:19:07 deraadt Exp $ */
/*
* Copyright (c) 2003 Michael Shalayeff
@@ -411,7 +411,7 @@ elf2nlist(Elf_Sym *sym, Elf_Ehdr *eh, Elf_Shdr *shdr, char *shstr, struct nlist
if (np->n_type != N_UNDF && ELF_ST_BIND(sym->st_info) != STB_LOCAL) {
np->n_type |= N_EXT;
if (np->n_other)
- np->n_other = toupper(np->n_other);
+ np->n_other = toupper((unsigned char)np->n_other);
}
return (0);
diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c
index a0787c4d896..76902989984 100644
--- a/usr.bin/nm/nm.c
+++ b/usr.bin/nm/nm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nm.c,v 1.39 2013/11/12 19:37:39 deraadt Exp $ */
+/* $OpenBSD: nm.c,v 1.40 2013/11/26 13:19:07 deraadt Exp $ */
/* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */
/*
@@ -308,7 +308,7 @@ mmbr_name(struct ar_hdr *arh, char **name, int baselen, int *namelen, FILE *fp)
if ((arh->ar_name[0] == '#') &&
(arh->ar_name[1] == '1') &&
(arh->ar_name[2] == '/') &&
- (isdigit(arh->ar_name[3]))) {
+ (isdigit((unsigned char)arh->ar_name[3]))) {
int len = atoi(&arh->ar_name[3]);
if (len > *namelen) {
diff --git a/usr.bin/patch/backupfile.c b/usr.bin/patch/backupfile.c
index 2d4037b6638..d9e40bcba7e 100644
--- a/usr.bin/patch/backupfile.c
+++ b/usr.bin/patch/backupfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: backupfile.c,v 1.20 2009/10/27 23:59:41 deraadt Exp $ */
+/* $OpenBSD: backupfile.c,v 1.21 2013/11/26 13:19:07 deraadt Exp $ */
/*
* backupfile.c -- make Emacs style backup file names Copyright (C) 1990 Free
@@ -132,8 +132,9 @@ version_number(const char *base, const char *backup, size_t base_length)
const char *p;
version = 0;
- if (!strncmp(base, backup, base_length) && ISDIGIT(backup[base_length])) {
- for (p = &backup[base_length]; ISDIGIT(*p); ++p)
+ if (!strncmp(base, backup, base_length) &&
+ ISDIGIT((unsigned char)backup[base_length])) {
+ for (p = &backup[base_length]; ISDIGIT((unsigned char)*p); ++p)
version = version * 10 + *p - '0';
if (p[0] != '~' || p[1])
version = 0;
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c
index eed1aefad68..67cc3a83d72 100644
--- a/usr.bin/patch/inp.c
+++ b/usr.bin/patch/inp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inp.c,v 1.36 2012/04/10 14:46:34 ajacoutot Exp $ */
+/* $OpenBSD: inp.c,v 1.37 2013/11/26 13:19:07 deraadt Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -461,11 +461,12 @@ rev_in_string(const char *string)
if (revision == NULL)
return true;
patlen = strlen(revision);
- if (strnEQ(string, revision, patlen) && isspace(string[patlen]))
+ if (strnEQ(string, revision, patlen) &&
+ isspace((unsigned char)string[patlen]))
return true;
for (s = string; *s; s++) {
- if (isspace(*s) && strnEQ(s + 1, revision, patlen) &&
- isspace(s[patlen + 1])) {
+ if (isspace((unsigned char)*s) && strnEQ(s + 1, revision, patlen) &&
+ isspace((unsigned char)s[patlen + 1])) {
return true;
}
}
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index 687ccc8b0f1..fba035c33bd 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: patch.c,v 1.50 2012/05/15 19:32:02 millert Exp $ */
+/* $OpenBSD: patch.c,v 1.51 2013/11/26 13:19:07 deraadt Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -508,7 +508,7 @@ get_some_switches(void)
break;
case 'D':
do_defines = true;
- if (!isalpha(*optarg) && *optarg != '_')
+ if (!isalpha((unsigned char)*optarg) && *optarg != '_')
fatal("argument to -D is not an identifier\n");
snprintf(if_defined, sizeof if_defined,
"#ifdef %s\n", optarg);
@@ -1030,12 +1030,12 @@ static bool
similar(const char *a, const char *b, int len)
{
while (len) {
- if (isspace(*b)) { /* whitespace (or \n) to match? */
- if (!isspace(*a)) /* no corresponding whitespace? */
- return false;
- while (len && isspace(*b) && *b != '\n')
+ if (isspace((unsigned char)*b)) { /* whitespace (or \n) to match? */
+ if (!isspace((unsigned char)*a))
+ return false; /* no corresponding whitespace */
+ while (len && isspace((unsigned char)*b) && *b != '\n')
b++, len--; /* skip pattern whitespace */
- while (isspace(*a) && *a != '\n')
+ while (isspace((unsigned char)*a) && *a != '\n')
a++; /* skip target whitespace */
if (*a == '\n' || *b == '\n')
return (*a == *b); /* should end in sync */
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index 4538787172e..85dc5ae2647 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pch.c,v 1.40 2013/07/11 12:39:31 otto Exp $ */
+/* $OpenBSD: pch.c,v 1.41 2013/11/26 13:19:07 deraadt Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -283,9 +283,9 @@ intuit_diff_type(void)
else
indent++;
}
- for (t = s; isdigit(*t) || *t == ','; t++)
+ for (t = s; isdigit((unsigned char)*t) || *t == ','; t++)
;
- this_is_a_command = (isdigit(*s) &&
+ this_is_a_command = (isdigit((unsigned char)*s) &&
(*t == 'd' || *t == 'c' || *t == 'a'));
if (first_command_line < 0L && this_is_a_command) {
first_command_line = this_line;
@@ -306,10 +306,11 @@ intuit_diff_type(void)
names[INDEX_FILE].path = fetchname(s + 6,
&names[INDEX_FILE].exists, strippath);
else if (strnEQ(s, "Prereq:", 7)) {
- for (t = s + 7; isspace(*t); t++)
+ for (t = s + 7; isspace((unsigned char)*t); t++)
;
revision = savestr(t);
- for (t = revision; *t && !isspace(*t); t++)
+ for (t = revision;
+ *t && !isspace((unsigned char)*t); t++)
;
*t = '\0';
if (*revision == '\0') {
@@ -567,17 +568,18 @@ another_hunk(void)
p_end--;
return false;
}
- for (s = buf; *s && !isdigit(*s); s++)
+ for (s = buf;
+ *s && !isdigit((unsigned char)*s); s++)
;
if (!*s)
malformed();
if (strnEQ(s, "0,0", 3))
memmove(s, s + 2, strlen(s + 2) + 1);
p_first = (LINENUM) atol(s);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == ',') {
- for (; *s && !isdigit(*s); s++)
+ for (; *s && !isdigit((unsigned char)*s); s++)
;
if (!*s)
malformed();
@@ -636,15 +638,16 @@ another_hunk(void)
return false;
}
p_char[p_end] = '=';
- for (s = buf; *s && !isdigit(*s); s++)
+ for (s = buf;
+ *s && !isdigit((unsigned char)*s); s++)
;
if (!*s)
malformed();
p_newfirst = (LINENUM) atol(s);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == ',') {
- for (; *s && !isdigit(*s); s++)
+ for (; *s && !isdigit((unsigned char)*s); s++)
;
if (!*s)
malformed();
@@ -674,8 +677,8 @@ another_hunk(void)
change_line:
if (buf[1] == '\n' && canonicalize)
strlcpy(buf + 1, " \n", sizeof buf - 1);
- if (!isspace(buf[1]) && buf[1] != '>' &&
- buf[1] != '<' &&
+ if (!isspace((unsigned char)buf[1]) &&
+ buf[1] != '>' && buf[1] != '<' &&
repl_beginning && repl_could_be_missing) {
repl_missing = true;
goto hunk_done;
@@ -721,7 +724,7 @@ another_hunk(void)
}
break;
case ' ':
- if (!isspace(buf[1]) &&
+ if (!isspace((unsigned char)buf[1]) &&
repl_beginning && repl_could_be_missing) {
repl_missing = true;
goto hunk_done;
@@ -849,11 +852,11 @@ hunk_done:
if (!*s)
malformed();
p_first = (LINENUM) atol(s);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == ',') {
p_ptrn_lines = (LINENUM) atol(++s);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
} else
p_ptrn_lines = 1;
@@ -862,11 +865,11 @@ hunk_done:
if (*s != '+' || !*++s)
malformed();
p_newfirst = (LINENUM) atol(s);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == ',') {
p_repl_lines = (LINENUM) atol(++s);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
} else
p_repl_lines = 1;
@@ -1009,16 +1012,16 @@ hunk_done:
p_context = 0;
ret = pgets(buf, sizeof buf, pfp);
p_input_line++;
- if (ret == NULL || !isdigit(*buf)) {
+ if (ret == NULL || !isdigit((unsigned char)*buf)) {
next_intuit_at(line_beginning, p_input_line);
return false;
}
p_first = (LINENUM) atol(buf);
- for (s = buf; isdigit(*s); s++)
+ for (s = buf; isdigit((unsigned char)*s); s++)
;
if (*s == ',') {
p_ptrn_lines = (LINENUM) atol(++s) - p_first + 1;
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
} else
p_ptrn_lines = (*s != 'a');
@@ -1026,7 +1029,7 @@ hunk_done:
if (hunk_type == 'a')
p_first++; /* do append rather than insert */
min = (LINENUM) atol(++s);
- for (; isdigit(*s); s++)
+ for (; isdigit((unsigned char)*s); s++)
;
if (*s == ',')
max = (LINENUM) atol(++s);
@@ -1383,11 +1386,11 @@ do_ed_script(void)
break;
}
p_input_line++;
- for (t = buf; isdigit(*t) || *t == ','; t++)
+ for (t = buf; isdigit((unsigned char)*t) || *t == ','; t++)
;
/* POSIX defines allowed commands as {a,c,d,i,s} */
- if (isdigit(*buf) && (*t == 'a' || *t == 'c' || *t == 'd' ||
- *t == 'i' || *t == 's')) {
+ if (isdigit((unsigned char)*buf) &&
+ (*t == 'a' || *t == 'c' || *t == 'd' || *t == 'i' || *t == 's')) {
if (pipefp != NULL)
fputs(buf, pipefp);
if (*t != 'd') {
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c
index 45d0d7d7d6c..40414a75c4c 100644
--- a/usr.bin/patch/util.c
+++ b/usr.bin/patch/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.35 2010/07/24 01:10:12 ray Exp $ */
+/* $OpenBSD: util.c,v 1.36 2013/11/26 13:19:07 deraadt Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -129,10 +129,10 @@ backup_file(const char *orig)
while (stat(bakname, &filestat) == 0 &&
orig_device == filestat.st_dev && orig_inode == filestat.st_ino) {
/* Skip initial non-lowercase chars. */
- for (s = simplename; *s && !islower(*s); s++)
+ for (s = simplename; *s && !islower((unsigned char)*s); s++)
;
if (*s)
- *s = toupper(*s);
+ *s = toupper((unsigned char)*s);
else
memmove(simplename, simplename + 1,
strlen(simplename + 1) + 1);
@@ -333,7 +333,7 @@ fetchname(const char *at, bool *exists, int strip_leading)
if (at == NULL || *at == '\0')
return NULL;
- while (isspace(*at))
+ while (isspace((unsigned char)*at))
at++;
#ifdef DEBUGGING
if (debug & 128)
@@ -347,7 +347,7 @@ fetchname(const char *at, bool *exists, int strip_leading)
tab = strchr(t, '\t') != NULL;
/* Strip off up to `strip_leading' path components and NUL terminate. */
for (sleading = strip_leading; *t != '\0' && ((tab && *t != '\t') ||
- !isspace(*t)); t++) {
+ !isspace((unsigned char)*t)); t++) {
if (t[0] == '/' && t[1] != '/' && t[1] != '\0')
if (--sleading >= 0)
name = t + 1;
diff --git a/usr.bin/pr/egetopt.c b/usr.bin/pr/egetopt.c
index 8d60f76a929..25e719346b5 100644
--- a/usr.bin/pr/egetopt.c
+++ b/usr.bin/pr/egetopt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: egetopt.c,v 1.8 2009/10/27 23:59:41 deraadt Exp $ */
+/* $OpenBSD: egetopt.c,v 1.9 2013/11/26 13:19:07 deraadt Exp $ */
/*-
* Copyright (c) 1991 Keith Muller.
@@ -106,14 +106,14 @@ egetopt(int nargc, char * const *nargv, const char *ostr)
*/
if ((eoptopt == (int)'-') && !*place)
return (-1);
- if (strchr(ostr, '#') && (isdigit(eoptopt) ||
+ if (strchr(ostr, '#') && (isdigit((unsigned char)eoptopt) ||
(((eoptopt == (int)'-') || (eoptopt == (int)'+')) &&
- isdigit(*place)))) {
+ isdigit((unsigned char)*place)))) {
/*
* # option: +/- with a number is ok
*/
for (p = place; *p != '\0'; ++p) {
- if (!isdigit(*p))
+ if (!isdigit((unsigned char)*p))
break;
}
eoptarg = place-1;
diff --git a/usr.bin/pr/pr.c b/usr.bin/pr/pr.c
index 5ebfcd34ecc..5687a658b49 100644
--- a/usr.bin/pr/pr.c
+++ b/usr.bin/pr/pr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pr.c,v 1.32 2013/08/22 04:43:40 guenther Exp $ */
+/* $OpenBSD: pr.c,v 1.33 2013/11/26 13:19:07 deraadt Exp $ */
/*-
* Copyright (c) 1991 Keith Muller.
@@ -1808,11 +1808,11 @@ setup(int argc, char *argv[])
break;
case 'e':
++eflag;
- if ((eoptarg != NULL) && !isdigit(*eoptarg))
+ if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg))
inchar = *eoptarg++;
else
inchar = INCHAR;
- if ((eoptarg != NULL) && isdigit(*eoptarg)) {
+ if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) {
ingap = strtonum(eoptarg, 0, INT_MAX, &errstr);
if (errstr) {
ferrout("pr: -e gap is %s: %s\n", errstr, eoptarg);
@@ -1835,11 +1835,11 @@ setup(int argc, char *argv[])
break;
case 'i':
++iflag;
- if ((eoptarg != NULL) && !isdigit(*eoptarg))
+ if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg))
ochar = *eoptarg++;
else
ochar = OCHAR;
- if ((eoptarg != NULL) && isdigit(*eoptarg)) {
+ if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) {
ogap = strtonum(eoptarg, 0, INT_MAX, &errstr);
if (errstr) {
ferrout("pr: -i gap is %s: %s\n", errstr, eoptarg);
@@ -1864,11 +1864,11 @@ setup(int argc, char *argv[])
++merge;
break;
case 'n':
- if ((eoptarg != NULL) && !isdigit(*eoptarg))
+ if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg))
nmchar = *eoptarg++;
else
nmchar = NMCHAR;
- if ((eoptarg != NULL) && isdigit(*eoptarg)) {
+ if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) {
nmwd = strtonum(eoptarg, 1, INT_MAX, &errstr);
if (errstr) {
ferrout("pr: -n width is %s: %s\n", errstr, eoptarg);
diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c
index 136d339c4a7..b2038ff9752 100644
--- a/usr.bin/quota/quota.c
+++ b/usr.bin/quota/quota.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: quota.c,v 1.31 2013/11/08 15:21:20 jsing Exp $ */
+/* $OpenBSD: quota.c,v 1.32 2013/11/26 13:19:07 deraadt Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@@ -684,10 +684,10 @@ alldigits(char *s)
{
int c;
- c = *s++;
+ c = (unsigned char)*s++;
do {
if (!isdigit(c))
return (0);
- } while ((c = *s++));
+ } while ((c = (unsigned char)*s++));
return (1);
}