]> Dogcows Code - chaz/tar/blobdiff - src/tar.c
(set_transform_expr): New function
[chaz/tar] / src / tar.c
index 5cd6b697e66887deb3da203e62b76b362daf6131..acc58671222ec3e74d785d86ee6cd68506741ef2 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -297,12 +297,13 @@ enum
   SAME_OWNER_OPTION,
   SHOW_DEFAULTS_OPTION,
   SHOW_OMITTED_DIRS_OPTION,
-  SHOW_STORED_NAMES_OPTION,
+  SHOW_TRANSFORMED_NAMES_OPTION,
   STRIP_COMPONENTS_OPTION,
   SUFFIX_OPTION,
   TEST_LABEL_OPTION,
   TOTALS_OPTION,
   TO_COMMAND_OPTION,
+  TRANSFORM_OPTION,
   UNQUOTE_OPTION,
   USAGE_OPTION,
   USE_COMPRESS_PROGRAM_OPTION,
@@ -600,8 +601,6 @@ static struct argp_option options[] = {
    N_("follow symlinks; archive and dump the files they point to"), GRID+1 },
   {"starting-file", 'K', N_("MEMBER-NAME"), 0,
    N_("begin at member MEMBER-NAME in the archive"), GRID+1 },
-  {"strip-components", STRIP_COMPONENTS_OPTION, N_("NUMBER"), 0,
-   N_("strip NUMBER leading components from file names"), GRID+1 },
   {"newer", 'N', N_("DATE-OR-FILE"), 0,
    N_("only store files newer than DATE-OR-FILE"), GRID+1 },
   {"newer-mtime", NEWER_MTIME_OPTION, N_("DATE"), 0,
@@ -614,6 +613,16 @@ static struct argp_option options[] = {
    N_("backup before removal, override usual suffix ('~' unless overridden by environment variable SIMPLE_BACKUP_SUFFIX)"), GRID+1 },
 #undef GRID
 
+#define GRID 92
+  {NULL, 0, NULL, 0,
+   N_("File name transformations:"), GRID },
+  {"strip-components", STRIP_COMPONENTS_OPTION, N_("NUMBER"), 0,
+   N_("strip NUMBER leading components from file names on extraction"),
+   GRID+1 },
+  {"transform", TRANSFORM_OPTION, N_("EXPRESSION"), 0,
+   N_("Use sed replace EXPRESSION to transform file names"), GRID+1 },
+#undef GRID
+
 #define GRID 95  
   {NULL, 0, NULL, 0,
    N_("File name matching options (affect both exclude and include patterns):"),
@@ -661,9 +670,10 @@ static struct argp_option options[] = {
    N_("show tar defaults"), GRID+1 },
   {"show-omitted-dirs", SHOW_OMITTED_DIRS_OPTION, 0, 0,
    N_("when listing or extracting, list each directory that does not match search criteria"), GRID+1 },
-  {"show-stored-names", SHOW_STORED_NAMES_OPTION, 0, 0,
-   N_("when creating archive in verbose mode, list member names as stored in the archive"),
+  {"show-transformed-names", SHOW_TRANSFORMED_NAMES_OPTION, 0, 0,
+   N_("show file or archive names after transformation"),
    GRID+1 },
+  {"show-stored-names", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
   {"quoting-style", QUOTING_STYLE_OPTION, N_("STYLE"), 0,
    N_("set name quoting style; see below for valid STYLE values"), GRID+1 },
   {"quote-chars", QUOTE_CHARS_OPTION, N_("STRING"), 0,
@@ -1491,8 +1501,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
       show_omitted_dirs_option = true;
       break;
 
-    case SHOW_STORED_NAMES_OPTION:
-      show_stored_names_option = true;
+    case SHOW_TRANSFORMED_NAMES_OPTION:
+      show_transformed_names_option = true;
       break;
 
     case SUFFIX_OPTION:
@@ -1510,6 +1520,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
       totals_option = true;
       break;
 
+    case TRANSFORM_OPTION:
+      set_transform_expr (arg);
+      break;
+      
     case USE_COMPRESS_PROGRAM_OPTION:
       set_use_compress_program_option (arg);
       break;
This page took 0.021682 seconds and 4 git commands to generate.