Last change
on this file since 4aad7a7 was b28a12e, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Zero redundant declarations.
|
-
Property mode
set to
100644
|
File size:
654 bytes
|
Rev | Line | |
---|
[f40a309] | 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 |
|
---|
[b28a12e] | 11 | #include "ram.h"
|
---|
[6262b5c] | 12 |
|
---|
[7258c6a] | 13 | int16_t strspn(int8_t *string, int8_t *charset)
|
---|
[f40a309] | 14 | {
|
---|
[7258c6a] | 15 | register int8_t *p, *q;
|
---|
| 16 | register int16_t n = 0;
|
---|
[f40a309] | 17 |
|
---|
| 18 | for (q = string; *q != '\0'; ++q) {
|
---|
| 19 |
|
---|
| 20 | for (p = charset; *p != '\0' && *p != *q; ++p)
|
---|
| 21 | ;
|
---|
| 22 |
|
---|
| 23 | if(*p == '\0')
|
---|
| 24 | break;
|
---|
| 25 |
|
---|
| 26 | n++;
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | return(n);
|
---|
| 30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.