diff options
author | Glenn L McGrath | 2002-12-08 00:54:33 +0000 |
---|---|---|
committer | Glenn L McGrath | 2002-12-08 00:54:33 +0000 |
commit | 66125c806518f74a54232206d02e30a39b621232 (patch) | |
tree | f7e34d157460ad689c350071a25d19cdd51e1ebb /archival | |
parent | 346cdb1ddea7d825b29e9dcd73d6f7af8db8598f (diff) | |
download | busybox-66125c806518f74a54232206d02e30a39b621232.zip busybox-66125c806518f74a54232206d02e30a39b621232.tar.gz |
Move add_to_list from libunarchive to libbb so it can be of more general use (eg ifupdown). Changed the name to llist_add_to as i plan on adding more llist_ functions as needed (e.g. llist_free).
Diffstat (limited to 'archival')
-rw-r--r-- | archival/ar.c | 2 | ||||
-rw-r--r-- | archival/cpio.c | 2 | ||||
-rw-r--r-- | archival/dpkg.c | 14 | ||||
-rw-r--r-- | archival/dpkg_deb.c | 12 | ||||
-rw-r--r-- | archival/libunarchive/Makefile.in | 1 | ||||
-rw-r--r-- | archival/libunarchive/add_to_list.c | 15 | ||||
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 2 | ||||
-rw-r--r-- | archival/tar.c | 6 | ||||
-rw-r--r-- | archival/unzip.c | 2 |
9 files changed, 20 insertions, 36 deletions
diff --git a/archival/ar.c b/archival/ar.c index 71cde4e..87968f7 100644 --- a/archival/ar.c +++ b/archival/ar.c @@ -124,7 +124,7 @@ extern int ar_main(int argc, char **argv) /* TODO: This is the same as in tar, seperate function ? */ while (optind < argc) { archive_handle->filter = filter_accept_list; - archive_handle->accept = add_to_list(archive_handle->accept, argv[optind]); + archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind]); optind++; } diff --git a/archival/cpio.c b/archival/cpio.c index 2aa1194..8b4cc2d 100644 --- a/archival/cpio.c +++ b/archival/cpio.c @@ -79,7 +79,7 @@ extern int cpio_main(int argc, char **argv) while (optind < argc) { archive_handle->filter = filter_accept_list; - archive_handle->accept = add_to_list(archive_handle->accept, argv[optind]); + archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind]); optind++; } diff --git a/archival/dpkg.c b/archival/dpkg.c index 274d711..d3e652b 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -1330,10 +1330,10 @@ static void init_archive_deb_control(archive_handle_t *ar_handle) /* We dont care about data.tar.* or debian-binary, just control.tar.* */ #ifdef CONFIG_FEATURE_DEB_TAR_GZ - ar_handle->accept = add_to_list(NULL, "control.tar.gz"); + ar_handle->accept = llist_add_to(NULL, "control.tar.gz"); #endif #ifdef CONFIG_FEATURE_DEB_TAR_BZ2 - ar_handle->accept = add_to_list(ar_handle->accept, "control.tar.bz2"); + ar_handle->accept = llist_add_to(ar_handle->accept, "control.tar.bz2"); #endif /* Assign the tar handle as a subarchive of the ar handle */ @@ -1353,10 +1353,10 @@ static void init_archive_deb_data(archive_handle_t *ar_handle) /* We dont care about data.tar.* or debian-binary, just control.tar.* */ #ifdef CONFIG_FEATURE_DEB_TAR_GZ - tar_handle->accept = add_to_list(NULL, "data.tar.gz"); + tar_handle->accept = llist_add_to(NULL, "data.tar.gz"); #endif #ifdef CONFIG_FEATURE_DEB_TAR_BZ2 - tar_handle->accept = add_to_list(ar_handle->accept, "data.tar.bz2"); + tar_handle->accept = llist_add_to(ar_handle->accept, "data.tar.bz2"); #endif /* Assign the tar handle as a subarchive of the ar handle */ @@ -1365,7 +1365,7 @@ static void init_archive_deb_data(archive_handle_t *ar_handle) return; } -static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, const llist_t *accept) +static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, llist_t *accept) { ar_handle->sub_archive->action_data = data_extract_to_buffer; ar_handle->sub_archive->accept = accept; @@ -1532,10 +1532,10 @@ int dpkg_main(int argc, char **argv) deb_file[deb_count] = (deb_file_t *) xmalloc(sizeof(deb_file_t)); if (dpkg_opt & dpkg_opt_filename) { archive_handle_t *archive_handle; - const llist_t *control_list = NULL; + llist_t *control_list = NULL; /* Extract the control file */ - control_list = add_to_list(NULL, "./control"); + control_list = llist_add_to(NULL, "./control"); archive_handle = init_archive_deb_ar(argv[optind]); init_archive_deb_control(archive_handle); deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list); diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index 7ce637e..2c33822 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -27,7 +27,7 @@ extern int dpkg_deb_main(int argc, char **argv) archive_handle_t *tar_archive; int opt = 0; #ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY - const llist_t *control_tar_llist = NULL; + llist_t *control_tar_llist = NULL; #endif /* Setup the tar archive handle */ @@ -39,16 +39,16 @@ extern int dpkg_deb_main(int argc, char **argv) ar_archive->filter = filter_accept_list_reassign; #ifdef CONFIG_FEATURE_DEB_TAR_GZ - ar_archive->accept = add_to_list(NULL, "data.tar.gz"); + ar_archive->accept = llist_add_to(NULL, "data.tar.gz"); # ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY - control_tar_llist = add_to_list(NULL, "control.tar.gz"); + control_tar_llist = llist_add_to(NULL, "control.tar.gz"); # endif #endif #ifdef CONFIG_FEATURE_DEB_TAR_BZ2 - ar_archive->accept = add_to_list(ar_archive->accept, "data.tar.bz2"); + ar_archive->accept = llist_add_to(ar_archive->accept, "data.tar.bz2"); # ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY - control_tar_llist = add_to_list(control_tar_llist, "control.tar.bz2"); + control_tar_llist = llist_add_to(control_tar_llist, "control.tar.bz2"); # endif #endif @@ -71,7 +71,7 @@ extern int dpkg_deb_main(int argc, char **argv) * it should accept a second argument which specifies a * specific field to print */ ar_archive->accept = control_tar_llist; - tar_archive->accept = add_to_list(NULL, "./control");; + tar_archive->accept = llist_add_to(NULL, "./control");; tar_archive->filter = filter_accept_list; tar_archive->action_data = data_extract_to_stdout; break; diff --git a/archival/libunarchive/Makefile.in b/archival/libunarchive/Makefile.in index 5675d09..28e2955 100644 --- a/archival/libunarchive/Makefile.in +++ b/archival/libunarchive/Makefile.in @@ -53,7 +53,6 @@ LIBUNARCHIVE-y:= \ \ archive_copy_file.o \ \ - add_to_list.o \ check_header_gzip.o \ check_trailer_gzip.o \ data_align.o \ diff --git a/archival/libunarchive/add_to_list.c b/archival/libunarchive/add_to_list.c deleted file mode 100644 index 052bca3..0000000 --- a/archival/libunarchive/add_to_list.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <stdlib.h> -#include <string.h> -#include "unarchive.h" -#include "libbb.h" - -extern const llist_t *add_to_list(const llist_t *old_head, const char *new_item) -{ - llist_t *new_head; - - new_head = xmalloc(sizeof(llist_t)); - new_head->data = new_item; - new_head->link = old_head; - - return(new_head); -} diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index 37e33d4..5fed7c1 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c @@ -171,7 +171,7 @@ extern char get_header_tar(archive_handle_t *archive_handle) archive_handle->action_header(archive_handle->file_header); archive_handle->flags |= ARCHIVE_EXTRACT_QUIET; archive_handle->action_data(archive_handle); - archive_handle->passed = add_to_list(archive_handle->passed, archive_handle->file_header->name); + archive_handle->passed = llist_add_to(archive_handle->passed, archive_handle->file_header->name); } else { data_skip(archive_handle); } diff --git a/archival/tar.c b/archival/tar.c index 1899ab9..fa1c575 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -583,13 +583,13 @@ static inline int writeTarFile(const char *tarName, const int verboseFlag, #endif /* tar_create */ #ifdef CONFIG_FEATURE_TAR_EXCLUDE -static const llist_t *append_file_list_to_list(const char *filename, const llist_t *list) +static llist_t *append_file_list_to_list(const char *filename, llist_t *list) { FILE *src_stream = xfopen(filename, "r"); char *line; while((line = get_line_from_file(src_stream)) != NULL) { chomp(line); - list = add_to_list(list, line); + list = llist_add_to(list, line); } fclose(src_stream); @@ -708,7 +708,7 @@ int tar_main(int argc, char **argv) /* Setup an array of filenames to work with */ /* TODO: This is the same as in ar, seperate function ? */ while (optind < argc) { - tar_handle->accept = add_to_list(tar_handle->accept, argv[optind]); + tar_handle->accept = llist_add_to(tar_handle->accept, argv[optind]); optind++; } diff --git a/archival/unzip.c b/archival/unzip.c index 4c1e5ce..86416d3 100644 --- a/archival/unzip.c +++ b/archival/unzip.c @@ -147,7 +147,7 @@ extern int unzip_main(int argc, char **argv) while (optind < argc) { archive_handle->filter = filter_accept_list; - archive_handle->accept = add_to_list(archive_handle->accept, argv[optind]); + archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind]); optind++; } |