1 /* strcspn.c */ 2 3 /* from Schumacher's Atari library, improved */ 4 5 #include <string.h> 6 strcspn(string,set)7size_t strcspn(string, set) 8 register char *string; 9 char *set; 10 /* 11 * Return the length of the sub-string of <string> that consists 12 * entirely of characters not found in <set>. The terminating '\0' 13 * in <set> is not considered part of the match set. If the first 14 * character if <string> is in <set>, 0 is returned. 15 */ 16 { 17 register char *setptr; 18 char *start; 19 20 start = string; 21 while (*string) 22 { 23 setptr = set; 24 do 25 if (*setptr == *string) 26 goto break2; 27 while (*setptr++); 28 ++string; 29 } 30 break2: 31 return string - start; 32 } 33