repo.or.cz
/
ruby-svn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git]
/
missing
/
strchr.c
blob
bebd7ba5782dd6e6e948ac498715820fb7459b9e
1
/* public domain rewrite of strchr(3) and strrchr(3) */
2
3
char
*
4
strchr
(
const char
*
s
,
int
c
)
5
{
6
if
(
c
==
0
)
return
(
char
*)
s
+
strlen
(
s
);
7
while
(*
s
) {
8
if
(*
s
==
c
)
9
return
(
char
*)
s
;
10
s
++;
11
}
12
return
0
;
13
}
14
15
char
*
16
strrchr
(
const char
*
s
,
int
c
)
17
{
18
const char
*
save
;
19
20
if
(
c
==
0
)
return
(
char
*)
s
+
strlen
(
s
);
21
save
=
0
;
22
while
(*
s
) {
23
if
(*
s
==
c
)
24
save
=
s
;
25
s
++;
26
}
27
return
(
char
*)
save
;
28
}