#ifndef IO_H
#define IO_H

#include "aliases.h"
#include <linux/limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>

#define STREQ(S1, S2) (strcmp(S1, S2) == 0)
#define STRNEQ(S1, S2, COUNT) (strncmp(S1, S2, COUNT) == 0)

typedef struct dirwalk dirwalk_t;
typedef struct {
  FILE *fp;
  bool reading;
  char name[NAME_MAX + 1];
} dirwalk_result_t;

u64 get_file_length(FILE *fp);
void read_entire_file(void *dst, FILE *fp);
dirwalk_result_t walk_dir(dirwalk_t **dirwalk, const char *filepath);

#endif // !IO_H