mirror of https://git.musl-libc.org/git/musl
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
263 B
15 lines
263 B
#include <string.h>
|
|
#include <libgen.h>
|
|
#include "libc.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);
|
|
|