Last change
on this file since c79db87 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
781 bytes
|
Line | |
---|
1 | /*
|
---|
2 | ============================================================================
|
---|
3 | strcspn.c -- character scan function ala' Unix(tm)
|
---|
4 | Version 1 -- 1987-02-11 -- D.N. Lynx Crowe
|
---|
5 |
|
---|
6 | Return the number of characters in the maximum leading segment
|
---|
7 | of string which consists solely of characters NOT from charset.
|
---|
8 | ============================================================================
|
---|
9 | */
|
---|
10 |
|
---|
11 | int
|
---|
12 | strcspn(string, charset)
|
---|
13 | char *string;
|
---|
14 | register char *charset;
|
---|
15 | {
|
---|
16 | register char *p, *q;
|
---|
17 | register int n = 0;
|
---|
18 |
|
---|
19 | for(q = string; *q != '\0'; ++q , ++n) {
|
---|
20 |
|
---|
21 | for(p = charset; *p != '\0' && *p != *q; ++p)
|
---|
22 | ;
|
---|
23 |
|
---|
24 | if(*p != '\0')
|
---|
25 | break;
|
---|
26 | }
|
---|
27 |
|
---|
28 | return(n);
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.