source: buchla-68k/libsm/strspn.c@ e225e77

Last change on this file since e225e77 was 7258c6a, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Use standard integer types.

  • Property mode set to 100644
File size: 636 bytes
Line 
1/*
2 ============================================================================
3 strspn.c -- string scan function ala' Unix(tm)
4 Version 2 -- 1987-06-12 -- D.N. Lynx Crowe
5
6 Return the number of characters in the maximum leading segment
7 of 'string' which consists solely of characters from 'charset'.
8 ============================================================================
9*/
10
11int16_t strspn(int8_t *string, int8_t *charset)
12{
13 register int8_t *p, *q;
14 register int16_t n = 0;
15
16 for (q = string; *q != '\0'; ++q) {
17
18 for (p = charset; *p != '\0' && *p != *q; ++p)
19 ;
20
21 if(*p == '\0')
22 break;
23
24 n++;
25 }
26
27 return(n);
28}
Note: See TracBrowser for help on using the repository browser.