mirror of
https://github.com/openbsd/src.git
synced 2025-01-04 23:35:36 -08:00
add unsigned char casts for specific calls to ctype.h macros.
ok guenther step
This commit is contained in:
parent
87cf7c0244
commit
cd3e3e8c82
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: date.c,v 1.39 2013/10/20 03:07:35 guenther Exp $ */
|
||||
/* $OpenBSD: date.c,v 1.40 2013/11/21 15:54:44 deraadt Exp $ */
|
||||
/* $NetBSD: date.c,v 1.11 1995/09/07 06:21:05 jtc Exp $ */
|
||||
|
||||
/*
|
||||
@ -88,7 +88,7 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
case 't': /* minutes west of GMT */
|
||||
/* error check; don't allow "PST" */
|
||||
if (isdigit(*optarg)) {
|
||||
if (isdigit((unsigned char)*optarg)) {
|
||||
tz.tz_minuteswest = atoi(optarg);
|
||||
break;
|
||||
}
|
||||
@ -154,7 +154,7 @@ setthetime(char *p)
|
||||
int yearset = 0;
|
||||
|
||||
for (t = p, dot = NULL; *t; ++t) {
|
||||
if (isdigit(*t))
|
||||
if (isdigit((unsigned char)*t))
|
||||
continue;
|
||||
if (*t == '.' && dot == NULL) {
|
||||
dot = t;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: main.c,v 1.35 2013/01/15 20:26:28 espie Exp $ */
|
||||
/* $OpenBSD: main.c,v 1.36 2013/11/21 15:54:45 deraadt Exp $ */
|
||||
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
|
||||
|
||||
/* main.c: This file contains the main control and user-interface routines
|
||||
@ -298,7 +298,7 @@ extract_addr_range(void)
|
||||
|
||||
#define SKIP_BLANKS() \
|
||||
do { \
|
||||
while (isspace(*ibufp) && *ibufp != '\n') \
|
||||
while (isspace((unsigned char)*ibufp) && *ibufp != '\n') \
|
||||
ibufp++; \
|
||||
} while (0)
|
||||
|
||||
@ -323,7 +323,7 @@ next_addr(void)
|
||||
|
||||
SKIP_BLANKS();
|
||||
for (hd = ibufp;; first = 0)
|
||||
switch ((c = *ibufp)) {
|
||||
switch ((c = (unsigned char)*ibufp)) {
|
||||
case '+':
|
||||
case '\t':
|
||||
case ' ':
|
||||
@ -331,7 +331,7 @@ next_addr(void)
|
||||
case '^':
|
||||
ibufp++;
|
||||
SKIP_BLANKS();
|
||||
if (isdigit(*ibufp)) {
|
||||
if (isdigit((unsigned char)*ibufp)) {
|
||||
STRTOI(n, ibufp);
|
||||
addr += (c == '-' || c == '^') ? -n : n;
|
||||
} else if (!isspace(c))
|
||||
@ -361,7 +361,7 @@ next_addr(void)
|
||||
case '\'':
|
||||
MUST_BE_FIRST();
|
||||
ibufp++;
|
||||
if ((addr = get_marked_node_addr(*ibufp++)) < 0)
|
||||
if ((addr = get_marked_node_addr((unsigned char)*ibufp++)) < 0)
|
||||
return ERR;
|
||||
break;
|
||||
case '%':
|
||||
@ -491,7 +491,7 @@ exec_command(void)
|
||||
int c;
|
||||
|
||||
SKIP_BLANKS();
|
||||
switch ((c = *ibufp++)) {
|
||||
switch ((c = (unsigned char)*ibufp++)) {
|
||||
case 'a':
|
||||
GET_COMMAND_SUFFIX();
|
||||
if (!isglobal) clear_undo_stack();
|
||||
@ -525,7 +525,7 @@ exec_command(void)
|
||||
if (addr_cnt > 0) {
|
||||
seterrmsg("unexpected address");
|
||||
return ERR;
|
||||
} else if (!isspace(*ibufp)) {
|
||||
} else if (!isspace((unsigned char)*ibufp)) {
|
||||
seterrmsg("unexpected command suffix");
|
||||
return ERR;
|
||||
} else if ((fnp = get_filename()) == NULL)
|
||||
@ -556,7 +556,7 @@ exec_command(void)
|
||||
if (addr_cnt > 0) {
|
||||
seterrmsg("unexpected address");
|
||||
return ERR;
|
||||
} else if (!isspace(*ibufp)) {
|
||||
} else if (!isspace((unsigned char)*ibufp)) {
|
||||
seterrmsg("unexpected command suffix");
|
||||
return ERR;
|
||||
} else if ((fnp = get_filename()) == NULL)
|
||||
@ -624,7 +624,7 @@ exec_command(void)
|
||||
return ERR;
|
||||
break;
|
||||
case 'k':
|
||||
c = *ibufp++;
|
||||
c = (unsigned char)*ibufp++;
|
||||
if (second_addr == 0) {
|
||||
seterrmsg("invalid address");
|
||||
return ERR;
|
||||
@ -688,7 +688,7 @@ exec_command(void)
|
||||
gflag = (modified && !scripted && c == 'q') ? EMOD : EOF;
|
||||
break;
|
||||
case 'r':
|
||||
if (!isspace(*ibufp)) {
|
||||
if (!isspace((unsigned char)*ibufp)) {
|
||||
seterrmsg("unexpected command suffix");
|
||||
return ERR;
|
||||
} else if (addr_cnt == 0)
|
||||
@ -827,7 +827,7 @@ exec_command(void)
|
||||
gflag = EOF;
|
||||
ibufp++;
|
||||
}
|
||||
if (!isspace(*ibufp)) {
|
||||
if (!isspace((unsigned char)*ibufp)) {
|
||||
seterrmsg("unexpected command suffix");
|
||||
return ERR;
|
||||
} else if ((fnp = get_filename()) == NULL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: expr.c,v 1.18 2013/03/28 08:40:31 nicm Exp $ */
|
||||
/* $OpenBSD: expr.c,v 1.19 2013/11/21 15:54:45 deraadt Exp $ */
|
||||
/* $NetBSD: expr.c,v 1.3.6.1 1996/06/04 20:41:47 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@ -116,7 +116,7 @@ is_integer(struct val *vp, int *r)
|
||||
s++;
|
||||
|
||||
while (*s) {
|
||||
if (!isdigit(*s))
|
||||
if (!isdigit((unsigned char)*s))
|
||||
return 0;
|
||||
|
||||
i *= 10;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: kill.c,v 1.10 2011/06/06 07:20:13 otto Exp $ */
|
||||
/* $OpenBSD: kill.c,v 1.11 2013/11/21 15:54:45 deraadt Exp $ */
|
||||
/* $NetBSD: kill.c,v 1.11 1995/09/07 06:30:27 jtc Exp $ */
|
||||
|
||||
/*
|
||||
@ -62,7 +62,7 @@ main(int argc, char *argv[])
|
||||
if (argc > 1)
|
||||
usage();
|
||||
if (argc == 1) {
|
||||
if (!isdigit(**argv))
|
||||
if (!isdigit((unsigned char)**argv))
|
||||
usage();
|
||||
numsig = strtol(*argv, &ep, 10);
|
||||
if (*ep)
|
||||
@ -92,10 +92,10 @@ main(int argc, char *argv[])
|
||||
argc--, argv++;
|
||||
} else if (**argv == '-') {
|
||||
++*argv;
|
||||
if (isalpha(**argv)) {
|
||||
if (isalpha((unsigned char)**argv)) {
|
||||
if ((numsig = signame_to_signum(*argv)) < 0)
|
||||
nosig(*argv);
|
||||
} else if (isdigit(**argv)) {
|
||||
} else if (isdigit((unsigned char)**argv)) {
|
||||
numsig = strtol(*argv, &ep, 10);
|
||||
if (*ep)
|
||||
errx(1, "illegal signal number: %s", *argv);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: util.c,v 1.15 2011/03/04 21:03:19 okan Exp $ */
|
||||
/* $OpenBSD: util.c,v 1.16 2013/11/21 15:54:45 deraadt Exp $ */
|
||||
/* $NetBSD: util.c,v 1.12 1995/09/07 06:43:02 jtc Exp $ */
|
||||
|
||||
/*
|
||||
@ -51,7 +51,7 @@ putname(char *name)
|
||||
int len;
|
||||
|
||||
for (len = 0; *name; len++, name++)
|
||||
putchar((!isprint(*name) && f_nonprint) ? '?' : *name);
|
||||
putchar((!isprint((unsigned char)*name) && f_nonprint) ? '?' : *name);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: md5.c,v 1.56 2013/04/15 15:54:17 millert Exp $ */
|
||||
/* $OpenBSD: md5.c,v 1.57 2013/11/21 15:54:45 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001,2003,2005-2006 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
@ -584,7 +584,7 @@ digest_filelist(const char *file, struct hash_function *defhash)
|
||||
lbuf[len] = '\0';
|
||||
buf = lbuf;
|
||||
}
|
||||
while (isspace(*buf))
|
||||
while (isspace((unsigned char)*buf))
|
||||
buf++;
|
||||
|
||||
/*
|
||||
@ -658,7 +658,7 @@ digest_filelist(const char *file, struct hash_function *defhash)
|
||||
continue;
|
||||
}
|
||||
*p++ = '\0';
|
||||
while (isspace(*p))
|
||||
while (isspace((unsigned char)*p))
|
||||
p++;
|
||||
if (*p == '\0')
|
||||
continue;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: mtrmt.c,v 1.20 2012/12/04 02:38:51 deraadt Exp $ */
|
||||
/* $OpenBSD: mtrmt.c,v 1.21 2013/11/21 15:54:45 deraadt Exp $ */
|
||||
/* $NetBSD: mtrmt.c,v 1.2 1996/03/06 06:22:07 scottr Exp $ */
|
||||
|
||||
/*-
|
||||
@ -158,11 +158,11 @@ rmtgetconn(void)
|
||||
static int
|
||||
okname(char *cp0)
|
||||
{
|
||||
char *cp;
|
||||
unsigned char *cp;
|
||||
int c;
|
||||
|
||||
for (cp = cp0; *cp; cp++) {
|
||||
c = *cp;
|
||||
c = (unsigned char)*cp;
|
||||
if (!isascii(c) || !(isalnum(c) || c == '_' || c == '-')) {
|
||||
warnx("invalid user name: %s", cp0);
|
||||
return (0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: sel_subs.c,v 1.21 2012/12/04 02:24:45 deraadt Exp $ */
|
||||
/* $OpenBSD: sel_subs.c,v 1.22 2013/11/21 15:54:45 deraadt Exp $ */
|
||||
/* $NetBSD: sel_subs.c,v 1.5 1995/03/21 09:07:42 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -534,7 +534,7 @@ str_sec(const char *p, time_t *tval)
|
||||
len = strlen(p);
|
||||
|
||||
for (t = p, dot = NULL; *t; ++t) {
|
||||
if (isdigit(*t))
|
||||
if (isdigit((unsigned char)*t))
|
||||
continue;
|
||||
if (*t == '.' && dot == NULL) {
|
||||
dot = t;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tar.c,v 1.48 2013/07/03 04:08:29 guenther Exp $ */
|
||||
/* $OpenBSD: tar.c,v 1.49 2013/11/21 15:54:45 deraadt Exp $ */
|
||||
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -1228,7 +1228,7 @@ rd_xheader(ARCHD *arcn, char *buf, off_t size, char typeflag)
|
||||
return (-1);
|
||||
|
||||
for (p = buf; size > 0; size -= len, p = nextp) {
|
||||
if (!isdigit(*p)) {
|
||||
if (!isdigit((unsigned char)*p)) {
|
||||
paxwarn(1, "Invalid extended header record");
|
||||
return (-1);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ps.c,v 1.58 2013/10/31 01:59:33 deraadt Exp $ */
|
||||
/* $OpenBSD: ps.c,v 1.59 2013/11/21 15:54:45 deraadt Exp $ */
|
||||
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
@ -444,7 +444,7 @@ kludge_oldps_options(char *s)
|
||||
* otherwise check for trailing number, which *may* be a
|
||||
* pid.
|
||||
*/
|
||||
while (cp >= s && isdigit(*cp))
|
||||
while (cp >= s && isdigit((unsigned char)*cp))
|
||||
--cp;
|
||||
}
|
||||
cp++;
|
||||
@ -454,7 +454,8 @@ kludge_oldps_options(char *s)
|
||||
* if there's a trailing number, and not a preceding 'p' (pid) or
|
||||
* 't' (tty) flag, then assume it's a pid and insert a 'p' flag.
|
||||
*/
|
||||
if (isdigit(*cp) && (cp == s || (cp[-1] != 't' && cp[-1] != 'p' &&
|
||||
if (isdigit((unsigned char)*cp) &&
|
||||
(cp == s || (cp[-1] != 't' && cp[-1] != 'p' &&
|
||||
(cp - 1 == s || cp[-2] != 't'))))
|
||||
*ns++ = 'p';
|
||||
/* and append the number */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: rmail.c,v 1.25 2012/12/04 02:24:47 deraadt Exp $ */
|
||||
/* $OpenBSD: rmail.c,v 1.26 2013/11/21 15:54:46 deraadt Exp $ */
|
||||
/* $NetBSD: rmail.c,v 1.8 1995/09/07 06:51:50 jtc Exp $ */
|
||||
|
||||
/*
|
||||
@ -141,7 +141,9 @@ main(int argc, char *argv[])
|
||||
/* Use the "remote from" if it exists. */
|
||||
for (p = addrp; (p = strchr(p + 1, 'r')) != NULL;)
|
||||
if (!strncmp(p, "remote from ", 12)) {
|
||||
for (t = p += 12; *t && !isspace(*t); ++t);
|
||||
for (t = p += 12;
|
||||
*t && !isspace((unsigned char)*t); ++t)
|
||||
;
|
||||
*t = '\0';
|
||||
if (debug)
|
||||
(void)fprintf(stderr,
|
||||
@ -169,7 +171,8 @@ main(int argc, char *argv[])
|
||||
/* 'p' now points to any system string from this line. */
|
||||
if (p != NULL) {
|
||||
/* Nul terminate it as necessary. */
|
||||
for (t = p; *t && !isspace(*t); ++t);
|
||||
for (t = p; *t && !isspace((unsigned char)*t); ++t)
|
||||
;
|
||||
*t = '\0';
|
||||
|
||||
/* If the first system, copy to the from_sys string. */
|
||||
@ -205,7 +208,8 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Save off from user's address; the last one wins. */
|
||||
for (p = addrp; *p && !isspace(*p); ++p);
|
||||
for (p = addrp; *p && !isspace((unsigned char)*p); ++p)
|
||||
;
|
||||
*p = '\0';
|
||||
if (*addrp == '\0')
|
||||
addrp = "<>";
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: sleep.c,v 1.19 2009/10/27 23:59:22 deraadt Exp $ */
|
||||
/* $OpenBSD: sleep.c,v 1.20 2013/11/21 15:54:46 deraadt Exp $ */
|
||||
/* $NetBSD: sleep.c,v 1.8 1995/03/21 09:11:11 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@ -71,7 +71,7 @@ main(int argc, char *argv[])
|
||||
|
||||
cp = *argv;
|
||||
while ((*cp != '\0') && (*cp != '.')) {
|
||||
if (!isdigit(*cp))
|
||||
if (!isdigit((unsigned char)*cp))
|
||||
usage();
|
||||
t = (secs * 10) + (*cp++ - '0');
|
||||
if (t / 10 != secs) /* oflow */
|
||||
@ -85,7 +85,7 @@ main(int argc, char *argv[])
|
||||
for (i = 100000000; i > 0; i /= 10) {
|
||||
if (*cp == '\0')
|
||||
break;
|
||||
if (!isdigit(*cp))
|
||||
if (!isdigit((unsigned char)*cp))
|
||||
usage();
|
||||
nsecs += (*cp++ - '0') * i;
|
||||
}
|
||||
@ -96,7 +96,7 @@ main(int argc, char *argv[])
|
||||
* checking the rest of the argument.
|
||||
*/
|
||||
while (*cp != '\0') {
|
||||
if (!isdigit(*cp++))
|
||||
if (!isdigit((unsigned char)*cp++))
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: stty.c,v 1.14 2009/10/28 20:58:38 deraadt Exp $ */
|
||||
/* $OpenBSD: stty.c,v 1.15 2013/11/21 15:54:46 deraadt Exp $ */
|
||||
/* $NetBSD: stty.c,v 1.11 1995/03/21 09:11:30 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -111,7 +111,7 @@ args: argc -= optind;
|
||||
if (msearch(&argv, &i))
|
||||
continue;
|
||||
|
||||
if (isdigit(**argv)) {
|
||||
if (isdigit((unsigned char)**argv)) {
|
||||
const char *error;
|
||||
int speed;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: policy.c,v 1.33 2012/12/04 02:24:47 deraadt Exp $ */
|
||||
/* $OpenBSD: policy.c,v 1.34 2013/11/21 15:54:46 deraadt Exp $ */
|
||||
/*
|
||||
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
|
||||
* All rights reserved.
|
||||
@ -362,7 +362,7 @@ systrace_policyfilename(char *dirname, const char *name)
|
||||
|
||||
p = name;
|
||||
while (*p) {
|
||||
if (!isalnum(*p)) {
|
||||
if (!isalnum((unsigned char)*p)) {
|
||||
if (i != plen)
|
||||
file[i++] = '_';
|
||||
} else
|
||||
@ -592,7 +592,7 @@ systrace_policyline(char *line)
|
||||
/* Remove trailing white space */
|
||||
p = line + strlen(line) - 1;
|
||||
while (p > line) {
|
||||
if (!isspace(*p))
|
||||
if (!isspace((unsigned char)*p))
|
||||
break;
|
||||
*p-- = '\0';
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: util.c,v 1.11 2006/04/26 20:19:25 sturm Exp $ */
|
||||
/* $OpenBSD: util.c,v 1.12 2013/11/21 15:54:46 deraadt Exp $ */
|
||||
/*
|
||||
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
|
||||
* All rights reserved.
|
||||
@ -81,7 +81,7 @@ strrpl(char *str, size_t size, char *match, char *value)
|
||||
|
||||
/* Try to match against the variable */
|
||||
while ((p = strchr(p, match[0])) != NULL) {
|
||||
if (!strncmp(p, match, len) && !isalnum(p[len]))
|
||||
if (!strncmp(p, match, len) && !isalnum((unsigned char)p[len]))
|
||||
break;
|
||||
p += len;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: test.c,v 1.11 2009/10/27 23:59:22 deraadt Exp $ */
|
||||
/* $OpenBSD: test.c,v 1.12 2013/11/21 15:54:46 deraadt Exp $ */
|
||||
/* $NetBSD: test.c,v 1.15 1995/03/21 07:04:06 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@ -459,7 +459,7 @@ getn(const char *s)
|
||||
if (errno != 0)
|
||||
errx(2, "%s: out of range", s);
|
||||
|
||||
while (isspace(*p))
|
||||
while (isspace((unsigned char)*p))
|
||||
p++;
|
||||
|
||||
if (*p)
|
||||
|
Loading…
Reference in New Issue
Block a user