Last change
on this file since 577 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
794 bytes
|
Line | |
---|
1 | /* |
---|
2 | FUNCTION |
---|
3 | <<strchrnul>>---search for character in string |
---|
4 | |
---|
5 | INDEX |
---|
6 | strchrnul |
---|
7 | |
---|
8 | SYNOPSIS |
---|
9 | #include <string.h> |
---|
10 | char * strchrnul(const char *<[string]>, int <[c]>); |
---|
11 | |
---|
12 | DESCRIPTION |
---|
13 | This function finds the first occurence of <[c]> (converted to |
---|
14 | a char) in the string pointed to by <[string]> (including the |
---|
15 | terminating null character). |
---|
16 | |
---|
17 | RETURNS |
---|
18 | Returns a pointer to the located character, or a pointer |
---|
19 | to the concluding null byte if <[c]> does not occur in <[string]>. |
---|
20 | |
---|
21 | PORTABILITY |
---|
22 | <<strchrnul>> is a GNU extension. |
---|
23 | |
---|
24 | <<strchrnul>> requires no supporting OS subroutines. It uses |
---|
25 | strchr() and strlen() from elsewhere in this library. |
---|
26 | |
---|
27 | QUICKREF |
---|
28 | strchrnul |
---|
29 | */ |
---|
30 | |
---|
31 | #include <string.h> |
---|
32 | |
---|
33 | char * |
---|
34 | strchrnul (const char *s1, |
---|
35 | int i) |
---|
36 | { |
---|
37 | char *s = strchr(s1, i); |
---|
38 | |
---|
39 | return s ? s : (char *)s1 + strlen(s1); |
---|
40 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.