You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
464 B
C
20 lines
464 B
C
23 years ago
|
#include "case.h"
|
||
|
|
||
|
/* str_start returns 1 if the b is a prefix of a, 0 otherwise */
|
||
|
int case_starts(const char* a, const char* b) {
|
||
|
register const char* s=a;
|
||
|
register const char* t=b;
|
||
|
for (;;) {
|
||
|
register unsigned char x,y;
|
||
|
if (!*t) return 1;
|
||
|
x = *s - 'A';
|
||
|
if (x <= 'Z' - 'A') x += 'a'; else x += 'A';
|
||
|
y = *t - 'A';
|
||
|
if (y <= 'Z' - 'A') y += 'a'; else y += 'A';
|
||
|
if (x != y) break;
|
||
|
if (!x) break;
|
||
|
++s; ++t;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|