forked from KolibriOS/kolibrios
9257d2c34c
- Added basename() and dirname() - libc_test all tabs -> spaces git-svn-id: svn://kolibrios.org@9262 a494cfbc-eb01-0410-851d-a64ba20cac60
14 lines
226 B
C
14 lines
226 B
C
#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;
|
|
}
|
|
|