diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-07-22 11:34:56 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-07-22 12:55:37 +0300 |
commit | 4c7d4359d2dc58126e4e7c6e3dd7cc196322ef28 (patch) | |
tree | cfb147da59dd1e5cdfac7eb5638f5ce28ec2675e /src/main.c | |
parent | f40dd3ef902337afd9c5ccc6d69538e155ea26e7 (diff) | |
download | cpio-4c7d4359d2dc58126e4e7c6e3dd7cc196322ef28.tar.gz cpio-4c7d4359d2dc58126e4e7c6e3dd7cc196322ef28.tar.bz2 |
Provide a tar-like --directory (-D) option.
* src/copyin.c (process_copy_in): Call change_dir.
* src/copyout.c (process_copy_out): Likewise.
* src/copypass.c (process_copy_pass): Likewise.
* src/extern.h (change_directory_option): New extern.
(change_dir): New proto.
* src/global.c (change_directory_option): New global.
* src/main.c (options): New option --directory.
(parse_opt): Handle the --directory option.
* src/util.c (change_dir): New proto.
* doc/cpio.texi: Document the --directory option.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -108,6 +108,9 @@ static struct argp_option options[] = { {"file", 'F', N_("[[USER@]HOST:]FILE-NAME"), 0, N_("Use this FILE-NAME instead of standard input or output. Optional USER and HOST specify the user and host names in case of a remote archive"), GRID+1 }, + {"directory", 'D', N_("DIR"), 0, + N_("Change to directory DIR"), GRID+1 }, + {"force-local", FORCE_LOCAL_OPTION, 0, 0, N_("Archive file is local, even if its name contains colons"), GRID+1 }, {"format", 'H', N_("FORMAT"), 0, @@ -325,6 +328,10 @@ parse_opt (int key, char *arg, struct argp_state *state) create_dir_flag = true; break; + case 'D': + change_directory_option = arg; + break; + case 'f': /* Only copy files not matching patterns. */ copy_matching_files = false; break; |