aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/Makefile43
-rw-r--r--archival/config.in19
-rw-r--r--archival/gzip.c2
-rw-r--r--archival/tar.c32
4 files changed, 79 insertions, 17 deletions
diff --git a/archival/Makefile b/archival/Makefile
new file mode 100644
index 000000000..66c2d0b6b
--- /dev/null
+++ b/archival/Makefile
@@ -0,0 +1,43 @@
1# Makefile for busybox
2#
3# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18#
19
20TOPDIR :=..
21L_TARGET := archival.a
22
23obj-y :=
24obj-n :=
25obj- :=
26
27obj-$(CONFIG_AR) += ar.o
28obj-$(CONFIG_BUNZIP2) += bunzip2.o
29obj-$(CONFIG_CPIO) += cpio.o
30obj-$(CONFIG_DPKG) += dpkg.o
31obj-$(CONFIG_DPKG_DEB) += dpkg_deb.o
32obj-$(CONFIG_GUNZIP) += gunzip.o
33obj-$(CONFIG_GZIP) += gzip.o
34obj-$(CONFIG_RPMUNPACK) += rpm2cpio.o
35obj-$(CONFIG_TAR) += tar.o
36
37
38# Hand off to toplevel Rules.mak
39include $(TOPDIR)/Rules.mak
40
41clean:
42 rm -f $(L_TARGET) *.o core
43
diff --git a/archival/config.in b/archival/config.in
new file mode 100644
index 000000000..c195f24a1
--- /dev/null
+++ b/archival/config.in
@@ -0,0 +1,19 @@
1#
2# For a description of the syntax of this configuration file,
3# see scripts/kbuild/config-language.txt.
4#
5
6mainmenu_option next_comment
7comment 'Archival Utilities'
8
9bool 'ar' CONFIG_AR
10bool 'bunzip2' CONFIG_BUNZIP2
11bool 'cpio' CONFIG_CPIO
12bool 'dpkg' CONFIG_DPKG
13bool 'dpkg_deb' CONFIG_DPKG_DEB
14bool 'gunzip' CONFIG_GUNZIP
15bool 'gzip' CONFIG_GZIP
16bool 'rpm2cpio' CONFIG_RPM2CPIO
17bool 'tar' CONFIG_TAR
18endmenu
19
diff --git a/archival/gzip.c b/archival/gzip.c
index 5c86c1070..df665c121 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -1231,7 +1231,7 @@ int gzip_main(int argc, char **argv)
1231 break; 1231 break;
1232 case 'q': 1232 case 'q':
1233 break; 1233 break;
1234#ifdef BB_GUNZIP 1234#ifdef CONFIG_GUNZIP
1235 case 'd': 1235 case 'd':
1236 optind = 1; 1236 optind = 1;
1237 return gunzip_main(argc, argv); 1237 return gunzip_main(argc, argv);
diff --git a/archival/tar.c b/archival/tar.c
index f7a3da66f..9e38eea75 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -9,8 +9,8 @@
9 * ground up. It still has remnents of the old code lying about, but it is 9 * ground up. It still has remnents of the old code lying about, but it is
10 * very different now (i.e., cleaner, less global variables, etc.) 10 * very different now (i.e., cleaner, less global variables, etc.)
11 * 11 *
12 * Copyright (C) 1999,2000,2001 by Lineo, inc. 12 * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
13 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 13 * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
14 * 14 *
15 * Based in part in the tar implementation in sash 15 * Based in part in the tar implementation in sash
16 * Copyright (c) 1999 by David I. Bell 16 * Copyright (c) 1999 by David I. Bell
@@ -49,7 +49,7 @@
49#include <errno.h> 49#include <errno.h>
50#include "busybox.h" 50#include "busybox.h"
51 51
52#ifdef BB_FEATURE_TAR_CREATE 52#ifdef CONFIG_FEATURE_TAR_CREATE
53 53
54/* Tar file constants */ 54/* Tar file constants */
55# define TAR_MAGIC "ustar" /* ustar and a null */ 55# define TAR_MAGIC "ustar" /* ustar and a null */
@@ -395,11 +395,11 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
395 if (header_name[0] == '\0') 395 if (header_name[0] == '\0')
396 return TRUE; 396 return TRUE;
397 397
398# if defined BB_FEATURE_TAR_EXCLUDE 398# if defined CONFIG_FEATURE_TAR_EXCLUDE
399 if (exclude_file(tbInfo->excludeList, header_name)) { 399 if (exclude_file(tbInfo->excludeList, header_name)) {
400 return SKIP; 400 return SKIP;
401 } 401 }
402# endif //BB_FEATURE_TAR_EXCLUDE 402# endif //CONFIG_FEATURE_TAR_EXCLUDE
403 403
404 if (writeTarHeader(tbInfo, header_name, fileName, statbuf)==FALSE) { 404 if (writeTarHeader(tbInfo, header_name, fileName, statbuf)==FALSE) {
405 return( FALSE); 405 return( FALSE);
@@ -527,7 +527,7 @@ void append_file_list_to_list(char *filename, char ***name_list, int *num_of_ent
527 fclose(src_stream); 527 fclose(src_stream);
528} 528}
529 529
530#ifdef BB_FEATURE_TAR_EXCLUDE 530#ifdef CONFIG_FEATURE_TAR_EXCLUDE
531/* 531/*
532 * Create a list of names that are in the include list AND NOT in the exclude lists 532 * Create a list of names that are in the include list AND NOT in the exclude lists
533 */ 533 */
@@ -626,7 +626,7 @@ int tar_main(int argc, char **argv)
626 626
627 /* These are optional */ 627 /* These are optional */
628 /* Exclude or Include files listed in <filename>*/ 628 /* Exclude or Include files listed in <filename>*/
629#ifdef BB_FEATURE_TAR_EXCLUDE 629#ifdef CONFIG_FEATURE_TAR_EXCLUDE
630 case 'X': 630 case 'X':
631 append_file_list_to_list(optarg, &exclude_list, &exclude_list_count); 631 append_file_list_to_list(optarg, &exclude_list, &exclude_list_count);
632 break; 632 break;
@@ -660,7 +660,7 @@ int tar_main(int argc, char **argv)
660 } 660 }
661 extract_function |= extract_list; 661 extract_function |= extract_list;
662 break; 662 break;
663#ifdef BB_FEATURE_TAR_GZIP 663#ifdef CONFIG_FEATURE_TAR_GZIP
664 case 'z': 664 case 'z':
665 untar_funct |= untar_unzip; 665 untar_funct |= untar_unzip;
666 break; 666 break;
@@ -698,43 +698,43 @@ int tar_main(int argc, char **argv)
698 } else { 698 } else {
699 src_stream = stdin; 699 src_stream = stdin;
700 } 700 }
701#ifdef BB_FEATURE_TAR_GZIP 701#ifdef CONFIG_FEATURE_TAR_GZIP
702 /* Get a binary tree of all the tar file headers */ 702 /* Get a binary tree of all the tar file headers */
703 if (untar_funct & untar_unzip) { 703 if (untar_funct & untar_unzip) {
704 uncompressed_stream = gz_open(src_stream, &gunzip_pid); 704 uncompressed_stream = gz_open(src_stream, &gunzip_pid);
705 } else 705 } else
706#endif // BB_FEATURE_TAR_GZIP 706#endif // CONFIG_FEATURE_TAR_GZIP
707 uncompressed_stream = src_stream; 707 uncompressed_stream = src_stream;
708 708
709 /* extract or list archive */ 709 /* extract or list archive */
710 unarchive(uncompressed_stream, stdout, &get_header_tar, extract_function, dst_prefix, include_list, exclude_list); 710 unarchive(uncompressed_stream, stdout, &get_header_tar, extract_function, dst_prefix, include_list, exclude_list);
711 fclose(uncompressed_stream); 711 fclose(uncompressed_stream);
712 } 712 }
713#ifdef BB_FEATURE_TAR_CREATE 713#ifdef CONFIG_FEATURE_TAR_CREATE
714 /* create an archive */ 714 /* create an archive */
715 else if (untar_funct & untar_create) { 715 else if (untar_funct & untar_create) {
716 int verboseFlag = FALSE; 716 int verboseFlag = FALSE;
717 717
718#ifdef BB_FEATURE_TAR_GZIP 718#ifdef CONFIG_FEATURE_TAR_GZIP
719 if (untar_funct && untar_unzip) { 719 if (untar_funct && untar_unzip) {
720 error_msg_and_die("Creation of compressed tarfile not internally support by tar, pipe to busybox gunzip"); 720 error_msg_and_die("Creation of compressed tarfile not internally support by tar, pipe to busybox gunzip");
721 } 721 }
722#endif // BB_FEATURE_TAR_GZIP 722#endif // CONFIG_FEATURE_TAR_GZIP
723 if (extract_function & extract_verbose_list) { 723 if (extract_function & extract_verbose_list) {
724 verboseFlag = TRUE; 724 verboseFlag = TRUE;
725 } 725 }
726 writeTarFile(src_filename, verboseFlag, &argv[argc - 1], include_list); 726 writeTarFile(src_filename, verboseFlag, &argv[argc - 1], include_list);
727 } 727 }
728#endif // BB_FEATURE_TAR_CREATE 728#endif // CONFIG_FEATURE_TAR_CREATE
729 729
730 /* Cleanups */ 730 /* Cleanups */
731#ifdef BB_FEATURE_TAR_GZIP 731#ifdef CONFIG_FEATURE_TAR_GZIP
732 if (untar_funct & untar_unzip) { 732 if (untar_funct & untar_unzip) {
733 fclose(src_stream); 733 fclose(src_stream);
734 close(gz_fd); 734 close(gz_fd);
735 gz_close(gunzip_pid); 735 gz_close(gunzip_pid);
736 } 736 }
737#endif // BB_FEATURE_TAR_GZIP 737#endif // CONFIG_FEATURE_TAR_GZIP
738 if (src_filename) { 738 if (src_filename) {
739 free(src_filename); 739 free(src_filename);
740 } 740 }