Correct ctype(3) usage.

Passing "char" value is wrong.  Use "unsigned char" instead.
This commit is contained in:
itohy 2000-07-11 06:07:25 +00:00
parent 4f051180a0
commit f9863c47b3
8 changed files with 29 additions and 28 deletions

View File

@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: regexp.c,v 1.12 1999/09/16 09:57:06 lukem Exp $");
__RCSID("$NetBSD: regexp.c,v 1.13 2000/07/11 06:07:25 itohy Exp $");
#endif /* not lint */
#include <ctype.h>
@ -924,16 +924,17 @@ char *prog;
break;
case WORDA:
/* Must be looking at a letter, digit, or _ */
if ((!isalnum(*reginput)) && *reginput != '_')
if ((!isalnum(UCHARAT(reginput))) && *reginput != '_')
return(0);
/* Prev must be BOL or nonword */
if (reginput > regbol &&
(isalnum(reginput[-1]) || reginput[-1] == '_'))
(isalnum(UCHARAT(reginput - 1))
|| reginput[-1] == '_'))
return(0);
break;
case WORDZ:
/* Must be looking at non letter, digit, or _ */
if (isalnum(*reginput) || *reginput == '_')
if (isalnum(UCHARAT(reginput)) || *reginput == '_')
return(0);
/* We don't care what the previous char was */
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: driver.c,v 1.5 2000/04/20 12:17:57 blymn Exp $ */
/* $NetBSD: driver.c,v 1.6 2000/07/11 06:07:26 itohy Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au)
@ -216,10 +216,10 @@ menu_driver(MENU *menu, int c)
} else if (c > MAX_COMMAND) {
/* must be a user command */
return E_UNKNOWN_COMMAND;
} else if (isprint((char) c)) {
} else if (isprint((unsigned char) c)) {
/* otherwise search items for the character. */
status = _menui_match_pattern(menu, c, MATCH_FORWARD,
&it);
status = _menui_match_pattern(menu, (unsigned char) c,
MATCH_FORWARD, &it);
drv_new_item = menu->items[it];
/* update the position of the cursor if we are doing

View File

@ -1,4 +1,4 @@
/* $NetBSD: internals.c,v 1.6 2000/04/20 12:17:57 blymn Exp $ */
/* $NetBSD: internals.c,v 1.7 2000/07/11 06:07:26 itohy Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au)
@ -331,7 +331,7 @@ _menui_match_items(MENU *menu, int direction, int *item_matched)
* index of the item that matched the pattern.
*/
int
_menui_match_pattern(MENU *menu, char c, int direction, int *item_matched)
_menui_match_pattern(MENU *menu, int c, int direction, int *item_matched)
{
if (menu == NULL)
return E_BAD_ARGUMENT;

View File

@ -1,4 +1,4 @@
/* $NetBSD: internals.h,v 1.6 2000/04/20 12:17:57 blymn Exp $ */
/* $NetBSD: internals.h,v 1.7 2000/07/11 06:07:26 itohy Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au)
@ -44,7 +44,7 @@
void _menui_draw_item(MENU *menu, int item);
int _menui_draw_menu(MENU *menu);
int _menui_goto_item(MENU *menu, ITEM *item, int new_top_row);
int _menui_match_pattern(MENU *menu, char c, int direction ,
int _menui_match_pattern(MENU *menu, int c, int direction ,
int *item_matched);
int _menui_match_items(MENU *menu, int direction, int *item_matched);
void _menui_max_item_size(MENU *menu);

View File

@ -1,4 +1,4 @@
/* $NetBSD: menu.c,v 1.8 2000/05/07 12:14:44 blymn Exp $ */
/* $NetBSD: menu.c,v 1.9 2000/07/11 06:07:27 itohy Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au)
@ -365,7 +365,7 @@ set_menu_pattern(MENU *param_menu, char *pat)
/* check pattern is all printable characters */
while (*p)
if (!isprint(*p++)) return E_BAD_ARGUMENT;
if (!isprint((unsigned char) *p++)) return E_BAD_ARGUMENT;
if ((menu->pattern = (char *) realloc(menu->pattern,
sizeof(char) * strlen(pat))) == NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: skeylogin.c,v 1.14 2000/07/06 22:30:19 mjl Exp $ */
/* $NetBSD: skeylogin.c,v 1.15 2000/07/11 06:07:27 itohy Exp $ */
/* S/KEY v1.1b (skeylogin.c)
*
@ -146,7 +146,7 @@ int skeylookup(struct skey *mp, const char *name)
if ((cp = strtok(NULL, " \t")) == NULL)
continue;
/* Save hash type if specified, else use md4 */
if (isalpha(*cp)) {
if (isalpha((u_char) *cp)) {
ht = cp;
if ((cp = strtok(NULL, " \t")) == NULL)
continue;
@ -208,7 +208,7 @@ int skeygetnext(struct skey *mp)
if ((cp = strtok(NULL, " \t")) == NULL)
continue;
/* Save hash type if specified, else use md4 */
if (isalpha(*cp)) {
if (isalpha((u_char) *cp)) {
if ((cp = strtok(NULL, " \t")) == NULL)
continue;
}
@ -295,7 +295,7 @@ int skeyverify(struct skey *mp, char *response)
rip(mp->buf);
mp->logname = strtok(mp->buf, " \t");
cp = strtok(NULL, " \t") ;
if (isalpha(*cp))
if (isalpha((u_char) *cp))
cp = strtok(NULL, " \t") ;
mp->seed = strtok(NULL, " \t");
mp->val = strtok(NULL, " \t");
@ -453,9 +453,9 @@ int skey_authenticate(const char *username)
if (gethostname(pbuf, sizeof(pbuf)) == -1)
*(p = pbuf) = '.';
else
for (p = pbuf; *p && isalnum(*p); p++)
if (isalpha(*p) && isupper(*p))
*p = tolower(*p);
for (p = pbuf; *p && isalnum((u_char) *p); p++)
if (isalpha((u_char)*p) && isupper((u_char)*p))
*p = tolower((u_char)*p);
if (*p && pbuf - p < 4)
(void)strncpy(p, "asjd", 4 - (pbuf - p));
pbuf[4] = '\0';

View File

@ -1,4 +1,4 @@
/* $NetBSD: skeysubr.c,v 1.17 2000/07/08 11:48:40 kleink Exp $ */
/* $NetBSD: skeysubr.c,v 1.18 2000/07/11 06:07:27 itohy Exp $ */
/* S/KEY v1.1b (skeysubr.c)
*
@ -510,9 +510,9 @@ static void skey_echo(int action)
/* Convert string to lower case */
static void lowcase(char *s)
{
char *p;
u_char *p;
for (p = s; *p; p++)
for (p = (u_char *) s; *p; p++)
if (isupper(*p))
*p = tolower(*p);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: passwd.c,v 1.23 2000/07/07 10:32:48 ad Exp $ */
/* $NetBSD: passwd.c,v 1.24 2000/07/11 06:07:27 itohy Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: passwd.c,v 1.23 2000/07/07 10:32:48 ad Exp $");
__RCSID("$NetBSD: passwd.c,v 1.24 2000/07/11 06:07:27 itohy Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -338,13 +338,13 @@ trim_whitespace(char *line)
/* Remove leading spaces */
p = line;
while (isspace(*p))
while (isspace((unsigned char) *p))
p++;
memmove(line, p, strlen(p) + 1);
/* Remove trailing spaces */
p = line + strlen(line) - 1;
while (isspace(*p))
while (isspace((unsigned char) *p))
p--;
*(p + 1) = '\0';
}