From: mmcc Date: Thu, 15 Oct 2015 19:36:50 +0000 (+0000) Subject: Introduce an unsigned char variable for the ctype function calls. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=377d16625ed7cec352f160ecd6b60dc129e4e985;p=openbsd Introduce an unsigned char variable for the ctype function calls. ok millert@ --- diff --git a/bin/ksh/vi.c b/bin/ksh/vi.c index 6888204c212..8c6c98ec2d4 100644 --- a/bin/ksh/vi.c +++ b/bin/ksh/vi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vi.c,v 1.33 2015/09/18 07:28:24 nicm Exp $ */ +/* $OpenBSD: vi.c,v 1.34 2015/10/15 19:36:50 mmcc Exp $ */ /* * vi command editing @@ -1082,18 +1082,20 @@ vi_cmd(int argcnt, const char *cmd) case '~': { char *p; + unsigned char c; int i; if (es->linelen == 0) return -1; for (i = 0; i < argcnt; i++) { p = &es->cbuf[es->cursor]; - if (islower((unsigned char)*p)) { + c = (unsigned char)*p; + if (islower(c)) { modified = 1; hnum = hlast; - *p = toupper(*p); - } else if (isupper((unsigned char)*p)) { + *p = toupper(c); + } else if (isupper(c)) { modified = 1; hnum = hlast; - *p = tolower(*p); + *p = tolower(c); } if (es->cursor < es->linelen - 1) es->cursor++;