diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-02-09 16:00:53 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-02-09 16:00:53 +0900 |
commit | 3fa155501284154ac65df51202a8440ce53360d5 (patch) | |
tree | f19fcf454cb16056d34a30ea36947ae01d19bb99 /tools/gpgtar.c | |
parent | 50570580a27da27940fdc016cd4cac3926a7b1cc (diff) | |
download | gpg2-3fa155501284154ac65df51202a8440ce53360d5.tar.gz gpg2-3fa155501284154ac65df51202a8440ce53360d5.tar.bz2 gpg2-3fa155501284154ac65df51202a8440ce53360d5.zip |
Imported Upstream version 2.2.22upstream/2.2.22
Diffstat (limited to 'tools/gpgtar.c')
-rw-r--r-- | tools/gpgtar.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/tools/gpgtar.c b/tools/gpgtar.c index e5cbde4..dfb2df0 100644 --- a/tools/gpgtar.c +++ b/tools/gpgtar.c @@ -73,6 +73,7 @@ enum cmd_and_opt_values oCMS, oSetFilename, oNull, + oUtf8Strings, /* Compatibility with gpg-zip. */ oGpgArgs, @@ -117,6 +118,12 @@ static ARGPARSE_OPTS opts[] = { 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")), +#ifdef HAVE_W32_SYSTEM + ARGPARSE_s_n (oUtf8Strings, "utf8-strings", + N_("-T reads UTF-8 encoded names")), +#else + ARGPARSE_s_n (oUtf8Strings, "utf8-strings", "@"), +#endif ARGPARSE_s_s (oGpgArgs, "gpg-args", "@"), ARGPARSE_s_s (oTarArgs, "tar-args", "@"), @@ -138,10 +145,10 @@ static ARGPARSE_OPTS tar_opts[] = { /* Global flags. */ -enum cmd_and_opt_values cmd = 0; -int skip_crypto = 0; -const char *files_from = NULL; -int null_names = 0; +static enum cmd_and_opt_values cmd = 0; +static int skip_crypto = 0; +static const char *files_from = NULL; +static int null_names = 0; @@ -319,6 +326,7 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts) case oNoVerbose: opt.verbose = 0; break; case oFilesFrom: files_from = pargs->r.ret_str; break; case oNull: null_names = 1; break; + case oUtf8Strings: opt.utf8strings = 1; break; case aList: case aDecrypt: @@ -434,11 +442,6 @@ main (int argc, char **argv) pargs.flags = ARGPARSE_FLAG_KEEP; parse_arguments (&pargs, opts); - 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); @@ -476,12 +479,14 @@ main (int argc, char **argv) case aEncrypt: case aSign: case aSignEncrypt: - if ((!argc && !null_names) - || (argc && null_names)) + if ((!argc && !files_from) + || (argc && files_from)) usage (1); if (opt.filename) log_info ("note: ignoring option --set-filename\n"); - err = gpgtar_create (null_names? NULL :argv, + err = gpgtar_create (files_from? NULL : argv, + files_from, + null_names, !skip_crypto && (cmd == aEncrypt || cmd == aSignEncrypt), cmd == aSign || cmd == aSignEncrypt); |