aboutsummaryrefslogtreecommitdiff
path: root/include/unarchive.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/unarchive.h')
-rw-r--r--include/unarchive.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/unarchive.h b/include/unarchive.h
new file mode 100644
index 000000000..c4400981d
--- /dev/null
+++ b/include/unarchive.h
@@ -0,0 +1,42 @@
+#include <stdio.h> // for off_t
+
+enum extract_functions_e {
+ extract_verbose_list = 1,
+ extract_list = 2,
+ extract_one_to_buffer = 4,
+ extract_to_stdout = 8,
+ extract_all_to_fs = 16,
+ extract_preserve_date = 32,
+ extract_data_tar_gz = 64,
+ extract_control_tar_gz = 128,
+ extract_unzip_only = 256,
+ extract_unconditional = 512,
+ extract_create_leading_dirs = 1024,
+ extract_quiet = 2048,
+ extract_exclude_list = 4096
+};
+
+typedef struct file_headers_s {
+ char *name;
+ char *link_name;
+ off_t size;
+ uid_t uid;
+ gid_t gid;
+ mode_t mode;
+ time_t mtime;
+ dev_t device;
+} file_header_t;
+
+file_header_t *get_header_ar(FILE *in_file);
+file_header_t *get_header_cpio(FILE *src_stream);
+file_header_t *get_header_tar(FILE *tar_stream);
+
+void seek_sub_file(FILE *src_stream, const int count);
+
+extern off_t archive_offset;
+
+char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers)(FILE *),
+ const int extract_function, const char *prefix, char **include_name, char **exclude_name);
+
+char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function,
+ const char *prefix, const char *filename);