summaryrefslogtreecommitdiffstats
path: root/tools/gpgtar.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-08-09 11:05:18 +0200
committerWerner Koch <wk@gnupg.org>2010-08-09 11:05:18 +0200
commit0917c9d159bc4a3d0e89b23a4104be1a843269fb (patch)
treea0c34a227b3ad2c243f15bc709621d379a9e757e /tools/gpgtar.c
parentMore work on the dirmngr. It now builds for W32 and W32CE and quick (diff)
downloadgnupg2-0917c9d159bc4a3d0e89b23a4104be1a843269fb.tar.xz
gnupg2-0917c9d159bc4a3d0e89b23a4104be1a843269fb.zip
Add option --null
Diffstat (limited to 'tools/gpgtar.c')
-rw-r--r--tools/gpgtar.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/tools/gpgtar.c b/tools/gpgtar.c
index 8a9aaaf9b..4ea9e73bf 100644
--- a/tools/gpgtar.c
+++ b/tools/gpgtar.c
@@ -55,12 +55,14 @@ enum cmd_and_opt_values
oOutput = 'o',
oQuiet = 'q',
oVerbose = 'v',
+ oFilesFrom = 'T',
oNoVerbose = 500,
aSignEncrypt,
oSkipCrypto,
oSetFilename,
- aList
+ aList,
+ oNull
};
@@ -84,6 +86,10 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_n (oQuiet, "quiet", N_("be somewhat more quiet")),
ARGPARSE_s_n (oSkipCrypto, "skip-crypto", N_("skip the crypto processing")),
ARGPARSE_s_s (oSetFilename, "set-filename", "@"),
+ ARGPARSE_s_s (oFilesFrom, "files-from",
+ N_("|FILE|get names to create from FILE")),
+ ARGPARSE_s_n (oNull, "null", N_("-T reads null-terminated names")),
+
ARGPARSE_end ()
};
@@ -157,6 +163,8 @@ main (int argc, char **argv)
int no_more_options = 0;
enum cmd_and_opt_values cmd = 0;
int skip_crypto = 0;
+ const char *files_from = NULL;
+ int null_names = 0;
assert (sizeof (struct ustar_raw_header) == 512);
@@ -181,6 +189,8 @@ main (int argc, char **argv)
case oQuiet: opt.quiet = 1; break;
case oVerbose: opt.verbose++; break;
case oNoVerbose: opt.verbose = 0; break;
+ case oFilesFrom: files_from = pargs.r.ret_str; break;
+ case oNull: null_names = 1; break;
case aList:
case aDecrypt:
@@ -202,6 +212,11 @@ main (int argc, char **argv)
}
}
+ if ((files_from && !null_names) || (!files_from && null_names))
+ log_error ("--files-from and --null may only be used in conjunction\n");
+ if (files_from && strcmp (files_from, "-"))
+ log_error ("--files-from only supports argument \"-\"\n");
+
if (log_get_errorcount (0))
exit (2);
@@ -213,6 +228,8 @@ main (int argc, char **argv)
fname = argc ? *argv : NULL;
if (opt.filename)
log_info ("note: ignoring option --set-filename\n");
+ if (files_from)
+ log_info ("note: ignoring option --files-from\n");
if (skip_crypto)
gpgtar_list (fname);
else
@@ -220,14 +237,15 @@ main (int argc, char **argv)
break;
case aEncrypt:
- if (!argc)
+ if ((!argc && !null_names)
+ || (argc && null_names))
usage (1);
if (opt.filename)
log_info ("note: ignoring option --set-filename\n");
if (skip_crypto)
- gpgtar_create (argv);
+ gpgtar_create (null_names? NULL :argv);
else
- tar_and_encrypt (argv);
+ tar_and_encrypt (null_names? NULL : argv);
break;
case aDecrypt:
@@ -235,6 +253,8 @@ main (int argc, char **argv)
usage (1);
if (opt.outfile)
log_info ("note: ignoring option --output\n");
+ if (files_from)
+ log_info ("note: ignoring option --files-from\n");
fname = argc ? *argv : NULL;
if (skip_crypto)
gpgtar_extract (fname);