source:
buchla-68k/libsm/strcspn.c@
0170798
Last change on this file since 0170798 was b28a12e, checked in by , 7 years ago | |
---|---|
|
|
File size: 655 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 | ||
[b28a12e] | 11 | #include "ram.h" |
[6262b5c] | 12 | |
[7258c6a] | 13 | int16_t strcspn(int8_t *string, int8_t *charset) |
[f40a309] | 14 | { |
[7848656] | 15 | register int8_t *p, *q; |
[7258c6a] | 16 | register int16_t n = 0; |
[f40a309] | 17 | |
[7848656] | 18 | for(q = string; *q != '\0'; ++q , ++n) { |
[f40a309] | 19 | |
[7848656] | 20 | for(p = charset; *p != '\0' && *p != *q; ++p) |
21 | ; | |
[f40a309] | 22 | |
[7848656] | 23 | if(*p != '\0') |
24 | break; | |
25 | } | |
[f40a309] | 26 | |
[7848656] | 27 | return(n); |
[f40a309] | 28 | } |
Note:
See TracBrowser
for help on using the repository browser.