#ifndef TAR_H
#define TAR_H

#include "util.h"

struct tar_entry {
    struct string file_name;
    struct buffer buff;

    b32 is_dir;
    struct tar_entry *next;
    struct tar_entry *next_child;  /* If entry is dir, points to first child. Otherwise points to next sibling. */
};

struct tar_archive {
    struct fixed_dict lookup;
    struct tar_entry *head;
};

struct tar_archive tar_parse(struct arena *arena, struct buffer data, struct string prefix);
struct tar_entry *tar_get(const struct tar_archive *archive, struct string name);

#endif
