2 |
#define UAR_UAR_H |
#define UAR_UAR_H |
3 |
|
|
4 |
#include <stdbool.h> |
#include <stdbool.h> |
5 |
|
#include <stdint.h> |
6 |
|
#include <sys/stat.h> |
7 |
#include <sys/types.h> |
#include <sys/types.h> |
8 |
|
|
9 |
struct uar_archive; |
struct uar_archive; |
19 |
UAR_INVALID_ARGUMENT, |
UAR_INVALID_ARGUMENT, |
20 |
UAR_INVALID_OPERATION, |
UAR_INVALID_OPERATION, |
21 |
UAR_INVALID_PATH, |
UAR_INVALID_PATH, |
22 |
UAR_SYSTEM_ERROR |
UAR_SYSTEM_ERROR, |
23 |
|
UAR_SYSCALL_ERROR, |
24 |
}; |
}; |
25 |
|
|
26 |
enum uar_file_type |
enum uar_file_type |
30 |
UF_LINK |
UF_LINK |
31 |
}; |
}; |
32 |
|
|
33 |
|
typedef bool (*uar_callback_t) (struct uar_archive *uar, struct uar_file *file, |
34 |
|
const char *uar_name, const char *fs_name); |
35 |
|
|
36 |
|
struct uar_archive *uar_create (void); |
37 |
struct uar_archive *uar_open (const char *filename); |
struct uar_archive *uar_open (const char *filename); |
38 |
bool uar_has_error (const struct uar_archive *restrict uar); |
struct uar_archive *uar_create_stream (void); |
39 |
void uar_close (struct uar_archive *uar); |
void uar_close (struct uar_archive *uar); |
40 |
|
|
41 |
|
struct uar_file *uar_stream_add_file (struct uar_archive *uar, |
42 |
|
const char *uar_filename, |
43 |
|
const char *fs_filename, |
44 |
|
struct stat *stinfo); |
45 |
|
bool uar_stream_write (struct uar_archive *uar, const char *filename); |
46 |
|
|
47 |
|
bool uar_has_error (const struct uar_archive *restrict uar); |
48 |
const char *uar_strerror (const struct uar_archive *restrict uar); |
const char *uar_strerror (const struct uar_archive *restrict uar); |
49 |
struct uar_archive *uar_create (void); |
uint64_t uar_get_file_count (const struct uar_archive *restrict uar); |
50 |
|
|
51 |
struct uar_file *uar_add_file (struct uar_archive *restrict uar, |
struct uar_file *uar_add_file (struct uar_archive *restrict uar, |
52 |
const char *name, const char *path); |
const char *name, const char *path, |
53 |
void uar_file_set_mode (struct uar_file *file, mode_t mode); |
struct stat *stinfo); |
|
bool uar_write (struct uar_archive *uar, const char *filename); |
|
54 |
struct uar_file * |
struct uar_file * |
55 |
uar_add_dir (struct uar_archive *uar, const char *name, const char *path, |
uar_add_dir (struct uar_archive *uar, const char *name, const char *path, |
56 |
bool (*callback) (struct uar_file *file, const char *fullname, |
bool (*callback) (struct uar_file *file, const char *fullname, |
57 |
const char *fullpath)); |
const char *fullpath)); |
58 |
bool uar_extract (struct uar_archive *uar, const char *cwd, |
bool uar_extract (struct uar_archive *uar, const char *cwd, |
59 |
bool (*callback) (struct uar_file *file)); |
bool (*callback) (struct uar_file *file)); |
60 |
const char *uar_get_file_name (const struct uar_file *file); |
bool uar_write (struct uar_archive *uar, const char *filename); |
61 |
enum uar_file_type uar_get_entry_type (const struct uar_file *file); |
bool uar_iterate (struct uar_archive *uar, |
62 |
|
bool (*callback) (struct uar_file *file, void *data), |
63 |
|
void *data); |
64 |
|
|
65 |
|
struct uar_file *uar_file_create (const char *name, uint64_t namelen, |
66 |
|
uint64_t size, uint32_t offset); |
67 |
|
|
68 |
|
bool uar_add_file_entry (struct uar_archive *restrict uar, |
69 |
|
struct uar_file *file); |
70 |
|
|
71 |
|
void uar_file_destroy (struct uar_file *file); |
72 |
|
|
73 |
|
struct uar_file *uar_stream_add_entry (struct uar_archive *uar, |
74 |
|
const char *uar_name, |
75 |
|
const char *fs_name, struct stat *stinfo, |
76 |
|
uar_callback_t callback); |
77 |
|
struct uar_file *uar_stream_add_dir (struct uar_archive *uar, |
78 |
|
const char *uar_dirname, |
79 |
|
const char *fs_dirname, |
80 |
|
struct stat *stinfo, |
81 |
|
uar_callback_t callback); |
82 |
|
|
83 |
|
const char *uar_file_get_name (const struct uar_file *file); |
84 |
|
enum uar_file_type uar_file_get_type (const struct uar_file *file); |
85 |
|
uint64_t uar_file_get_size (const struct uar_file *file); |
86 |
|
mode_t uar_file_get_mode (const struct uar_file *file); |
87 |
|
void uar_file_set_mode (struct uar_file *file, mode_t mode); |
88 |
|
uint64_t uar_file_get_namelen (const struct uar_file *file); |
89 |
|
time_t uar_file_get_mtime (const struct uar_file *file); |
90 |
|
const char *uar_get_error_file (const struct uar_archive *uar); |
91 |
|
|
92 |
#ifndef NDEBUG |
#ifdef UAR_PRINT_VERBOSE_IMPL_INFO |
93 |
void uar_debug_print (const struct uar_archive *uar, bool print_file_contents); |
void uar_debug_print (const struct uar_archive *uar, bool print_file_contents); |
94 |
#endif |
#endif |
95 |
|
|