mirror of
https://github.com/topjohnwu/ndk-busybox.git
synced 2024-11-29 14:40:25 +00:00
libunarchive, and recovery from my previous commit
This commit is contained in:
parent
633f153808
commit
e9fc781570
@ -212,39 +212,6 @@ char *last_char_is(const char *s, int c);
|
||||
|
||||
extern long arith (const char *startbuf, int *errcode);
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
};
|
||||
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);
|
||||
int read_package_field(const char *package_buffer, char **field_name, char **field_value);
|
||||
char *fgets_str(FILE *file, const char *terminating_string);
|
||||
|
||||
@ -318,49 +285,5 @@ extern const char * const can_not_create_raw_socket;
|
||||
/* The following devices are the same on devfs and non-devfs systems. */
|
||||
#define CURRENT_TTY "/dev/tty"
|
||||
#define CONSOLE_DEV "/dev/console"
|
||||
typedef struct deb_file_s {
|
||||
char *filename;
|
||||
char *control_file;
|
||||
unsigned short node:14;
|
||||
} deb_file_t;
|
||||
|
||||
typedef struct node_s {
|
||||
/* This are always used by dpkg */
|
||||
unsigned short name:14;
|
||||
unsigned short epoch:4;
|
||||
unsigned short version:12;
|
||||
unsigned short revision:8;
|
||||
unsigned short essential:1;
|
||||
unsigned short state_want:3;
|
||||
unsigned short state_flag:2;
|
||||
unsigned short state_status:3;
|
||||
unsigned short pool_flag:2;
|
||||
unsigned short source:11;
|
||||
unsigned short filename:11;
|
||||
unsigned short num_of_edges:7;
|
||||
unsigned short *edge;
|
||||
#ifdef BB_FEATURE_DPKG_LIST_SHORT_DESCRIPTIONS
|
||||
char *description_short; /* This is used by dpkg -l */
|
||||
#endif
|
||||
} node_t;
|
||||
|
||||
/* All these are in deb_functs.c */
|
||||
extern void deb_initialise_hashtables(short type);
|
||||
extern void write_status_file(deb_file_t **deb_file);
|
||||
extern void configure_package(deb_file_t *deb_file);
|
||||
extern void unpack_package(deb_file_t *deb_file);
|
||||
extern void remove_package(const unsigned int node_num);
|
||||
extern void index_status_file(const char *filename);
|
||||
extern void find_deps(const char *package_name);
|
||||
extern void purge_package(const unsigned int node_num);
|
||||
extern node_t *parse_package_metadata(char *control_buffer);
|
||||
extern unsigned short search_node_ht(node_t *search_node, unsigned short operator);
|
||||
extern void add_node(node_t *node, unsigned short node_num);
|
||||
extern node_t *initialise_node(const char *package_name);
|
||||
extern char *get_name_ht(unsigned short name_num);
|
||||
extern void free_hashtables(void);
|
||||
extern node_t *get_node_ht(unsigned short node_num);
|
||||
extern char *version_revision(unsigned short version_num, unsigned short revision_num);
|
||||
extern void free_node(node_t *node);
|
||||
|
||||
#endif /* __LIBCONFIG_H__ */
|
||||
|
42
include/unarchive.h
Normal file
42
include/unarchive.h
Normal file
@ -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);
|
Loading…
Reference in New Issue
Block a user