void *x_malloc(size_t size);
void *x_calloc(size_t nmemb, size_t size);
void traverse(const char *dir, void (*fn)(const char *, struct stat *));
-char *basename(const char *s);
+char *basename(const char *path);
char *dirname(const char *path);
const char *get_extension(const char *path);
char *remove_extension(const char *path);
/* return the base name of a file - caller frees */
char *
-basename(const char *s)
+basename(const char *path)
{
char *p;
- p = strrchr(s, '/');
- if (p) s = p + 1;
+ p = strrchr(path, '/');
+ if (p) path = p + 1;
#ifdef _WIN32
- p = strrchr(s, '\\');
- if (p) s = p + 1;
+ p = strrchr(path, '\\');
+ if (p) path = p + 1;
#endif
- return x_strdup(s);
+ return x_strdup(path);
}
/* return the dir name of a file - caller frees */