blob: eada1c3376052e073adef7f07625f8c8e65f5261 [file] [log] [blame]
Glenn L McGrath9af363f2001-10-27 14:10:37 +00001#include <stdio.h> // for FILE
2#include <unistd.h> // for off_t
Glenn L McGrathe9fc7812001-10-25 14:57:14 +00003
4enum 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
20typedef 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;
Glenn L McGrath87ac7022002-01-02 13:52:26 +000029 int (*extract_func)(FILE *, FILE *);
Glenn L McGrathe9fc7812001-10-25 14:57:14 +000030} file_header_t;
31
32file_header_t *get_header_ar(FILE *in_file);
33file_header_t *get_header_cpio(FILE *src_stream);
34file_header_t *get_header_tar(FILE *tar_stream);
Glenn L McGrath87ac7022002-01-02 13:52:26 +000035file_header_t *get_header_zip(FILE *zip_stream);
Glenn L McGrathe9fc7812001-10-25 14:57:14 +000036
37void seek_sub_file(FILE *src_stream, const int count);
38
39extern off_t archive_offset;
40
41char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers)(FILE *),
42 const int extract_function, const char *prefix, char **include_name, char **exclude_name);
43
44char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function,
45 const char *prefix, const char *filename);