1 |
#ifndef UAR_UAR_H |
2 |
#define UAR_UAR_H |
3 |
|
4 |
#include <stdbool.h> |
5 |
#include <sys/types.h> |
6 |
|
7 |
struct uar_archive; |
8 |
struct uar_file; |
9 |
|
10 |
enum uar_error |
11 |
{ |
12 |
UAR_SUCCESS, |
13 |
UAR_INVALID_MAGIC, |
14 |
UAR_INVALID_FILE, |
15 |
UAR_IO_ERROR, |
16 |
UAR_OUT_OF_MEMORY, |
17 |
UAR_INVALID_ARGUMENT, |
18 |
UAR_INVALID_OPERATION, |
19 |
UAR_INVALID_PATH, |
20 |
UAR_SYSTEM_ERROR |
21 |
}; |
22 |
|
23 |
struct uar_archive *uar_open (const char *filename); |
24 |
bool uar_has_error (const struct uar_archive *restrict uar); |
25 |
void uar_close (struct uar_archive *uar); |
26 |
const char *uar_strerror (const struct uar_archive *restrict uar); |
27 |
struct uar_archive *uar_create (); |
28 |
struct uar_file *uar_add_file (struct uar_archive *restrict uar, |
29 |
const char *name, const char *path); |
30 |
void uar_file_set_mode (struct uar_file *file, mode_t mode); |
31 |
bool uar_write (struct uar_archive *uar, const char *filename); |
32 |
struct uar_file *uar_add_dir (struct uar_archive *uar, const char *name, |
33 |
const char *path); |
34 |
bool uar_extract (struct uar_archive *uar, const char *cwd, |
35 |
bool (*callback) (struct uar_file *file)); |
36 |
const char *uar_get_file_name (const struct uar_file *file); |
37 |
|
38 |
#ifndef NDEBUG |
39 |
void uar_debug_print (const struct uar_archive *uar, bool print_file_contents); |
40 |
#endif |
41 |
|
42 |
#endif /* UAR_UAR_H */ |