int vioperswapcase(UNUSED(char **args)) { int oldcs, c2, ret = 1; /* get the range */ startvichange(1); if ((c2 = getvirange(0)) != -1) { oldcs = zlecs; /* swap the case of all letters within range */ while (zlecs < c2) { if (ZC_ilower(zleline[zlecs])) zleline[zlecs] = ZC_toupper(zleline[zlecs]); else if (ZC_iupper(zleline[zlecs])) zleline[zlecs] = ZC_tolower(zleline[zlecs]); INCCS(); } /* go back to the first line of the range */ zlecs = oldcs; ret = 0; #if 0 vifirstnonblank(); #endif } vichgflag = 0; return ret; }
int capitalizeword(UNUSED(char **args)) { int first, n = zmult; int neg = n < 0, ocs = zlecs; if (neg) n = -n; while (n--) { first = 1; while (zlecs != zlell && !ZC_iword(zleline[zlecs])) INCCS(); while (zlecs != zlell && ZC_iword(zleline[zlecs]) && !ZC_ialpha(zleline[zlecs])) INCCS(); while (zlecs != zlell && ZC_iword(zleline[zlecs])) { zleline[zlecs] = (first) ? ZC_toupper(zleline[zlecs]) : ZC_tolower(zleline[zlecs]); first = 0; INCCS(); } } if (neg) zlecs = ocs; return 0; }
int viswapcase(UNUSED(char **args)) { int eol, n = zmult; startvichange(-1); if (n < 1) return 1; eol = findeol(); while (zlecs < eol && n--) { if (ZC_ilower(zleline[zlecs])) zleline[zlecs] = ZC_toupper(zleline[zlecs]); else if (ZC_iupper(zleline[zlecs])) zleline[zlecs] = ZC_tolower(zleline[zlecs]); INCCS(); } if (zlecs && zlecs == eol) DECCS(); return 0; }
int upcaseword(UNUSED(char **args)) { int n = zmult; int neg = n < 0, ocs = zlecs; if (neg) n = -n; while (n--) { while (zlecs != zlell && !ZC_iword(zleline[zlecs])) INCCS(); while (zlecs != zlell && ZC_iword(zleline[zlecs])) { zleline[zlecs] = ZC_toupper(zleline[zlecs]); INCCS(); } } if (neg) zlecs = ocs; return 0; }
int viupcase(UNUSED(char **args)) { int oldcs, c2, ret = 1; /* get the range */ startvichange(1); if ((c2 = getvirange(0)) != -1) { oldcs = zlecs; /* covert the case of all letters within range */ while (zlecs < c2) { zleline[zlecs] = ZC_toupper(zleline[zlecs]); INCCS(); } /* go back to the first line of the range */ zlecs = oldcs; ret = 0; } vichgflag = 0; return ret; }