Sign in
android
/
platform
/
external
/
musl
/
aa59d7880b1194c821029d464f93561a2600d57e
/
.
/
src
/
misc
/
basename.c
blob: 438377b6477869cc746773b268ab0e315d7901c4 [
file
] [
log
] [
blame
]
#include
<string.h>
#include
<libgen.h>
char
*
basename
(
char
*
s
)
{
size_t
i
;
if
(!
s
||
!*
s
)
return
"."
;
i
=
strlen
(
s
)-
1
;
for
(;
i
&&
s
[
i
]==
'/'
;
i
--)
s
[
i
]
=
0
;
for
(;
i
&&
s
[
i
-
1
]!=
'/'
;
i
--);
return
s
+
i
;
}
weak_alias
(
basename
,
__xpg_basename
);