repo.or.cz
/
musl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
powerpc-sf longjmp clobbering of val argument
[musl.git]
/
src
/
misc
/
basename.c
blob
438377b6477869cc746773b268ab0e315d7901c4
1
#include <string.h>
2
#include <libgen.h>
3
4
char
*
basename
(
char
*
s
)
5
{
6
size_t
i
;
7
if
(!
s
|| !*
s
)
return
"."
;
8
i
=
strlen
(
s
)-
1
;
9
for
(;
i
&&
s
[
i
]==
'/'
;
i
--)
s
[
i
] =
0
;
10
for
(;
i
&&
s
[
i
-
1
]!=
'/'
;
i
--);
11
return
s
+
i
;
12
}
13
14
weak_alias
(
basename
,
__xpg_basename
);