- Move source code from `trunk` into program root directory. - Update build files and include paths. - Note: Line endings standardised from `CRLF` > `LF`, so best to view diffs with whitespace changes hidden.
16 lines
263 B
C
16 lines
263 B
C
#include <libgen.h>
|
|
#include <string.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;
|
|
}
|