blob: be49f3d01955183c6e14ff711ab784d500de0e0b [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;
29} file_header_t;
30
31file_header_t *get_header_ar(FILE *in_file);
32file_header_t *get_header_cpio(FILE *src_stream);
33file_header_t *get_header_tar(FILE *tar_stream);
34
35void seek_sub_file(FILE *src_stream, const int count);
36
37extern off_t archive_offset;
38
39char *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
42char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function,
43 const char *prefix, const char *filename);