From 354f351aa4b5ff26ce2b73b429e07b6d75c825a3 Mon Sep 17 00:00:00 2001 From: mmcc Date: Sat, 24 Oct 2015 17:20:18 +0000 Subject: Cast ctype functions' arguments to unsigned char. ok guenther@ --- games/battlestar/cypher.c | 5 +++-- games/battlestar/getcom.c | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'games/battlestar') diff --git a/games/battlestar/cypher.c b/games/battlestar/cypher.c index 8200b6666b2..1b8e2b123a2 100644 --- a/games/battlestar/cypher.c +++ b/games/battlestar/cypher.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cypher.c,v 1.17 2009/10/27 23:59:23 deraadt Exp $ */ +/* $OpenBSD: cypher.c,v 1.18 2015/10/24 17:20:17 mmcc Exp $ */ /* $NetBSD: cypher.c,v 1.3 1995/03/21 15:07:15 cgd Exp $ */ /* @@ -472,7 +472,8 @@ inc_wordnumber(const char *v, const char *adv) { wordnumber++; if (wordnumber >= wordcount) { - printf("%c%s %s?\n", toupper(v[0]), v + 1, adv); + printf("%c%s %s?\n", + toupper((unsigned char)v[0]), v + 1, adv); return(-1); } return(0); diff --git a/games/battlestar/getcom.c b/games/battlestar/getcom.c index 957963fb238..89968c8c1be 100644 --- a/games/battlestar/getcom.c +++ b/games/battlestar/getcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getcom.c,v 1.14 2009/10/27 23:59:24 deraadt Exp $ */ +/* $OpenBSD: getcom.c,v 1.15 2015/10/24 17:20:17 mmcc Exp $ */ /* $NetBSD: getcom.c,v 1.3 1995/03/21 15:07:30 cgd Exp $ */ /* @@ -43,7 +43,7 @@ getcom(char *buf, int size, const char *prompt, const char *error) clearerr(stdin); continue; } - while (isspace(*buf)) + while (isspace((unsigned char)*buf)) buf++; if (*buf) break; @@ -70,26 +70,26 @@ getword(char *buf1, char *buf2, int flag) int cnt; cnt = 1; - while (isspace(*buf1)) + while (isspace((unsigned char)*buf1)) buf1++; if (*buf1 != ',' && *buf1 != '.') { if (!*buf1) { *buf2 = '\0'; return (0); } - while (cnt < WORDLEN && *buf1 && !isspace(*buf1) && - *buf1 != ',' && *buf1 != '.') + while (cnt < WORDLEN && *buf1 && !isspace((unsigned char)*buf1) && + *buf1 != ',' && *buf1 != '.') if (flag < 0) { - if (isupper(*buf1)) { - *buf2++ = tolower(*buf1++); + if (isupper((unsigned char)*buf1)) { + *buf2++ = tolower((unsigned char)*buf1++); cnt++; } else { *buf2++ = *buf1++; cnt++; } } else if (flag > 0) { - if (islower(*buf1)) { - *buf2++ = toupper(*buf1++); + if (islower((unsigned char)*buf1)) { + *buf2++ = toupper((unsigned char)*buf1++); cnt++; } else { *buf2++ = *buf1++; @@ -100,12 +100,12 @@ getword(char *buf1, char *buf2, int flag) cnt++; } if (cnt == WORDLEN) - while (*buf1 && !isspace(*buf1)) + while (*buf1 && !isspace((unsigned char)*buf1)) buf1++; } else *buf2++ = *buf1++; *buf2 = '\0'; - while (isspace(*buf1)) + while (isspace((unsigned char)*buf1)) buf1++; return (*buf1 ? buf1 : NULL); } -- cgit v1.2.3