Last change
on this file since b8080f6 was f40a309, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Unix line breaks.
|
-
Property mode
set to
100644
|
File size:
752 bytes
|
Rev | Line | |
---|
[f40a309] | 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.