#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;
}
