char->unsigned char casts for is*()
This commit is contained in:
parent
30d3c9f1b4
commit
1f3392af64
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: c_ksh.c,v 1.3 1998/08/19 01:43:22 thorpej Exp $ */
|
||||
/* $NetBSD: c_ksh.c,v 1.4 1998/11/04 18:27:20 christos Exp $ */
|
||||
|
||||
/*
|
||||
* built-in Korn commands: c_*
|
||||
@ -1123,7 +1123,8 @@ c_kill(wp)
|
||||
int i, n, rv, sig;
|
||||
|
||||
/* assume old style options if -digits or -UPPERCASE */
|
||||
if ((p = wp[1]) && *p == '-' && (digit(p[1]) || isupper(p[1]))) {
|
||||
if ((p = wp[1]) && *p == '-' && (digit(p[1]) ||
|
||||
isupper((unsigned char)p[1]))) {
|
||||
if (!(t = gettrap(p + 1))) {
|
||||
bi_errorf("bad signal `%s'", p + 1);
|
||||
return 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: edit.c,v 1.3 1997/07/20 17:42:00 christos Exp $ */
|
||||
/* $NetBSD: edit.c,v 1.4 1998/11/04 18:27:21 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Command line editing - common code
|
||||
@ -707,7 +707,7 @@ x_command_glob(flags, str, slen, wordsp)
|
||||
return nwords;
|
||||
}
|
||||
|
||||
#define IS_WORDC(c) !isspace(c)
|
||||
#define IS_WORDC(c) !isspace((unsigned char)c)
|
||||
|
||||
static int
|
||||
x_locate_word(buf, buflen, pos, startp, is_commandp)
|
||||
@ -750,7 +750,7 @@ x_locate_word(buf, buflen, pos, startp, is_commandp)
|
||||
int iscmd;
|
||||
|
||||
/* Figure out if this is a command */
|
||||
for (p = start - 1; p >= 0 && isspace(buf[p]); p--)
|
||||
for (p = start - 1; p >= 0 && isspace((unsigned char)buf[p]); p--)
|
||||
;
|
||||
iscmd = p < 0 || strchr(";|&()", buf[p]);
|
||||
if (iscmd) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: emacs.c,v 1.4 1998/03/29 04:39:03 mrg Exp $ */
|
||||
/* $NetBSD: emacs.c,v 1.5 1998/11/04 18:27:21 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Emacs-like command line editing and history
|
||||
@ -51,7 +51,7 @@ struct x_defbindings {
|
||||
|
||||
/* Separator for completion */
|
||||
#define is_cfs(c) (c == ' ' || c == '\t' || c == '"' || c == '\'')
|
||||
#define is_mfs(c) (!(isalnum(c) || c == '_' || c == '$')) /* Separator for motion */
|
||||
#define is_mfs(c) (!(isalnum((unsigned char)c) || c == '_' || c == '$')) /* Separator for motion */
|
||||
|
||||
#ifdef OS2
|
||||
/* Deal with 8 bit chars & an extra prefix for function key (these two
|
||||
@ -2119,10 +2119,10 @@ x_fold_case(c)
|
||||
*/
|
||||
if (cp != xep) {
|
||||
if (c == 'L') { /* lowercase */
|
||||
if (isupper(*cp))
|
||||
if (isupper((unsigned char)*cp))
|
||||
*cp = tolower(*cp);
|
||||
} else { /* uppercase, capitialize */
|
||||
if (islower(*cp))
|
||||
if (islower((unsigned char)*cp))
|
||||
*cp = toupper(*cp);
|
||||
}
|
||||
cp++;
|
||||
@ -2130,12 +2130,12 @@ x_fold_case(c)
|
||||
/*
|
||||
* now for the rest of the word
|
||||
*/
|
||||
while (cp != xep && !is_mfs(*cp)) {
|
||||
while (cp != xep && !is_mfs((unsigned char)*cp)) {
|
||||
if (c == 'U') { /* uppercase */
|
||||
if (islower(*cp))
|
||||
if (islower((unsigned char)*cp))
|
||||
*cp = toupper(*cp);
|
||||
} else { /* lowercase, capitialize */
|
||||
if (isupper(*cp))
|
||||
if (isupper((unsigned char)*cp))
|
||||
*cp = tolower(*cp);
|
||||
}
|
||||
cp++;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: io.c,v 1.3 1998/08/19 01:43:22 thorpej Exp $ */
|
||||
/* $NetBSD: io.c,v 1.4 1998/11/04 18:27:21 christos Exp $ */
|
||||
|
||||
/*
|
||||
* shell buffered IO and formatted output
|
||||
@ -284,7 +284,7 @@ check_fd(name, mode, emsgp)
|
||||
{
|
||||
int fd, fl;
|
||||
|
||||
if (isdigit(name[0]) && !name[1]) {
|
||||
if (isdigit((unsigned char)name[0]) && !name[1]) {
|
||||
fd = name[0] - '0';
|
||||
if ((fl = fcntl(fd = name[0] - '0', F_GETFL, 0)) < 0) {
|
||||
if (emsgp)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lex.c,v 1.4 1998/08/19 01:43:22 thorpej Exp $ */
|
||||
/* $NetBSD: lex.c,v 1.5 1998/11/04 18:27:21 christos Exp $ */
|
||||
|
||||
/*
|
||||
* lexical analysis and source input
|
||||
@ -841,7 +841,7 @@ getsc__()
|
||||
source->flags |= s->flags & SF_ALIAS;
|
||||
s = source;
|
||||
} else if (*s->u.tblp->val.s
|
||||
&& isspace(strchr(s->u.tblp->val.s, 0)[-1]))
|
||||
&& isspace((unsigned char)strchr(s->u.tblp->val.s, 0)[-1]))
|
||||
{
|
||||
source = s = s->next; /* pop source stack */
|
||||
/* Note that this alias ended with a space,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.c,v 1.4 1998/08/19 01:43:23 thorpej Exp $ */
|
||||
/* $NetBSD: var.c,v 1.5 1998/11/04 18:27:21 christos Exp $ */
|
||||
|
||||
#include "sh.h"
|
||||
#include "ksh_time.h"
|
||||
@ -504,7 +504,7 @@ formatstr(vp, s)
|
||||
if (vp->flag & RJUST) {
|
||||
const char *q = s + olen;
|
||||
/* strip trailing spaces (at&t ksh uses q[-1] == ' ') */
|
||||
while (q > s && isspace(q[-1]))
|
||||
while (q > s && isspace((unsigned char)q[-1]))
|
||||
--q;
|
||||
slen = q - s;
|
||||
if (slen > vp->u2.field) {
|
||||
@ -517,7 +517,7 @@ formatstr(vp, s)
|
||||
vp->u2.field - slen, null, slen, s);
|
||||
} else {
|
||||
/* strip leading spaces/zeros */
|
||||
while (isspace(*s))
|
||||
while (isspace((unsigned char)*s))
|
||||
s++;
|
||||
if (vp->flag & ZEROFIL)
|
||||
while (*s == '0')
|
||||
@ -530,11 +530,11 @@ formatstr(vp, s)
|
||||
|
||||
if (vp->flag & UCASEV_AL) {
|
||||
for (q = p; *q; q++)
|
||||
if (islower(*q))
|
||||
if (islower((unsigned char)*q))
|
||||
*q = toupper(*q);
|
||||
} else if (vp->flag & LCASEV) {
|
||||
for (q = p; *q; q++)
|
||||
if (isupper(*q))
|
||||
if (isupper((unsigned char)*q))
|
||||
*q = tolower(*q);
|
||||
}
|
||||
|
||||
|
44
bin/ksh/vi.c
44
bin/ksh/vi.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vi.c,v 1.2 1997/01/12 19:12:28 tls Exp $ */
|
||||
/* $NetBSD: vi.c,v 1.3 1998/11/04 18:27:21 christos Exp $ */
|
||||
|
||||
/*
|
||||
* vi command editing
|
||||
@ -444,9 +444,9 @@ vi_hook(ch)
|
||||
int i;
|
||||
int n = srchlen;
|
||||
|
||||
while (n > 0 && isspace(locpat[n - 1]))
|
||||
while (n > 0 && isspace((unsigned char)locpat[n - 1]))
|
||||
n--;
|
||||
while (n > 0 && !isspace(locpat[n - 1]))
|
||||
while (n > 0 && !isspace((unsigned char)locpat[n - 1]))
|
||||
n--;
|
||||
for (i = srchlen; --i >= n; )
|
||||
es->linelen -= char_len((unsigned char) locpat[i]);
|
||||
@ -818,8 +818,8 @@ vi_cmd(argcnt, cmd)
|
||||
return -1;
|
||||
if (*cmd == 'c' &&
|
||||
(cmd[1]=='w' || cmd[1]=='W') &&
|
||||
!isspace(es->cbuf[es->cursor])) {
|
||||
while (isspace(es->cbuf[--ncursor]))
|
||||
!isspace((unsigned char)es->cbuf[es->cursor])) {
|
||||
while (isspace((unsigned char)es->cbuf[--ncursor]))
|
||||
;
|
||||
ncursor++;
|
||||
}
|
||||
@ -1051,7 +1051,7 @@ vi_cmd(argcnt, cmd)
|
||||
if (histnum(-1) < 0)
|
||||
return -1;
|
||||
p = *histpos();
|
||||
#define issp(c) (isspace((c)) || (c) == '\n')
|
||||
#define issp(c) (isspace((unsigned char)(c)) || (c) == '\n')
|
||||
if (argcnt) {
|
||||
while (*p && issp(*p))
|
||||
p++;
|
||||
@ -1106,10 +1106,10 @@ vi_cmd(argcnt, cmd)
|
||||
return -1;
|
||||
for (i = 0; i < argcnt; i++) {
|
||||
p = &es->cbuf[es->cursor];
|
||||
if (islower(*p)) {
|
||||
if (islower((unsigned char)*p)) {
|
||||
modified = 1; hnum = hlast;
|
||||
*p = toupper(*p);
|
||||
} else if (isupper(*p)) {
|
||||
} else if (isupper((unsigned char)*p)) {
|
||||
modified = 1; hnum = hlast;
|
||||
*p = tolower(*p);
|
||||
}
|
||||
@ -1259,7 +1259,7 @@ domove(argcnt, cmd, sub)
|
||||
|
||||
case '^':
|
||||
ncursor = 0;
|
||||
while (ncursor < es->linelen - 1 && isspace(es->cbuf[ncursor]))
|
||||
while (ncursor < es->linelen - 1 && isspace((unsigned char)es->cbuf[ncursor]))
|
||||
ncursor++;
|
||||
break;
|
||||
|
||||
@ -1549,12 +1549,12 @@ forwword(argcnt)
|
||||
while (is_wordch(es->cbuf[ncursor]) &&
|
||||
ncursor < es->linelen)
|
||||
ncursor++;
|
||||
else if (!isspace(es->cbuf[ncursor]))
|
||||
else if (!isspace((unsigned char)es->cbuf[ncursor]))
|
||||
while (!is_wordch(es->cbuf[ncursor]) &&
|
||||
!isspace(es->cbuf[ncursor]) &&
|
||||
!isspace((unsigned char)es->cbuf[ncursor]) &&
|
||||
ncursor < es->linelen)
|
||||
ncursor++;
|
||||
while (isspace(es->cbuf[ncursor]) && ncursor < es->linelen)
|
||||
while (isspace((unsigned char)es->cbuf[ncursor]) && ncursor < es->linelen)
|
||||
ncursor++;
|
||||
}
|
||||
return ncursor;
|
||||
@ -1568,7 +1568,7 @@ backword(argcnt)
|
||||
|
||||
ncursor = es->cursor;
|
||||
while (ncursor > 0 && argcnt--) {
|
||||
while (--ncursor > 0 && isspace(es->cbuf[ncursor]))
|
||||
while (--ncursor > 0 && isspace((unsigned char)es->cbuf[ncursor]))
|
||||
;
|
||||
if (ncursor > 0) {
|
||||
if (is_wordch(es->cbuf[ncursor]))
|
||||
@ -1578,7 +1578,7 @@ backword(argcnt)
|
||||
else
|
||||
while (--ncursor >= 0 &&
|
||||
!is_wordch(es->cbuf[ncursor]) &&
|
||||
!isspace(es->cbuf[ncursor]))
|
||||
!isspace((unsigned char)es->cbuf[ncursor]))
|
||||
;
|
||||
ncursor++;
|
||||
}
|
||||
@ -1595,7 +1595,7 @@ endword(argcnt)
|
||||
ncursor = es->cursor;
|
||||
while (ncursor < es->linelen && argcnt--) {
|
||||
while (++ncursor < es->linelen - 1 &&
|
||||
isspace(es->cbuf[ncursor]))
|
||||
isspace((unsigned char)es->cbuf[ncursor]))
|
||||
;
|
||||
if (ncursor < es->linelen - 1) {
|
||||
if (is_wordch(es->cbuf[ncursor]))
|
||||
@ -1605,7 +1605,7 @@ endword(argcnt)
|
||||
else
|
||||
while (++ncursor < es->linelen &&
|
||||
!is_wordch(es->cbuf[ncursor]) &&
|
||||
!isspace(es->cbuf[ncursor]))
|
||||
!isspace((unsigned char)es->cbuf[ncursor]))
|
||||
;
|
||||
ncursor--;
|
||||
}
|
||||
@ -1621,9 +1621,9 @@ Forwword(argcnt)
|
||||
|
||||
ncursor = es->cursor;
|
||||
while (ncursor < es->linelen && argcnt--) {
|
||||
while (!isspace(es->cbuf[ncursor]) && ncursor < es->linelen)
|
||||
while (!isspace((unsigned char)es->cbuf[ncursor]) && ncursor < es->linelen)
|
||||
ncursor++;
|
||||
while (isspace(es->cbuf[ncursor]) && ncursor < es->linelen)
|
||||
while (isspace((unsigned char)es->cbuf[ncursor]) && ncursor < es->linelen)
|
||||
ncursor++;
|
||||
}
|
||||
return ncursor;
|
||||
@ -1637,9 +1637,9 @@ Backword(argcnt)
|
||||
|
||||
ncursor = es->cursor;
|
||||
while (ncursor > 0 && argcnt--) {
|
||||
while (--ncursor >= 0 && isspace(es->cbuf[ncursor]))
|
||||
while (--ncursor >= 0 && isspace((unsigned char)es->cbuf[ncursor]))
|
||||
;
|
||||
while (ncursor >= 0 && !isspace(es->cbuf[ncursor]))
|
||||
while (ncursor >= 0 && !isspace((unsigned char)es->cbuf[ncursor]))
|
||||
ncursor--;
|
||||
ncursor++;
|
||||
}
|
||||
@ -1655,11 +1655,11 @@ Endword(argcnt)
|
||||
ncursor = es->cursor;
|
||||
while (ncursor < es->linelen - 1 && argcnt--) {
|
||||
while (++ncursor < es->linelen - 1 &&
|
||||
isspace(es->cbuf[ncursor]))
|
||||
isspace((unsigned char)es->cbuf[ncursor]))
|
||||
;
|
||||
if (ncursor < es->linelen - 1) {
|
||||
while (++ncursor < es->linelen &&
|
||||
!isspace(es->cbuf[ncursor]))
|
||||
!isspace((unsigned char)es->cbuf[ncursor]))
|
||||
;
|
||||
ncursor--;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user