47 lines
905 B
C
47 lines
905 B
C
#ifndef UTILITIES_H
|
|
#define UTILITIES_H
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include <dirent.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
|
|
#include "file.h"
|
|
#include "action_list.h"
|
|
|
|
#define RESET "\033[0m"
|
|
#define RED_BG "\033[41m"
|
|
#define GREEN_BG "\033[42m"
|
|
#define BLACK_FG "\033[30m"
|
|
|
|
#define LIST_INIT_CAPACITY 4
|
|
|
|
typedef enum {
|
|
PT_NOEXIST,
|
|
PT_FILE,
|
|
PT_DIR,
|
|
PT_OTHER,
|
|
PT_ERROR
|
|
} PathType;
|
|
|
|
typedef struct {
|
|
void** items;
|
|
size_t len;
|
|
size_t capacity;
|
|
size_t item_size;
|
|
} List;
|
|
|
|
List* list_new(size_t);
|
|
int list_push(List*, void*);
|
|
PathType get_path_type(const char*);
|
|
char* find_root(char*);
|
|
void walk(char*, char*, char*, PathBuffer*, int, char*);
|
|
void visualize_diff(File*, File*, ActionList*);
|
|
void cut_path(char* base, char* path);
|
|
void combine_path(char* base, char* path);
|
|
|
|
#endif // UTILITIES_H
|