8bit cleaness (ctype) fixes

This commit is contained in:
Andrey A. Chernov 1996-08-11 19:20:30 +00:00
parent b7c6d4477a
commit 6f99f89bbe
6 changed files with 18 additions and 16 deletions

View File

@ -148,7 +148,7 @@ protected int
ce__isword(p)
int p;
{
return isalpha(p) || isdigit(p) || strchr("*?_-.[]~=", p) != NULL;
return isalpha((unsigned char) p) || isdigit((unsigned char) p) || strchr("*?_-.[]~=", p) != NULL;
}
@ -159,7 +159,7 @@ protected int
cv__isword(p)
int p;
{
return !isspace(p);
return !isspace((unsigned char) p);
}

View File

@ -256,7 +256,7 @@ ed_move_to_beg(el, c)
if (el->el_map.type == MAP_VI) {
/* We want FIRST non space character */
while (isspace(*el->el_line.cursor))
while (isspace((unsigned char) *el->el_line.cursor))
el->el_line.cursor++;
if (el->el_chared.c_vcmd.action & DELETE) {
cv_delfini(el);
@ -408,7 +408,7 @@ ed_digit(el, c)
EditLine *el;
int c;
{
if (!isdigit(c))
if (!isdigit((unsigned char) c))
return CC_ERROR;
if (el->el_state.doingarg) {
@ -451,7 +451,7 @@ ed_argument_digit(el, c)
EditLine *el;
register int c;
{
if (!isdigit(c))
if (!isdigit((unsigned char) c))
return CC_ERROR;
if (el->el_state.doingarg) {

View File

@ -298,8 +298,8 @@ em_upper_case(el, c)
el->el_state.argument, ce__isword);
for (cp = el->el_line.cursor; cp < ep; cp++)
if (islower(*cp))
*cp = toupper(*cp);
if (islower((unsigned char)*cp))
*cp = toupper((unsigned char)*cp);
el->el_line.cursor = ep;
if (el->el_line.cursor > el->el_line.lastchar)
@ -324,16 +324,16 @@ em_capitol_case(el, c)
el->el_state.argument, ce__isword);
for (cp = el->el_line.cursor; cp < ep; cp++) {
if (isalpha(*cp)) {
if (islower(*cp))
*cp = toupper(*cp);
if (isalpha((unsigned char)*cp)) {
if (islower((unsigned char)*cp))
*cp = toupper((unsigned char)*cp);
cp++;
break;
}
}
for (; cp < ep; cp++)
if (isupper(*cp))
*cp = tolower(*cp);
if (isupper((unsigned char)*cp))
*cp = tolower((unsigned char)*cp);
el->el_line.cursor = ep;
if (el->el_line.cursor > el->el_line.lastchar)
@ -357,8 +357,8 @@ em_lower_case(el, c)
el->el_state.argument, ce__isword);
for (cp = el->el_line.cursor; cp < ep; cp++)
if (isupper(*cp))
*cp = tolower(*cp);
if (isupper((unsigned char)*cp))
*cp = tolower((unsigned char)*cp);
el->el_line.cursor = ep;
if (el->el_line.cursor > el->el_line.lastchar)

View File

@ -640,6 +640,8 @@ key__decode_char(buf, cnt, ch)
char *buf;
int cnt, ch;
{
ch &= 0xFF;
if (ch == 0) {
buf[cnt++] = '^';
buf[cnt] = '@';

View File

@ -43,7 +43,6 @@ static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93";
*/
#include "sys.h"
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <string.h>
@ -98,6 +97,7 @@ re_addc(el, c)
int c;
{
c &= 0xFF;
if (isprint(c)) {
re_putc(el, c);
return;

View File

@ -277,7 +277,7 @@ vi_change_case(el, c)
int c;
{
if (el->el_line.cursor < el->el_line.lastchar) {
c = *el->el_line.cursor;
c = *el->el_line.cursor & 0xFF;
if (isupper(c))
*el->el_line.cursor++ = tolower(c);
else if (islower(c))