Add (unsigned char) cast to ctype functions

Some of this code could usefully be converted to use strtoul() and/or
some small helper functions.
This commit is contained in:
dsl 2004-10-30 08:44:25 +00:00
parent 8668419e38
commit 75ba9fc767
9 changed files with 33 additions and 33 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: displayq.c,v 1.26 2003/08/07 11:25:25 agc Exp $ */
/* $NetBSD: displayq.c,v 1.27 2004/10/30 08:44:25 dsl Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)displayq.c 8.4 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: displayq.c,v 1.26 2003/08/07 11:25:25 agc Exp $");
__RCSID("$NetBSD: displayq.c,v 1.27 2004/10/30 08:44:25 dsl Exp $");
#endif
#endif /* not lint */
@ -392,7 +392,7 @@ inlist(char *name, char *file)
/*
* Check the request list
*/
for (n = 0, cp = file+3; isdigit(*cp); )
for (n = 0, cp = file+3; isdigit((unsigned char)*cp); )
n = n * 10 + (*cp++ - '0');
for (r = requ; r < &requ[requests]; r++)
if (*r == n && !strcmp(cp, from))

View File

@ -1,4 +1,4 @@
/* $NetBSD: rmjob.c,v 1.19 2003/08/07 11:25:25 agc Exp $ */
/* $NetBSD: rmjob.c,v 1.20 2004/10/30 08:44:26 dsl Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)rmjob.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: rmjob.c,v 1.19 2003/08/07 11:25:25 agc Exp $");
__RCSID("$NetBSD: rmjob.c,v 1.20 2004/10/30 08:44:26 dsl Exp $");
#endif
#endif /* not lint */
@ -273,7 +273,7 @@ chk(char *file)
/*
* Check the request list
*/
for (n = 0, cp = file+3; isdigit(*cp); )
for (n = 0, cp = file+3; isdigit((unsigned char)*cp); )
n = n * 10 + (*cp++ - '0');
for (r = requ; r < &requ[requests]; r++)
if (*r == n && isowner(line+1, file))

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmds.c,v 1.16 2003/08/07 11:25:26 agc Exp $ */
/* $NetBSD: cmds.c,v 1.17 2004/10/30 08:44:26 dsl Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: cmds.c,v 1.16 2003/08/07 11:25:26 agc Exp $");
__RCSID("$NetBSD: cmds.c,v 1.17 2004/10/30 08:44:26 dsl Exp $");
#endif
#endif /* not lint */
@ -1036,14 +1036,14 @@ doarg(char *job)
/*
* Check for job specified by number (example: 112 or 235ucbarpa).
*/
if (isdigit(*job)) {
if (isdigit((unsigned char)*job)) {
jobnum = 0;
do
jobnum = jobnum * 10 + (*job++ - '0');
while (isdigit(*job));
while (isdigit((unsigned char)*job));
for (qq = queue + nitems; --qq >= queue; ) {
n = 0;
for (cp = (*qq)->q_name+3; isdigit(*cp); )
for (cp = (*qq)->q_name+3; isdigit((unsigned char)*cp); )
n = n * 10 + (*cp++ - '0');
if (jobnum != n)
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lpc.c,v 1.15 2003/08/07 11:25:27 agc Exp $ */
/* $NetBSD: lpc.c,v 1.16 2004/10/30 08:44:26 dsl Exp $ */
/*
* Copyright (c) 1983, 1993
@ -37,7 +37,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)lpc.c 8.3 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: lpc.c,v 1.15 2003/08/07 11:25:27 agc Exp $");
__RCSID("$NetBSD: lpc.c,v 1.16 2004/10/30 08:44:26 dsl Exp $");
#endif
#endif /* not lint */
@ -210,13 +210,13 @@ makeargv(void)
margc = 0;
for (cp = cmdline; *cp && (cp - cmdline) < sizeof(cmdline) &&
n < MAX_MARGV; n++) {
while (isspace(*cp))
while (isspace((unsigned char)*cp))
cp++;
if (*cp == '\0')
break;
*argp++ = cp;
margc += 1;
while (*cp != '\0' && !isspace(*cp))
while (*cp != '\0' && !isspace((unsigned char)*cp))
cp++;
if (*cp == '\0')
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lpd.c,v 1.49 2003/10/16 06:30:11 itojun Exp $ */
/* $NetBSD: lpd.c,v 1.50 2004/10/30 08:44:26 dsl Exp $ */
/*
* Copyright (c) 1983, 1993, 1994
@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993, 1994\n\
#if 0
static char sccsid[] = "@(#)lpd.c 8.7 (Berkeley) 5/10/95";
#else
__RCSID("$NetBSD: lpd.c,v 1.49 2003/10/16 06:30:11 itojun Exp $");
__RCSID("$NetBSD: lpd.c,v 1.50 2004/10/30 08:44:26 dsl Exp $");
#endif
#endif /* not lint */
@ -458,11 +458,11 @@ doit(void)
continue;
}
*cp++ = '\0';
while (isspace(*cp))
while (isspace((unsigned char)*cp))
cp++;
if (*cp == '\0')
break;
if (isdigit(*cp)) {
if (isdigit((unsigned char)*cp)) {
if (requests >= MAXREQUESTS)
fatal("Too many requests");
requ[requests++] = atoi(cp);
@ -494,11 +494,11 @@ doit(void)
continue;
}
*cp++ = '\0';
while (isspace(*cp))
while (isspace((unsigned char)*cp))
cp++;
if (*cp == '\0')
break;
if (isdigit(*cp)) {
if (isdigit((unsigned char)*cp)) {
if (requests >= MAXREQUESTS)
fatal("Too many requests");
requ[requests++] = atoi(cp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: printjob.c,v 1.40 2004/08/26 13:05:14 wiz Exp $ */
/* $NetBSD: printjob.c,v 1.41 2004/10/30 08:44:26 dsl Exp $ */
/*
* Copyright (c) 1983, 1993
@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)printjob.c 8.7 (Berkeley) 5/10/95";
#else
__RCSID("$NetBSD: printjob.c,v 1.40 2004/08/26 13:05:14 wiz Exp $");
__RCSID("$NetBSD: printjob.c,v 1.41 2004/10/30 08:44:26 dsl Exp $");
#endif
#endif /* not lint */
@ -1088,7 +1088,7 @@ sendmail(char *user, int bombed)
struct stat stb;
FILE *fp;
if (user[0] == '-' || user[0] == '/' || !isprint(user[0]))
if (user[0] == '-' || user[0] == '/' || !isprint((unsigned char)user[0]))
return;
pipe(p);
if ((s = dofork(DORETURN)) == 0) { /* child */

View File

@ -1,4 +1,4 @@
/* $NetBSD: lpq.c,v 1.14 2003/09/01 00:21:09 itojun Exp $ */
/* $NetBSD: lpq.c,v 1.15 2004/10/30 08:44:26 dsl Exp $ */
/*
* Copyright (c) 1983, 1993
@ -37,7 +37,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)lpq.c 8.3 (Berkeley) 5/10/95";
#else
__RCSID("$NetBSD: lpq.c,v 1.14 2003/09/01 00:21:09 itojun Exp $");
__RCSID("$NetBSD: lpq.c,v 1.15 2004/10/30 08:44:26 dsl Exp $");
#endif
#endif /* not lint */
@ -119,7 +119,7 @@ main(int argc, char *argv[])
printer = DEFLP;
for (argc -= optind, argv += optind; argc; --argc, ++argv)
if (isdigit(argv[0][0])) {
if (isdigit((unsigned char)argv[0][0])) {
if (requests >= MAXREQUESTS)
fatal("too many requests");
requ[requests++] = atoi(*argv);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lpr.c,v 1.29 2003/08/07 11:25:30 agc Exp $ */
/* $NetBSD: lpr.c,v 1.30 2004/10/30 08:44:26 dsl Exp $ */
/*
* Copyright (c) 1983, 1989, 1993
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)lpr.c 8.4 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: lpr.c,v 1.29 2003/08/07 11:25:30 agc Exp $");
__RCSID("$NetBSD: lpr.c,v 1.30 2004/10/30 08:44:26 dsl Exp $");
#endif
#endif /* not lint */
@ -153,7 +153,7 @@ main(int argc, char *argv[])
switch (c) {
case '#': /* n copies */
if (isdigit(*optarg)) {
if (isdigit((unsigned char)*optarg)) {
i = atoi(optarg);
if (i > 0)
ncopies = i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lprm.c,v 1.15 2003/08/07 11:25:30 agc Exp $ */
/* $NetBSD: lprm.c,v 1.16 2004/10/30 08:44:26 dsl Exp $ */
/*
* Copyright (c) 1983, 1993
@ -37,7 +37,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)lprm.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lprm.c,v 1.15 2003/08/07 11:25:30 agc Exp $");
__RCSID("$NetBSD: lprm.c,v 1.16 2004/10/30 08:44:26 dsl Exp $");
#endif
#endif /* not lint */
@ -136,7 +136,7 @@ main(int argc, char *argv[])
else {
if (users < 0)
usage();
if (isdigit(arg[0])) {
if (isdigit((unsigned char)arg[0])) {
if (requests >= MAXREQUESTS)
fatal("Too many requests");
requ[requests++] = atoi(arg);