15 CaseTypes toWhatCase) {
20 raiseIt = (toWhatCase == ALL_UPPER) || (toWhatCase == INITIAL_UPPER);
22 for(c = string; *c != EOS; c++) {
23 *c = raiseIt ? toupper((int)*c) : tolower((int)*c);
24 raiseIt = (toWhatCase == ALL_UPPER) ||
25 ((toWhatCase == INITIAL_UPPER) && !isalpha((int)*c));
32 strnmatch(const char *string,
36 const char *lastChance;
41 do pattern++; while (*pattern == '*');
43 return 1; /* Trailing star matches everything. */
44 nextWild = strchr(pattern, '*');
45 tameLen = (nextWild == NULL) ? strlen(pattern) : nextWild - pattern;
47 ** The wildcard we're processing can match any string of characters up to
48 ** an occurrence of the following non-wild subpattern. For each subpattern
49 ** occurrence, see if the remaining string matches the remaining pattern.
51 lastChance = string + len - tameLen;
52 for(; string <= lastChance; string++) {
53 if((strncmp(string, pattern, tameLen) == 0) &&
54 strnmatch(string + tameLen, pattern + tameLen, lastChance - string)) {
61 nextWild = strchr(pattern, '*');
63 /* No wildcards in pattern; check for exact match. */
64 return (strlen(pattern) == len) && (strncmp(string, pattern, len) == 0);
66 /* Check for leading exact match followed by a wildcard match. */
67 tameLen = nextWild - pattern;
68 return (tameLen <= len) &&
69 (strncmp(string, pattern, tameLen) == 0) &&
70 strnmatch(string + tameLen, nextWild, len - tameLen);
79 strnlen( const char *s,
83 if (maxlen <= 0 || s == NULL) {
87 for (i=0; i<maxlen; i++) {
104 char *last = dest + len - 1;
106 /* Skip leading delimiters. */
107 while( (*source != EOS) && (strchr(delim, *source) != NULL) ) {
115 while( (dest < last) && (*source != EOS) &&
116 (strchr(delim, *source) == NULL) ) {
121 *end = (const char *)source;
138 char *end = dest + len - 1;
141 va_start(paramList, count);
142 for (i = 0; i < count; i++) {
143 for (source = va_arg(paramList, const char*);
144 (dest < end) && (*source != EOS); dest++, source++)