projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
implement hcreate_r, hdestroy_r and hsearch_r
[oweals/musl.git]
/
src
/
misc
/
basename.c
1
#include <string.h>
2
#include <libgen.h>
3
#include "libc.h"
4
5
char *basename(char *s)
6
{
7
size_t i;
8
if (!s || !*s) return ".";
9
i = strlen(s)-1;
10
for (; i&&s[i]=='/'; i--) s[i] = 0;
11
for (; i&&s[i-1]!='/'; i--);
12
return s+i;
13
}
14
15
weak_alias(basename, __xpg_basename);