#include "util.h"

/* ========================== *
 * String utils
 * ========================== */

#if 0
struct string util_file_name_from_path(struct string path)
{
    u8 *start = path.text;
    u8 *end = path.text + path.len;

    /* Find file type start pos */
    u8 *type_start = end + 1;
    for (u8 *c = end; c >= start; --c) {
        if (*c == '.') {
            type_start = c;
            break;
        }
    }

    /* Find filename start pos */
    u8 *filename_start = start;
    for (u8 *c = type_start - 1; c >= start; --c) {
        if (*c == '/') {
            filename_start = c;
            break;
        }
    }

    return (struct string) {
        .text = filename_start,
        .len = type_start - filename_start - 1
    };
}
#endif
