source: buchla-68k/orig/CLIBRARY/STRSPN.C@ de91266

Last change on this file since de91266 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
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.