X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Ftar.c;h=e3fdf7bcfa7f837d4ecb7cd87d20288c7f688a22;hb=0ba8bdf5f3401fdc8c1595857ab69f6c65e04353;hp=3ef9c8f7a48c7c36c78c2ea6e626b3810f745c39;hpb=84a55f12e5880196623d4193bf1d7f5141e6b0d5;p=chaz%2Ftar diff --git a/src/tar.c b/src/tar.c index 3ef9c8f..e3fdf7b 100644 --- a/src/tar.c +++ b/src/tar.c @@ -214,9 +214,10 @@ subcommand_string (enum subcommand c) case UPDATE_SUBCOMMAND: return "-u"; - default: - abort (); + case TEST_LABEL_SUBCOMMAND: + return "--test-label"; } + abort (); } void @@ -280,6 +281,7 @@ enum INDEX_FILE_OPTION, KEEP_NEWER_FILES_OPTION, LEVEL_OPTION, + LZIP_OPTION, LZMA_OPTION, LZOP_OPTION, MODE_OPTION, @@ -623,6 +625,7 @@ static struct argp_option options[] = { {"ungzip", 0, 0, OPTION_ALIAS, NULL, GRID+1 }, {"compress", 'Z', 0, 0, NULL, GRID+1 }, {"uncompress", 0, 0, OPTION_ALIAS, NULL, GRID+1 }, + {"lzip", LZIP_OPTION, 0, 0, NULL, GRID+1 }, {"lzma", LZMA_OPTION, 0, 0, NULL, GRID+1 }, {"lzop", LZOP_OPTION, 0, 0, NULL, GRID+1 }, {"xz", 'J', 0, 0, NULL, GRID+1 }, @@ -907,9 +910,9 @@ format_default_settings (void) archive_format_string (DEFAULT_ARCHIVE_FORMAT), DEFAULT_ARCHIVE, DEFAULT_BLOCKING, quoting_style_args[DEFAULT_QUOTING_STYLE], - DEFAULT_RMT_COMMAND, + DEFAULT_RMT_COMMAND #ifdef REMOTE_SHELL - REMOTE_SHELL + , REMOTE_SHELL #endif ); } @@ -921,7 +924,7 @@ set_subcommand_option (enum subcommand subcommand) if (subcommand_option != UNKNOWN_SUBCOMMAND && subcommand_option != subcommand) USAGE_ERROR ((0, 0, - _("You may not specify more than one `-Acdtrux' option"))); + _("You may not specify more than one `-Acdtrux' or `--test-label' option"))); subcommand_option = subcommand; } @@ -1251,7 +1254,7 @@ tar_help_filter (int key, const char *text, void *input) { struct obstack stk; char *s; - + switch (key) { default: @@ -1270,6 +1273,10 @@ tar_help_filter (int key, const char *text, void *input) s = xasprintf (_("filter the archive through %s"), COMPRESS_PROGRAM); break; + case LZIP_OPTION: + s = xasprintf (_("filter the archive through %s"), LZIP_PROGRAM); + break; + case LZMA_OPTION: s = xasprintf (_("filter the archive through %s"), LZMA_PROGRAM); break; @@ -1279,19 +1286,23 @@ tar_help_filter (int key, const char *text, void *input) break; case ARGP_KEY_HELP_EXTRA: - obstack_init (&stk); - s = _("Valid arguments for the --quoting-style option are:"); - obstack_grow (&stk, s, strlen (s)); - obstack_grow (&stk, "\n\n", 2); - tar_list_quoting_styles (&stk, " "); - s = _("\n*This* tar defaults to:\n"); - obstack_grow (&stk, s, strlen (s)); - s = format_default_settings (); - obstack_grow (&stk, s, strlen (s)); - obstack_1grow (&stk, '\n'); - obstack_1grow (&stk, 0); - s = xstrdup (obstack_finish (&stk)); - obstack_free (&stk, NULL); + { + const char *tstr; + + obstack_init (&stk); + tstr = _("Valid arguments for the --quoting-style option are:"); + obstack_grow (&stk, tstr, strlen (tstr)); + obstack_grow (&stk, "\n\n", 2); + tar_list_quoting_styles (&stk, " "); + tstr = _("\n*This* tar defaults to:\n"); + obstack_grow (&stk, tstr, strlen (tstr)); + s = format_default_settings (); + obstack_grow (&stk, s, strlen (s)); + obstack_1grow (&stk, '\n'); + obstack_1grow (&stk, 0); + s = xstrdup (obstack_finish (&stk)); + obstack_free (&stk, NULL); + } } return s; } @@ -1505,6 +1516,10 @@ parse_opt (int key, char *arg, struct argp_state *state) } break; + case LZIP_OPTION: + set_use_compress_program_option (LZIP_PROGRAM); + break; + case LZMA_OPTION: set_use_compress_program_option (LZMA_PROGRAM); break; @@ -1612,8 +1627,7 @@ parse_opt (int key, char *arg, struct argp_state *state) break; case TEST_LABEL_OPTION: - set_subcommand_option (LIST_SUBCOMMAND); - test_label_option = true; + set_subcommand_option (TEST_LABEL_SUBCOMMAND); break; case 'T': @@ -2437,7 +2451,7 @@ decode_options (int argc, char **argv) old_files_option = UNLINK_FIRST_OLD_FILES; - if (test_label_option) + if (subcommand_option == TEST_LABEL_SUBCOMMAND) { /* --test-label is silent if the user has specified the label name to compare against. */ @@ -2472,6 +2486,7 @@ decode_options (int argc, char **argv) case EXTRACT_SUBCOMMAND: case LIST_SUBCOMMAND: case DIFF_SUBCOMMAND: + case TEST_LABEL_SUBCOMMAND: for (archive_name_cursor = archive_name_array; archive_name_cursor < archive_name_array + archive_names; archive_name_cursor++) @@ -2556,7 +2571,7 @@ main (int argc, char **argv) obstack_init (&argv_stk); /* Ensure default behavior for some signals */ - signal (SIGPIPE, SIG_DFL); + signal (SIGPIPE, SIG_IGN); /* System V fork+wait does not work if SIGCHLD is ignored. */ signal (SIGCHLD, SIG_DFL); @@ -2578,7 +2593,7 @@ main (int argc, char **argv) { case UNKNOWN_SUBCOMMAND: USAGE_ERROR ((0, 0, - _("You must specify one of the `-Acdtrux' options"))); + _("You must specify one of the `-Acdtrux' or `--test-label' options"))); case CAT_SUBCOMMAND: case UPDATE_SUBCOMMAND: @@ -2612,6 +2627,9 @@ main (int argc, char **argv) diff_init (); read_and (diff_archive); break; + + case TEST_LABEL_SUBCOMMAND: + test_archive_label (); } if (totals_option)