Logo
Explore Help
Sign In
fluencelabs/musl
1
0
Fork 0
You've already forked musl
mirror of https://github.com/fluencelabs/musl synced 2025-06-15 07:51:42 +00:00
Code Issues Projects Releases Wiki Activity
Files
c91aa03d2488ef2c48276510dec360ed9582e861
musl/src/misc/basename.c

16 lines
263 B
C
Raw Normal View History

initial check-in, version 0.5.0
2011-02-12 00:22:29 -05:00
#include <string.h>
#include <libgen.h>
alias basename to glibc name for it, to meet abi goals note that regardless of the name used, basename is always conformant. it never takes on the bogus gnu behavior, unlike glibc where basename is nonconformant when declared manually without including libgen.h.
2012-01-18 23:28:48 -05:00
#include "libc.h"
initial check-in, version 0.5.0
2011-02-12 00:22:29 -05:00
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;
}
alias basename to glibc name for it, to meet abi goals note that regardless of the name used, basename is always conformant. it never takes on the bogus gnu behavior, unlike glibc where basename is nonconformant when declared manually without including libgen.h.
2012-01-18 23:28:48 -05:00
weak_alias(basename, __xpg_basename);
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.0 Page: 446ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API