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

Last change on this file since c65a0e2 was 109c83b, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Compiled full ROM in Hatari.

  • Property mode set to 100644
File size: 679 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
11int
12strspn(string, charset)
13char *string;
14register char *charset;
15{
16 register char *p, *q;
17 register int n = 0;
18
19 for (q = string; *q != '\0'; ++q) {
20
21 for (p = charset; *p != '\0' && *p != *q; ++p)
22 ;
23
24 if(*p == '\0')
25 break;
26
27 n++;
28 }
29
30 return(n);
31}
Note: See TracBrowser for help on using the repository browser.