diff --git a/common/cut.c b/common/cut.c index 11db42fb..845f28c3 100644 --- a/common/cut.c +++ b/common/cut.c @@ -72,7 +72,7 @@ cut( int flags) { CB *cbp; - CHAR_T name = '\0'; + CHAR_T name = L('\0'); recno_t lno; int append, copy_one, copy_def; @@ -106,10 +106,10 @@ cut( copy_one = 1; cb_rotate(sp); } - if ((append = isupper(name))) { + if ((append = ISUPPER(name))) { if (!copy_one) copy_def = 1; - name = tolower(name); + name = TOLOWER(name); } namecb: CBNAME(sp, cbp, name); } else if (LF_ISSET(CUT_NUMREQ) || (LF_ISSET(CUT_NUMOPT) && diff --git a/common/cut.h b/common/cut.h index 30e9350d..5f633bd7 100644 --- a/common/cut.h +++ b/common/cut.h @@ -67,7 +67,7 @@ struct _text { /* Text: a linked list of lines. */ */ #define CBNAME(sp, cbp, nch) { \ CHAR_T L__name; \ - L__name = isupper(nch) ? tolower(nch) : (nch); \ + L__name = ISUPPER(nch) ? TOLOWER(nch) : (nch); \ SLIST_FOREACH(cbp, sp->gp->cutq, q) \ if (cbp->name == L__name) \ break; \ diff --git a/ex/ex.c b/ex/ex.c index 326a9f2b..ec3281da 100644 --- a/ex/ex.c +++ b/ex/ex.c @@ -429,7 +429,7 @@ loop: ecp = SLIST_FIRST(gp->ecq); break; case 'E': case 'F': case 'N': case 'P': case 'T': case 'V': newscreen = 1; - p[0] = tolower(p[0]); + p[0] = TOLOWER(p[0]); break; } @@ -477,7 +477,7 @@ loop: ecp = SLIST_FIRST(gp->ecq); /* FALLTHROUGH */ default: unknown: if (newscreen) - p[0] = toupper(p[0]); + p[0] = TOUPPER(p[0]); ex_unknown(sp, p, namelen); goto err; } diff --git a/ex/ex_cscope.c b/ex/ex_cscope.c index 3440237b..79a6aba3 100644 --- a/ex/ex_cscope.c +++ b/ex/ex_cscope.c @@ -125,18 +125,18 @@ ex_cscope(SCR *sp, EXCMD *cmdp) /* Skip leading whitespace. */ for (p = cmdp->argv[0]->bp, i = cmdp->argv[0]->len; i > 0; --i, ++p) - if (!isspace(*p)) + if (!ISSPACE(*p)) break; if (i == 0) goto usage; /* Skip the command to any arguments. */ for (cmd = p; i > 0; --i, ++p) - if (isspace(*p)) + if (ISSPACE(*p)) break; - if (*p != '\0') { - *p++ = '\0'; - for (; *p && isspace(*p); ++p); + if (*p != L('\0')) { + *p++ = L('\0'); + for (; *p && ISSPACE(*p); ++p); } INT2CHAR(sp, cmd, STRLEN(cmd) + 1, np, nlen); diff --git a/ex/ex_display.c b/ex/ex_display.c index 6142a44a..9e9c5c7f 100644 --- a/ex/ex_display.c +++ b/ex/ex_display.c @@ -94,7 +94,7 @@ bdisplay(SCR *sp) /* Display regular cut buffers. */ SLIST_FOREACH(cbp, sp->gp->cutq, q) { - if (isdigit(cbp->name)) + if (ISDIGIT(cbp->name)) continue; if (!TAILQ_EMPTY(cbp->textq)) db(sp, cbp, NULL); @@ -103,7 +103,7 @@ bdisplay(SCR *sp) } /* Display numbered buffers. */ SLIST_FOREACH(cbp, sp->gp->cutq, q) { - if (!isdigit(cbp->name)) + if (!ISDIGIT(cbp->name)) continue; if (!TAILQ_EMPTY(cbp->textq)) db(sp, cbp, NULL); diff --git a/ex/ex_join.c b/ex/ex_join.c index 082faf9a..d63ffef0 100644 --- a/ex/ex_join.c +++ b/ex/ex_join.c @@ -37,7 +37,8 @@ ex_join(SCR *sp, EXCMD *cmdp) { recno_t from, to; size_t blen, clen, len, tlen; - int echar = 0, extra, first; + CHAR_T echar = 0; + int extra, first; CHAR_T *bp, *tbp = NULL; CHAR_T *p; @@ -104,8 +105,8 @@ ex_join(SCR *sp, EXCMD *cmdp) */ extra = 0; if (!first && !FL_ISSET(cmdp->iflags, E_C_FORCE)) { - if (isblank(echar)) - for (; len && isblank(*p); --len, ++p); + if (ISBLANK(echar)) + for (; len && ISBLANK(*p); --len, ++p); else if (p[0] != ')') { if (STRCHR(L(".?!"), echar)) { *tbp++ = ' '; @@ -114,7 +115,7 @@ ex_join(SCR *sp, EXCMD *cmdp) } *tbp++ = ' '; ++clen; - for (; len && isblank(*p); --len, ++p); + for (; len && ISBLANK(*p); --len, ++p); } } diff --git a/ex/ex_map.c b/ex/ex_map.c index 60dbfe07..bc72608e 100644 --- a/ex/ex_map.c +++ b/ex/ex_map.c @@ -70,8 +70,8 @@ ex_map(SCR *sp, EXCMD *cmdp) * call it as well. Note, the SEQ_FUNCMAP type is persistent across * screen types, maybe the next screen type will get it right. */ - if (input[0] == '#' && isdigit(input[1])) { - for (p = input + 2; isdigit(*p); ++p); + if (input[0] == L('#') && ISDIGIT(input[1])) { + for (p = input + 2; ISDIGIT(*p); ++p); if (p[0] != '\0') goto nofunc; diff --git a/vi/v_increment.c b/vi/v_increment.c index 0a121a91..2a7c7d83 100644 --- a/vi/v_increment.c +++ b/vi/v_increment.c @@ -127,13 +127,13 @@ v_increment(SCR *sp, VICMD *vp) base = 10; end = beg + 1; ntype = fmt[SDEC]; - if (!isdigit(p[end])) + if (!ISDIGIT(p[end])) goto nonum; } else { decimal: base = 10; end = beg; ntype = fmt[DEC]; - if (!isdigit(p[end])) { + if (!ISDIGIT(p[end])) { nonum: msgq(sp, M_ERR, "181|Cursor not in a number"); return (1); } @@ -152,7 +152,7 @@ nonum: msgq(sp, M_ERR, "181|Cursor not in a number"); } break; case 10: - if (isdigit(p[end])) + if (ISDIGIT(p[end])) continue; break; case 16: diff --git a/vi/v_match.c b/vi/v_match.c index 2fae58e3..2e36f4de 100644 --- a/vi/v_match.c +++ b/vi/v_match.c @@ -144,7 +144,7 @@ nomatch: msgq(sp, M_BERR, "184|No match character on this line"); if (db_get(sp, mp->lno, DBG_FATAL, &p, &len)) return (1); for (p += mp->cno + 1, len -= mp->cno; --len; ++p) - if (!isblank(*p)) + if (!ISBLANK(*p)) return (0); F_SET(vp, VM_LMODE); return (0); diff --git a/vi/v_replace.c b/vi/v_replace.c index 2a7ea979..d95c2997 100644 --- a/vi/v_replace.c +++ b/vi/v_replace.c @@ -172,7 +172,7 @@ next: if (v_event_get(sp, &ev, 0, 0)) p += vp->m_start.cno + cnt; len -= vp->m_start.cno + cnt; if (len != 0 && O_ISSET(sp, O_AUTOINDENT)) - for (; len && isblank(*p); --len, ++p); + for (; len && ISBLANK(*p); --len, ++p); if ((tp = text_init(sp, p, len, len)) == NULL) goto err_ret; diff --git a/vi/v_search.c b/vi/v_search.c index 1d6b2603..690fd1a2 100644 --- a/vi/v_search.c +++ b/vi/v_search.c @@ -224,10 +224,11 @@ v_exaddr(SCR *sp, VICMD *vp, dir_t dir) /* No blanks, just like the z command. */ for (t = cmd + 1, tlen = len - 1; tlen > 0; ++t, --tlen) - if (!isdigit(*t)) + if (!ISDIGIT(*t)) break; if (tlen && - (*t == '-' || *t == '.' || *t == '+' || *t == '^')) { + (*t == L('-') || *t == L('.') || *t == L('+') || + *t == L('^'))) { ++t; --tlen; type = 1; diff --git a/vi/v_sentence.c b/vi/v_sentence.c index ddbc6c70..85f14cb5 100644 --- a/vi/v_sentence.c +++ b/vi/v_sentence.c @@ -72,7 +72,7 @@ v_sentencef(SCR *sp, VICMD *vp) * This may not handle " . " correctly, but it's real unclear * what correctly means in that case. */ - if (cs.cs_flags == CS_EMP || (cs.cs_flags == 0 && isblank(cs.cs_ch))) { + if (cs.cs_flags == CS_EMP || (cs.cs_flags == 0 && ISBLANK(cs.cs_ch))) { if (cs_fblank(sp, &cs)) return (1); if (--cnt == 0) { @@ -93,7 +93,7 @@ v_sentencef(SCR *sp, VICMD *vp) if (cs_next(sp, &cs)) return (1); if (cs.cs_flags == 0 && - isblank(cs.cs_ch) && cs_fblank(sp, &cs)) + ISBLANK(cs.cs_ch) && cs_fblank(sp, &cs)) return (1); goto okret; } @@ -233,11 +233,11 @@ v_sentenceb(SCR *sp, VICMD *vp) if (cs.cs_flags != CS_EOL) break; } - } else if (cs.cs_flags == 0 && !isblank(cs.cs_ch)) + } else if (cs.cs_flags == 0 && !ISBLANK(cs.cs_ch)) for (;;) { if (cs_prev(sp, &cs)) return (1); - if (cs.cs_flags != 0 || isblank(cs.cs_ch)) + if (cs.cs_flags != 0 || ISBLANK(cs.cs_ch)) break; } @@ -280,7 +280,7 @@ ret: slno = cs.cs_lno; } while (!cs.cs_flags && (cs.cs_ch == ')' || cs.cs_ch == ']' || cs.cs_ch == '"' || cs.cs_ch == '\'')); - if ((cs.cs_flags || isblank(cs.cs_ch)) && + if ((cs.cs_flags || ISBLANK(cs.cs_ch)) && cs_fblank(sp, &cs)) return (1); @@ -303,7 +303,7 @@ ret: slno = cs.cs_lno; return (1); if (cs.cs_flags == CS_EOL) continue; - if (cs.cs_flags == 0 && isblank(cs.cs_ch)) + if (cs.cs_flags == 0 && ISBLANK(cs.cs_ch)) continue; break; } @@ -321,7 +321,7 @@ ret: slno = cs.cs_lno; break; default: last = - cs.cs_flags == CS_EOL || isblank(cs.cs_ch) || + cs.cs_flags == CS_EOL || ISBLANK(cs.cs_ch) || cs.cs_ch == ')' || cs.cs_ch == ']' || cs.cs_ch == '"' || cs.cs_ch == '\'' ? 1 : 0; } diff --git a/vi/v_txt.c b/vi/v_txt.c index 1348b278..25a9b6d8 100644 --- a/vi/v_txt.c +++ b/vi/v_txt.c @@ -749,16 +749,16 @@ k_cr: if (LF_ISSET(TXT_CR)) { owrite = tp->owrite; insert = tp->insert; if (LF_ISSET(TXT_REPLACE) && owrite != 0) { - for (p = tp->lb + tp->cno; owrite > 0 && isblank(*p); + for (p = tp->lb + tp->cno; owrite > 0 && ISBLANK(*p); ++p, --owrite, ++tp->R_erase); if (owrite == 0) - for (; insert > 0 && isblank(*p); + for (; insert > 0 && ISBLANK(*p); ++p, ++tp->R_erase, --insert); } else { p = tp->lb + tp->cno + owrite; if (O_ISSET(sp, O_AUTOINDENT)) for (; insert > 0 && - isblank(*p); ++p, --insert); + ISBLANK(*p); ++p, --insert); owrite = 0; } @@ -1291,7 +1291,7 @@ leftmargin: tp->lb[tp->cno - 1] = ' '; goto resolve; } } - if (isblank(evp->e_c) && UNMAP_TST) + if (ISBLANK(evp->e_c) && UNMAP_TST) txt_unmap(sp, tp, &ec_flags); } if (abb != AB_NOTSET) @@ -1341,7 +1341,7 @@ insl_ch: if (txt_insch(sp, tp, &evp->e_c, flags)) if (txt_margin(sp, tp, &wmt, &tmp, flags)) goto err; if (tmp) { - if (isblank(evp->e_c)) + if (ISBLANK(evp->e_c)) wm_skip = 1; wm_set = 1; goto k_cr; @@ -1507,7 +1507,7 @@ txt_abbrev(SCR *sp, TEXT *tp, CHAR_T *pushcp, int isinfoline, int *didsubp, int off = tp->cno - 1; /* Previous character. */ p = tp->lb + off; len = 1; /* One character test. */ - if (off == tp->offset || isblank(p[-1])) + if (off == tp->offset || ISBLANK(p[-1])) goto search; if (inword(p[-1])) /* Move backward to change. */ for (;;) { @@ -1519,7 +1519,7 @@ txt_abbrev(SCR *sp, TEXT *tp, CHAR_T *pushcp, int isinfoline, int *didsubp, int for (;;) { --off; --p; ++len; if (off == tp->offset || - inword(p[-1]) || isblank(p[-1])) + inword(p[-1]) || ISBLANK(p[-1])) break; } @@ -1643,7 +1643,7 @@ txt_unmap(SCR *sp, TEXT *tp, u_int32_t *ec_flagsp) /* Find the beginning of this "word". */ for (off = tp->cno - 1, p = tp->lb + off, len = 0;; --p, --off) { - if (isblank(*p)) { + if (ISBLANK(*p)) { ++p; break; } @@ -1710,7 +1710,7 @@ txt_ai_resolve(SCR *sp, TEXT *tp, int *changedp) /* Figure out the last screen column. */ for (p = tp->lb, scno = 0, len = tp->len, - spaces = tab_after_sp = 0; len-- && isblank(*p); ++p) + spaces = tab_after_sp = 0; len-- && ISBLANK(*p); ++p) if (*p == '\t') { if (spaces) tab_after_sp = 1; @@ -1785,7 +1785,7 @@ v_txt_auto(SCR *sp, recno_t lno, TEXT *aitp, size_t len, TEXT *tp) /* Count whitespace characters. */ for (p = t; len > 0; ++p, --len) - if (!isblank(*p)) + if (!ISBLANK(*p)) break; /* Set count, check for no indentation. */ @@ -2794,7 +2794,7 @@ txt_margin(SCR *sp, TEXT *tp, TEXT *wmtp, int *didbreak, u_int32_t flags) /* Find the nearest previous blank. */ for (off = tp->cno - 1, p = tp->lb + off, len = 0;; --off, --p, ++len) { - if (isblank(*p)) { + if (ISBLANK(*p)) { wp = p + 1; break; } @@ -2846,7 +2846,7 @@ txt_margin(SCR *sp, TEXT *tp, TEXT *wmtp, int *didbreak, u_int32_t flags) * Delete any trailing whitespace from the current line. */ for (;; --p, --off) { - if (!isblank(*p)) + if (!ISBLANK(*p)) break; --tp->cno; --tp->len; diff --git a/vi/v_util.c b/vi/v_util.c index 6348ca73..ee796701 100644 --- a/vi/v_util.c +++ b/vi/v_util.c @@ -123,7 +123,7 @@ int v_isempty(CHAR_T *p, size_t len) { for (; len--; ++p) - if (!isblank(*p)) + if (!ISBLANK(*p)) return (0); return (1); }