PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len) { register const unsigned char *p = (unsigned char *) cptr; register const unsigned char *e; int cased; /* Shortcut for single character strings */ if (len == 1) return PyBool_FromLong(ISLOWER(*p)); /* Special case for empty strings */ if (len == 0) Py_RETURN_FALSE; e = p + len; cased = 0; for (; p < e; p++) { if (ISUPPER(*p)) Py_RETURN_FALSE; else if (!cased && ISLOWER(*p)) cased = 1; } return PyBool_FromLong(cased); }
static void set_encoding_const(const char *name, rb_encoding *enc) { VALUE encoding = rb_enc_from_encoding(enc); char *s = (char *)name; int haslower = 0, hasupper = 0, valid = 0; if (ISDIGIT(*s)) return; if (ISUPPER(*s)) { hasupper = 1; while (*++s && (ISALNUM(*s) || *s == '_')) { if (ISLOWER(*s)) haslower = 1; } } if (!*s) { if (s - name > ENCODING_NAMELEN_MAX) return; valid = 1; rb_define_const(rb_cEncoding, name, encoding); } if (!valid || haslower) { size_t len = s - name; if (len > ENCODING_NAMELEN_MAX) return; if (!haslower || !hasupper) { do { if (ISLOWER(*s)) haslower = 1; if (ISUPPER(*s)) hasupper = 1; } while (*++s && (!haslower || !hasupper)); len = s - name; } len += strlen(s); if (len++ > ENCODING_NAMELEN_MAX) return; MEMCPY(s = ALLOCA_N(char, len), name, char, len); name = s; if (!valid) { if (ISLOWER(*s)) *s = ONIGENC_ASCII_CODE_TO_UPPER_CASE((int)*s); for (; *s; ++s) { if (!ISALNUM(*s)) *s = '_'; } if (hasupper) { rb_define_const(rb_cEncoding, name, encoding); } } if (haslower) { for (s = (char *)name; *s; ++s) { if (ISLOWER(*s)) *s = ONIGENC_ASCII_CODE_TO_UPPER_CASE((int)*s); } rb_define_const(rb_cEncoding, name, encoding); } }
void Encoding::add_constant(STATE, const char* name, Encoding* enc) { if(ISDIGIT(*name) || !ISALNUM(*name)) return; char* s = const_cast<char*>(name); bool has_lower = false; if(ISUPPER(*s)) { while(*++s && (ISALNUM(*s) || *s == '_')) { if(ISLOWER(*s)) has_lower = true; } } if(!*s && !has_lower) { if(s - name > ENCODING_NAMELEN_MAX) return; G(encoding)->set_const(state, state->symbol(name), enc); return; } char* p = s = strdup(name); if(!s) return; if(ISUPPER(*s)) { while(*++s) { if(!ISALNUM(*s)) *s = '_'; if(ISLOWER(*s)) has_lower = true; } if(s - p > ENCODING_NAMELEN_MAX) { free(s); return; } G(encoding)->set_const(state, state->symbol(p), enc); } else { has_lower = true; } if(has_lower) { s = p; while(*s) { if(!ISALNUM(*s)) *s = '_'; if(ISLOWER(*s)) *s = toupper((int)*s); ++s; } G(encoding)->set_const(state, state->symbol(p), enc); } free(p); }
static inline u16 __toupper(u16 c) { if (ISLOWER(c)) { c -= 0x0061/*'a'*/ - 0x0041/*'A'*/; } else if (IS_CHINESE(c)) { iconv_t hiconv = iconv_open("euccn", "ucs2le"); if(hiconv != (iconv_t)-1) { char inbuf[2]; char outbuf[2]; char *p_inbuf = inbuf; char *p_outbuf = outbuf; size_t src_len = 2; size_t dest_len = 2; u16 gb2312_code = 0; inbuf[0] = (u8)c; inbuf[1] = (u8)(c >> 8); iconv(hiconv, &p_inbuf, &src_len, &p_outbuf, &dest_len); iconv_close(hiconv); gb2312_code = MAKE_WORD2(outbuf[0], outbuf[1]); c = __get_first_py_letter(gb2312_code); } }
/* ARGSUSED */ int upperregion(int f, int n) { struct line *linep; struct region region; int loffs, c, s; if ((s = checkdirty(curbp)) != TRUE) return (s); if (curbp->b_flag & BFREADONLY) { ewprintf("Buffer is read-only"); return (FALSE); } if ((s = getregion(®ion)) != TRUE) return (s); undo_add_change(region.r_linep, region.r_offset, region.r_size); lchange(WFFULL); linep = region.r_linep; loffs = region.r_offset; while (region.r_size--) { if (loffs == llength(linep)) { linep = lforw(linep); loffs = 0; } else { c = lgetc(linep, loffs); if (ISLOWER(c) != FALSE) lputc(linep, loffs, TOUPPER(c)); ++loffs; } } return (TRUE); }
static char caps_effect(char c) { if (ISALPHA(c) && ISLOWER(c)) return TOUPPER(c); return c; }
void _Py_bytes_title(char *result, char *s, Py_ssize_t len) { Py_ssize_t i; int previous_is_cased = 0; /* newobj = PyString_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; s_new = PyString_AsString(newobj); */ for (i = 0; i < len; i++) { int c = Py_CHARMASK(*s++); if (ISLOWER(c)) { if (!previous_is_cased) c = TOUPPER(c); previous_is_cased = 1; } else if (ISUPPER(c)) { if (previous_is_cased) c = TOLOWER(c); previous_is_cased = 1; } else previous_is_cased = 0; *result++ = c; } }
void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len) { Py_ssize_t i; /* newobj = PyString_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; s_new = PyString_AsString(newobj); */ if (0 < len) { int c = Py_CHARMASK(*s++); if (ISLOWER(c)) *result = TOUPPER(c); else *result = c; result++; } for (i = 1; i < len; i++) { int c = Py_CHARMASK(*s++); if (ISUPPER(c)) *result = TOLOWER(c); else *result = c; result++; } }
/* * ulcase -- * Change part of a line's case. */ static int ulcase(SCR *sp, db_recno_t lno, CHAR_T *lp, size_t len, size_t scno, size_t ecno) { size_t blen; int change, rval; ARG_CHAR_T ch; CHAR_T *p, *t, *bp; GET_SPACE_RETW(sp, bp, blen, len); MEMMOVEW(bp, lp, len); change = rval = 0; for (p = bp + scno, t = bp + ecno + 1; p < t; ++p) { ch = (UCHAR_T)*p; if (ISLOWER(ch)) { *p = TOUPPER(ch); change = 1; } else if (ISUPPER(ch)) { *p = TOLOWER(ch); change = 1; } } if (change && db_set(sp, lno, bp, len)) rval = 1; FREE_SPACEW(sp, bp, blen); return (rval); }
/* * Upper case region. Zap all of the lower * case characters in the region to upper case. Use * the region code to set the limits. Scan the buffer, * doing the changes. Call "lchange" to ensure that * redisplay is done in all buffers. */ int upperregion (int f, int n, int k) { register LINE *linep; register int loffs; register int c; register int s; REGION region; if ((s = getregion (®ion)) != TRUE) return (s); if (checkreadonly () == FALSE) return FALSE; lchange (WFHARD); linep = region.r_pos.p; loffs = region.r_pos.o; while (region.r_size--) { if (loffs == llength (linep)) { linep = lforw (linep); loffs = 0; } else { c = lgetc (linep, loffs); if (ISLOWER (c) != FALSE) lputc (linep, loffs, TOUPPER (c)); ++loffs; } } return (TRUE); }
/* * call-seq: * str.swapcase! -> str or nil * * Equivalent to <code>String#swapcase</code>, but modifies the receiver in * place, returning <i>str</i>, or <code>nil</code> if no changes were made. * Note: case conversion is effective only in ASCII region. */ static mrb_value mrb_str_swapcase_bang(mrb_state *mrb, mrb_value str) { char *p, *pend; int modify = 0; struct RString *s = mrb_str_ptr(str); mrb_str_modify(mrb, s); p = RSTRING_PTR(str); pend = p + RSTRING_LEN(str); while (p < pend) { if (ISUPPER(*p)) { *p = TOLOWER(*p); modify = 1; } else if (ISLOWER(*p)) { *p = TOUPPER(*p); modify = 1; } p++; } if (modify) return str; return mrb_nil_value(); }
/* Barchart in time reports */ void html_barchart(FILE *outf, Outchoices *od, int y, char graphby) { int i, j; logical first = TRUE; if (ISLOWER(graphby)) { for (i = 0; i < y; i++) html_putch(outf, od->markchar); return; } for (j = 32; j >= 1; j /= 2) { while (y >= j) { fputs("<img src=\"", outf); htmlputs(outf, od, od->imagedir, IN_HREF); fprintf(outf, "bar%c%d.%s\" alt=\"", od->barstyle, j, od->pngimages?"png":"gif"); /* '.' not EXTSEP even on RISC OS */ if (first) { for (i = 0; i < y; i++) html_putch(outf, od->markchar); first = FALSE; } fputs("\">", outf); y -= j; } } }
char *strtoupper(char *n) { /* convert a string to upper case UP TO the first line break */ char *c; for (c = n; *c != '\0' && *c != '\n' && *c != '\r'; c++) if (ISLOWER(*c)) /* needed to stop (known u.c.) const char *n crashing */ *c = TOUPPER(*c); return(n); }
static void upcase(char *s, size_t i) { do { if (ISLOWER(*s)) *s = TOUPPER(*s); } while (s++, --i); }
static char shift_effect(char c, short code) { if (ISDIGIT(c) || ISSYMBOL(c)) return SCAN_CODES_SYMBOLS[code]; else if (ISALPHA(c) && ISLOWER(c)) return TOUPPER(c); return c; }
int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(1); exit (0); }
static int tohex (int c) { if (ISDIGIT (c)) return c - '0'; if (ISLOWER (c)) return c - 'a' + 10; return c - 'A' + 10; }
int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; }
char *uppercase(char *string) { char *cp; int ch; for (cp = string; (ch = *cp) != 0; cp++) if (ISLOWER(ch)) *cp = TOUPPER(ch); return (string); }
static int parsekeyword(unsigned char **pattern, unsigned char *charset) { parsekey_state state = CURLFNM_PKW_INIT; #define KEYLEN 10 char keyword[KEYLEN] = { 0 }; int found = FALSE; int i; unsigned char *p = *pattern; for(i = 0; !found; i++) { char c = *p++; if(i >= KEYLEN) return SETCHARSET_FAIL; switch(state) { case CURLFNM_PKW_INIT: if(ISALPHA(c) && ISLOWER(c)) keyword[i] = c; else if(c == ':') state = CURLFNM_PKW_DDOT; else return 0; break; case CURLFNM_PKW_DDOT: if(c == ']') found = TRUE; else return SETCHARSET_FAIL; } } #undef KEYLEN *pattern = p; /* move caller's pattern pointer */ if(strcmp(keyword, "digit") == 0) charset[CURLFNM_DIGIT] = 1; else if(strcmp(keyword, "alnum") == 0) charset[CURLFNM_ALNUM] = 1; else if(strcmp(keyword, "alpha") == 0) charset[CURLFNM_ALPHA] = 1; else if(strcmp(keyword, "xdigit") == 0) charset[CURLFNM_XDIGIT] = 1; else if(strcmp(keyword, "print") == 0) charset[CURLFNM_PRINT] = 1; else if(strcmp(keyword, "graph") == 0) charset[CURLFNM_GRAPH] = 1; else if(strcmp(keyword, "space") == 0) charset[CURLFNM_SPACE] = 1; else if(strcmp(keyword, "blank") == 0) charset[CURLFNM_BLANK] = 1; else if(strcmp(keyword, "upper") == 0) charset[CURLFNM_UPPER] = 1; else if(strcmp(keyword, "lower") == 0) charset[CURLFNM_LOWER] = 1; else return SETCHARSET_FAIL; return SETCHARSET_OK; }
void upmapinit (void) { register int i; for (i = 0; i < 256; i++) { if (ISLOWER (i) && casefold) upmap[i] = TOUPPER (i); else upmap[i] = i; } }
/* "Each unit represents" line */ void html_declareunit(FILE *outf, Outchoices *od, char graphby, double unit, unsigned int bmult) { char **lngstr = od->lngstr; char *s; fputs("<p>\n", outf); fprintf(outf, "%s (", lngstr[eachunit_]); if (ISLOWER(graphby)) fprintf(outf, "<tt>%c</tt>", od->markchar); else { fprintf(outf, "<img src=\""); htmlputs(outf, od, od->imagedir, IN_HREF); fprintf(outf, "bar%c1.%s\" alt=\"%c\">", od->barstyle, od->pngimages?"png":"gif", od->markchar); /* Above: '.' not EXTSEP even on RISC OS */ } fprintf(outf, ") %s ", lngstr[represents_]); if (graphby == 'R' || graphby == 'r') { f3printf(outf, od, unit, 0, od->sepchar); if (unit == 1.) fprintf(outf, " %s.", lngstr[request_]); else fprintf(outf, " %s %s.", lngstr[requests_], lngstr[partof_]); } else if (graphby == 'P' || graphby == 'p') { f3printf(outf, od, unit, 0, od->sepchar); if (unit == 1.) fprintf(outf, " %s.", lngstr[pagereq_]); else fprintf(outf, " %s %s.", lngstr[pagereqs_], lngstr[partof_]); } else { if (bmult > 0) { html_printdouble(outf, od, unit); s = strchr(lngstr[xbytes_], '?'); /* checked in initialisation */ *s = '\0'; fprintf(outf, " %s%s%s %s.", lngstr[xbytes_], lngstr[byteprefix_ + bmult], s + 1, lngstr[partof_]); *s = '?'; } else { f3printf(outf, od, unit, 0, od->sepchar); fprintf(outf, " %s %s.", lngstr[bytes_], lngstr[partof_]); } } putc('\n', outf); }
static unsigned char read_hex (const char xdigit) { if (ISDIGIT (xdigit)) return xdigit - '0'; if (ISUPPER (xdigit)) return xdigit - 'A' + 0xa; if (ISLOWER (xdigit)) return xdigit - 'a' + 0xa; abort (); return 0; }
/* ARGSUSED */ int capword(int f, int n) { int c, s; RSIZE size; if ((s = checkdirty(curbp)) != TRUE) return (s); if (curbp->b_flag & BFREADONLY) { dobeep(); ewprintf("Buffer is read-only"); return (FALSE); } if (n < 0) return (FALSE); while (n--) { while (inword() == FALSE) { if (forwchar(FFRAND, 1) == FALSE) return (TRUE); } size = countfword(); undo_add_change(curwp->w_dotp, curwp->w_doto, size); if (inword() != FALSE) { c = lgetc(curwp->w_dotp, curwp->w_doto); if (ISLOWER(c) != FALSE) { c = TOUPPER(c); lputc(curwp->w_dotp, curwp->w_doto, c); lchange(WFFULL); } if (forwchar(FFRAND, 1) == FALSE) return (TRUE); while (inword() != FALSE) { c = lgetc(curwp->w_dotp, curwp->w_doto); if (ISUPPER(c) != FALSE) { c = TOLOWER(c); lputc(curwp->w_dotp, curwp->w_doto, c); lchange(WFFULL); } if (forwchar(FFRAND, 1) == FALSE) return (TRUE); } } } return (TRUE); }
static void writeHeader(FILE * const headerFileP, const char * const prefix, unsigned int const width, unsigned int const height, unsigned int const nfiles, const char ** const names, const Coord * const coords, const struct pam * imgs) { unsigned int i; fprintf(headerFileP, "#define %sOVERALLX %u\n", prefix, width); fprintf(headerFileP, "#define %sOVERALLY %u\n", prefix, height); fprintf(headerFileP, "\n"); for (i = 0; i < nfiles; ++i) { char * const buffer = strdup(names[i]); Coord const coord = coords[i]; struct pam const img = imgs[i]; unsigned int j; *strchr(buffer, '.') = 0; for (j = 0; buffer[j]; ++j) { if (ISLOWER(buffer[j])) buffer[j] = TOUPPER(buffer[j]); } fprintf(headerFileP, "#define %s%sX %u\n", prefix, buffer, coord.x); fprintf(headerFileP, "#define %s%sY %u\n", prefix, buffer, coord.y); fprintf(headerFileP, "#define %s%sSZX %u\n", prefix, buffer, img.width); fprintf(headerFileP, "#define %s%sSZY %u\n", prefix, buffer, img.height); fprintf(headerFileP, "\n"); } }
int main() { char ch;int x,y; printf("enter the character you want to enter?\n"); scanf("%c",&ch); if(ISLOWER(ch)) printf("the character is lowercase\n"); if(ISUPPER(ch)) printf("the character is uppercase\n"); if(ISALPHA(ch)) printf("the character is an alphabet\n"); else printf("the character is not an alphabet\n"); printf("Enter the two nos you want to compare\n"); scanf("%d%d",&x,&y); printf("the bigger no is %d\n",ISBIG(x,y)); return 0; }
void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len) { Py_ssize_t i; /* newobj = PyString_FromStringAndSize(NULL, len); if (!newobj) return NULL; s = PyString_AS_STRING(newobj); */ Py_MEMCPY(result, cptr, len); for (i = 0; i < len; i++) { int c = Py_CHARMASK(result[i]); if (ISLOWER(c)) result[i] = TOUPPER(c); } }
/*ARGSUSED*/ upperregion(f, n) { register LINE *linep; register int loffs; register int c; register int s; REGION region; VOID lchange(); #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if ((s=getregion(®ion)) != TRUE) return s; #ifdef UNDO undo_reset(curbp); /* this function cannot undo */ #endif lchange(WFHARD); linep = region.r_linep; loffs = region.r_offset; while (region.r_size--) { if (loffs == llength(linep)) { linep = lforw(linep); loffs = 0; } else { c = lgetc(linep, loffs); if (ISLOWER(c) != FALSE) lputc(linep, loffs, TOUPPER(c)); ++loffs; } } return TRUE; }
static int loop(const unsigned char *pattern, const unsigned char *string) { loop_state state = CURLFNM_LOOP_DEFAULT; unsigned char *p = (unsigned char *)pattern; unsigned char *s = (unsigned char *)string; unsigned char charset[CURLFNM_CHSET_SIZE] = { 0 }; int rc = 0; for(;;) { switch(state) { case CURLFNM_LOOP_DEFAULT: if(*p == '*') { while(*(p+1) == '*') /* eliminate multiple stars */ p++; if(*s == '\0' && *(p+1) == '\0') return CURL_FNMATCH_MATCH; rc = loop(p + 1, s); /* *.txt matches .txt <=> .txt matches .txt */ if(rc == CURL_FNMATCH_MATCH) return CURL_FNMATCH_MATCH; if(*s) /* let the star eat up one character */ s++; else return CURL_FNMATCH_NOMATCH; } else if(*p == '?') { if(ISPRINT(*s)) { s++; p++; } else if(*s == '\0') return CURL_FNMATCH_NOMATCH; else return CURL_FNMATCH_FAIL; /* cannot deal with other character */ } else if(*p == '\0') { if(*s == '\0') return CURL_FNMATCH_MATCH; else return CURL_FNMATCH_NOMATCH; } else if(*p == '\\') { state = CURLFNM_LOOP_BACKSLASH; p++; } else if(*p == '[') { unsigned char *pp = p+1; /* cannot handle with pointer to register */ if(setcharset(&pp, charset)) { int found = FALSE; if(charset[(unsigned int)*s]) found = TRUE; else if(charset[CURLFNM_ALNUM]) found = ISALNUM(*s); else if(charset[CURLFNM_ALPHA]) found = ISALPHA(*s); else if(charset[CURLFNM_DIGIT]) found = ISDIGIT(*s); else if(charset[CURLFNM_XDIGIT]) found = ISXDIGIT(*s); else if(charset[CURLFNM_PRINT]) found = ISPRINT(*s); else if(charset[CURLFNM_SPACE]) found = ISSPACE(*s); else if(charset[CURLFNM_UPPER]) found = ISUPPER(*s); else if(charset[CURLFNM_LOWER]) found = ISLOWER(*s); else if(charset[CURLFNM_BLANK]) found = ISBLANK(*s); else if(charset[CURLFNM_GRAPH]) found = ISGRAPH(*s); if(charset[CURLFNM_NEGATE]) found = !found; if(found) { p = pp+1; s++; memset(charset, 0, CURLFNM_CHSET_SIZE); } else return CURL_FNMATCH_NOMATCH; } else return CURL_FNMATCH_FAIL; } else { if(*p++ != *s++) return CURL_FNMATCH_NOMATCH; } break; case CURLFNM_LOOP_BACKSLASH: if(ISPRINT(*p)) { if(*p++ == *s++) state = CURLFNM_LOOP_DEFAULT; else return CURL_FNMATCH_NOMATCH; } else return CURL_FNMATCH_FAIL; break; } } }
/* returns 1 (true) if pattern is OK, 0 if is bad ("p" is pattern pointer) */ static int setcharset(unsigned char **p, unsigned char *charset) { setcharset_state state = CURLFNM_SCHS_DEFAULT; unsigned char rangestart = 0; unsigned char lastchar = 0; bool something_found = FALSE; unsigned char c; for(;;) { c = **p; switch(state) { case CURLFNM_SCHS_DEFAULT: if(ISALNUM(c)) { /* ASCII value */ rangestart = c; charset[c] = 1; (*p)++; state = CURLFNM_SCHS_MAYRANGE; something_found = TRUE; } else if(c == ']') { if(something_found) return SETCHARSET_OK; else something_found = TRUE; state = CURLFNM_SCHS_RIGHTBR; charset[c] = 1; (*p)++; } else if(c == '[') { char c2 = *((*p)+1); if(c2 == ':') { /* there has to be a keyword */ (*p) += 2; if(parsekeyword(p, charset)) { state = CURLFNM_SCHS_DEFAULT; } else return SETCHARSET_FAIL; } else { charset[c] = 1; (*p)++; } something_found = TRUE; } else if(c == '?' || c == '*') { something_found = TRUE; charset[c] = 1; (*p)++; } else if(c == '^' || c == '!') { if(!something_found) { if(charset[CURLFNM_NEGATE]) { charset[c] = 1; something_found = TRUE; } else charset[CURLFNM_NEGATE] = 1; /* negate charset */ } else charset[c] = 1; (*p)++; } else if(c == '\\') { c = *(++(*p)); if(ISPRINT((c))) { something_found = TRUE; state = CURLFNM_SCHS_MAYRANGE; charset[c] = 1; rangestart = c; (*p)++; } else return SETCHARSET_FAIL; } else if(c == '\0') { return SETCHARSET_FAIL; } else { charset[c] = 1; (*p)++; something_found = TRUE; } break; case CURLFNM_SCHS_MAYRANGE: if(c == '-') { charset[c] = 1; (*p)++; lastchar = '-'; state = CURLFNM_SCHS_MAYRANGE2; } else if(c == '[') { state = CURLFNM_SCHS_DEFAULT; } else if(ISALNUM(c)) { charset[c] = 1; (*p)++; } else if(c == '\\') { c = *(++(*p)); if(ISPRINT(c)) { charset[c] = 1; (*p)++; } else return SETCHARSET_FAIL; } else if(c == ']') { return SETCHARSET_OK; } else return SETCHARSET_FAIL; break; case CURLFNM_SCHS_MAYRANGE2: if(c == '\\') { c = *(++(*p)); if(!ISPRINT(c)) return SETCHARSET_FAIL; } if(c == ']') { return SETCHARSET_OK; } else if(c == '\\') { c = *(++(*p)); if(ISPRINT(c)) { charset[c] = 1; state = CURLFNM_SCHS_DEFAULT; (*p)++; } else return SETCHARSET_FAIL; } if(c >= rangestart) { if((ISLOWER(c) && ISLOWER(rangestart)) || (ISDIGIT(c) && ISDIGIT(rangestart)) || (ISUPPER(c) && ISUPPER(rangestart))) { charset[lastchar] = 0; rangestart++; while(rangestart++ <= c) charset[rangestart-1] = 1; (*p)++; state = CURLFNM_SCHS_DEFAULT; } else return SETCHARSET_FAIL; } break; case CURLFNM_SCHS_RIGHTBR: if(c == '[') { state = CURLFNM_SCHS_RIGHTBRLEFTBR; charset[c] = 1; (*p)++; } else if(c == ']') { return SETCHARSET_OK; } else if(c == '\0') { return SETCHARSET_FAIL; } else if(ISPRINT(c)) { charset[c] = 1; (*p)++; state = CURLFNM_SCHS_DEFAULT; } else /* used 'goto fail' instead of 'return SETCHARSET_FAIL' to avoid a * nonsense warning 'statement not reached' at end of the fnc when * compiling on Solaris */ goto fail; break; case CURLFNM_SCHS_RIGHTBRLEFTBR: if(c == ']') { return SETCHARSET_OK; } else { state = CURLFNM_SCHS_DEFAULT; charset[c] = 1; (*p)++; } break; } } fail: return SETCHARSET_FAIL; }