From 377d16625ed7cec352f160ecd6b60dc129e4e985 Mon Sep 17 00:00:00 2001 From: mmcc Date: Thu, 15 Oct 2015 19:36:50 +0000 Subject: [PATCH] Introduce an unsigned char variable for the ctype function calls. ok millert@ --- bin/ksh/vi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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++; -- 2.20.1