-
-#if !defined HAVE_STRING_H && !defined STDC_HEADERS
-
-/* Provide missing strspn and strcspn functions. */
-
-# ifndef __STDC__
-# define const
-# endif
-
-int strspn OF((const char *s, const char *accept));
-int strcspn OF((const char *s, const char *reject));
-
-/* ========================================================================
- * Return the length of the maximum initial segment
- * of s which contains only characters in accept.
- */
-int strspn(s, accept)
- const char *s;
- const char *accept;
-{
- register const char *p;
- register const char *a;
- register int count = 0;
-
- for (p = s; *p != '\0'; ++p) {
- for (a = accept; *a != '\0'; ++a) {
- if (*p == *a) break;
- }
- if (*a == '\0') return count;
- ++count;
- }
- return count;
-}
-
-/* ========================================================================
- * Return the length of the maximum inital segment of s
- * which contains no characters from reject.
- */
-int strcspn(s, reject)
- const char *s;
- const char *reject;
-{
- register int count = 0;
-
- while (*s != '\0') {
- if (strchr(reject, *s++) != NULL) return count;
- ++count;
- }
- return count;
-}
-
-#endif
-