All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m41s
24 lines
369 B
C
24 lines
369 B
C
#include <fs/vfs.h>
|
|
#include <libk/std.h>
|
|
#include <path_defs.h>
|
|
|
|
const char* path_basename (const char* path) {
|
|
if (path == NULL)
|
|
return NULL;
|
|
|
|
const char* last_slash = NULL;
|
|
const char* ptr = path;
|
|
|
|
while (*ptr != '\0') {
|
|
if (*ptr == '/')
|
|
last_slash = ptr;
|
|
|
|
ptr++;
|
|
}
|
|
|
|
if (last_slash == NULL)
|
|
return path;
|
|
|
|
return last_slash + 1;
|
|
}
|