diff options
Diffstat (limited to 'archival')
-rw-r--r-- | archival/ar.c | 59 | ||||
-rw-r--r-- | archival/bbunzip.c | 10 | ||||
-rw-r--r-- | archival/cpio.c | 2 | ||||
-rw-r--r-- | archival/dpkg_deb.c | 2 |
4 files changed, 38 insertions, 35 deletions
diff --git a/archival/ar.c b/archival/ar.c index af9793f23..71f949e79 100644 --- a/archival/ar.c +++ b/archival/ar.c @@ -48,16 +48,6 @@ //kbuild:lib-$(CONFIG_AR) += ar.o -//usage:#define ar_trivial_usage -//usage: "[-optxv] ARCHIVE FILES" -//usage:#define ar_full_usage "\n\n" -//usage: "Extract or list FILES from an ar archive\n" -//usage: "\n -o Preserve original dates" -//usage: "\n -p Extract to stdout" -//usage: "\n -t List" -//usage: "\n -x Extract" -//usage: "\n -v Verbose" - #include "libbb.h" #include "bb_archive.h" #include "ar_.h" @@ -220,23 +210,36 @@ static void FAST_FUNC header_verbose_list_ar(const file_header_t *file_header) ); } -#define AR_OPT_VERBOSE (1 << 0) -#define AR_OPT_PRESERVE_DATE (1 << 1) -/* "ar r" implies create, but warns about it. c suppresses warning. - * bbox accepts but ignores it: */ -#define AR_OPT_CREATE (1 << 2) - -#define AR_CMD_PRINT (1 << 3) -#define FIRST_CMD AR_CMD_PRINT -#define AR_CMD_LIST (1 << 4) -#define AR_CMD_EXTRACT (1 << 5) -#define AR_CMD_INSERT (1 << 6) +//usage:#define ar_trivial_usage +//usage: "x|p|t"IF_FEATURE_AR_CREATE("|r")" [-ov] ARCHIVE [FILE]..." +//usage:#define ar_full_usage "\n\n" +//usage: "Extract or list FILEs from an ar archive"IF_FEATURE_AR_CREATE(", or create it")"\n" +//usage: "\n x Extract" +//usage: "\n p Extract to stdout" +//usage: "\n t List" +//usage: IF_FEATURE_AR_CREATE( +//usage: "\n r Create" +//usage: ) +//usage: "\n -o Restore mtime" +//usage: "\n -v Verbose" int ar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int ar_main(int argc UNUSED_PARAM, char **argv) { archive_handle_t *archive_handle; unsigned opt, t; + enum { + OPT_VERBOSE = (1 << 0), + OPT_PRESERVE_DATE = (1 << 1), + /* "ar r" implies create, but warns about it. c suppresses warning. + * bbox accepts but ignores it: */ + OPT_CREATE = (1 << 2), + CMD_PRINT = (1 << 3), + FIRST_CMD = CMD_PRINT, + CMD_LIST = (1 << 4), + CMD_EXTRACT = (1 << 5), + CMD_INSERT = ((1 << 6) * ENABLE_FEATURE_AR_CREATE), + }; archive_handle = init_handle(); @@ -256,26 +259,26 @@ int ar_main(int argc UNUSED_PARAM, char **argv) if (t & (t-1)) /* more than one of p,t,x[,r] are specified */ bb_show_usage(); - if (opt & AR_CMD_PRINT) { + if (opt & CMD_PRINT) { archive_handle->action_data = data_extract_to_stdout; } - if (opt & AR_CMD_LIST) { + if (opt & CMD_LIST) { archive_handle->action_header = header_list; } - if (opt & AR_CMD_EXTRACT) { + if (opt & CMD_EXTRACT) { archive_handle->action_data = data_extract_all; } - if (opt & AR_OPT_PRESERVE_DATE) { + if (opt & OPT_PRESERVE_DATE) { archive_handle->ah_flags |= ARCHIVE_RESTORE_DATE; } - if (opt & AR_OPT_VERBOSE) { + if (opt & OPT_VERBOSE) { archive_handle->action_header = header_verbose_list_ar; } #if ENABLE_FEATURE_AR_CREATE archive_handle->ar__name = *argv; #endif archive_handle->src_fd = xopen(*argv++, - (opt & AR_CMD_INSERT) + (opt & CMD_INSERT) ? O_RDWR | O_CREAT : O_RDONLY ); @@ -287,7 +290,7 @@ int ar_main(int argc UNUSED_PARAM, char **argv) } #if ENABLE_FEATURE_AR_CREATE - if (opt & AR_CMD_INSERT) + if (opt & CMD_INSERT) return write_ar_archive(archive_handle); #endif diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 6244bce85..d639f307e 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c @@ -219,7 +219,7 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext) //usage:#define uncompress_trivial_usage //usage: "[-cf] [FILE]..." //usage:#define uncompress_full_usage "\n\n" -//usage: "Decompress .Z file[s]\n" +//usage: "Decompress FILEs (or stdin)\n" //usage: "\n -c Write to stdout" //usage: "\n -f Overwrite" @@ -461,7 +461,7 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) //usage:#define unlzma_trivial_usage //usage: "[-cfk] [FILE]..." //usage:#define unlzma_full_usage "\n\n" -//usage: "Decompress FILE (or stdin)\n" +//usage: "Decompress FILEs (or stdin)\n" //usage: "\n -c Write to stdout" //usage: "\n -f Force" //usage: "\n -k Keep input files" @@ -469,7 +469,7 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) //usage:#define lzma_trivial_usage //usage: "-d [-cfk] [FILE]..." //usage:#define lzma_full_usage "\n\n" -//usage: "Decompress FILE (or stdin)\n" +//usage: "Decompress FILEs (or stdin)\n" //usage: "\n -d Decompress" //usage: "\n -c Write to stdout" //usage: "\n -f Force" @@ -532,7 +532,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) //usage:#define unxz_trivial_usage //usage: "[-cfk] [FILE]..." //usage:#define unxz_full_usage "\n\n" -//usage: "Decompress FILE (or stdin)\n" +//usage: "Decompress FILEs (or stdin)\n" //usage: "\n -c Write to stdout" //usage: "\n -f Force" //usage: "\n -k Keep input files" @@ -541,7 +541,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) //usage:#define xz_trivial_usage //usage: "-d [-cfk] [FILE]..." //usage:#define xz_full_usage "\n\n" -//usage: "Decompress FILE (or stdin)\n" +//usage: "Decompress FILEs (or stdin)\n" //usage: "\n -d Decompress" //usage: "\n -c Write to stdout" //usage: "\n -f Force" diff --git a/archival/cpio.c b/archival/cpio.c index 94b4b8174..94303389e 100644 --- a/archival/cpio.c +++ b/archival/cpio.c @@ -68,7 +68,7 @@ //usage: "\n -H newc Archive format" //usage: ) //usage: "\n -d Make leading directories" -//usage: "\n -m Preserve mtime" +//usage: "\n -m Restore mtime" //usage: "\n -v Verbose" //usage: "\n -u Overwrite" //usage: "\n -F FILE Input (-t,-i,-p) or output (-o) file" diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index c2c4cbbcc..a5a80439d 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -28,7 +28,7 @@ //usage: "\n -f Print control fields" //usage: "\n -e Extract control files to DIR (default: ./DEBIAN)" //usage: "\n -x Extract files to DIR (no default)" -//usage: "\n -X Verbose -x" +//usage: "\n -X Verbose extract" //usage: //usage:#define dpkg_deb_example_usage //usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" |