Glenn L McGrath | 9af363f | 2001-10-27 14:10:37 +0000 | [diff] [blame] | 1 | #include <stdio.h> // for FILE |
| 2 | #include <unistd.h> // for off_t |
Glenn L McGrath | e9fc781 | 2001-10-25 14:57:14 +0000 | [diff] [blame] | 3 | |
| 4 | enum extract_functions_e { |
| 5 | extract_verbose_list = 1, |
| 6 | extract_list = 2, |
| 7 | extract_one_to_buffer = 4, |
| 8 | extract_to_stdout = 8, |
| 9 | extract_all_to_fs = 16, |
| 10 | extract_preserve_date = 32, |
| 11 | extract_data_tar_gz = 64, |
| 12 | extract_control_tar_gz = 128, |
| 13 | extract_unzip_only = 256, |
| 14 | extract_unconditional = 512, |
| 15 | extract_create_leading_dirs = 1024, |
| 16 | extract_quiet = 2048, |
| 17 | extract_exclude_list = 4096 |
| 18 | }; |
| 19 | |
| 20 | typedef struct file_headers_s { |
| 21 | char *name; |
| 22 | char *link_name; |
| 23 | off_t size; |
| 24 | uid_t uid; |
| 25 | gid_t gid; |
| 26 | mode_t mode; |
| 27 | time_t mtime; |
| 28 | dev_t device; |
| 29 | } file_header_t; |
| 30 | |
| 31 | file_header_t *get_header_ar(FILE *in_file); |
| 32 | file_header_t *get_header_cpio(FILE *src_stream); |
| 33 | file_header_t *get_header_tar(FILE *tar_stream); |
| 34 | |
| 35 | void seek_sub_file(FILE *src_stream, const int count); |
| 36 | |
| 37 | extern off_t archive_offset; |
| 38 | |
| 39 | char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers)(FILE *), |
| 40 | const int extract_function, const char *prefix, char **include_name, char **exclude_name); |
| 41 | |
| 42 | char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function, |
| 43 | const char *prefix, const char *filename); |