1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Changed option names.

Add O_BINARY for stdin and stdout.
This commit is contained in:
Werner Koch 2010-08-25 10:31:47 +00:00
parent d9791119d0
commit 789732e05a
4 changed files with 36 additions and 9 deletions

View File

@ -1,3 +1,15 @@
2010-08-25 Werner Koch <wk@g10code.com>
* gpgtar.c: Add -t as short option for --list-archive.
* gpgtar-extract.c (gpgtar_extract): Use filename "-" for stdin.
Fix dirprefix setting.
* gpgtar-list.c (gpgtar_list): Ditto.
2010-08-24 Werner Koch <wk@g10code.com>
* gpgtar.c (opts): Fix --cms and --openpgp names.
2010-08-23 Werner Koch <wk@g10code.com> 2010-08-23 Werner Koch <wk@g10code.com>
* gpgconf-comp.c (GPGNAME) [W32CE]: s/gpg2/gpg/. * gpgconf-comp.c (GPGNAME) [W32CE]: s/gpg2/gpg/.

View File

@ -79,7 +79,7 @@ extract_regular (estream_t stream, const char *dirname,
leave: leave:
if (!err && opt.verbose) if (!err && opt.verbose)
log_info ("extracted `%s/'\n", fname); log_info ("extracted `%s'\n", fname);
es_fclose (outfp); es_fclose (outfp);
if (err && fname && outfp) if (err && fname && outfp)
{ {
@ -270,7 +270,10 @@ gpgtar_extract (const char *filename)
if (filename) if (filename)
{ {
stream = es_fopen (filename, "rb"); if (!strcmp (filename, "-"))
stream = es_stdout;
else
stream = es_fopen (filename, "rb");
if (!stream) if (!stream)
{ {
err = gpg_error_from_syserror (); err = gpg_error_from_syserror ();
@ -279,20 +282,26 @@ gpgtar_extract (const char *filename)
} }
} }
else else
stream = es_stdin; /* FIXME: How can we enforce binary mode? */ stream = es_stdin;
if (stream == es_stdin)
es_set_binary (es_stdin);
if (filename) if (filename)
{ {
dirprefix = strrchr (filename, '/'); dirprefix = strrchr (filename, '/');
if (dirprefix) if (dirprefix)
dirprefix++; dirprefix++;
else
dirprefix = filename;
} }
else if (opt.filename) else if (opt.filename)
{ {
dirprefix = strrchr (opt.filename, '/'); dirprefix = strrchr (opt.filename, '/');
if (dirprefix) if (dirprefix)
dirprefix++; dirprefix++;
else
dirprefix = opt.filename;
} }
if (!dirprefix || !*dirprefix) if (!dirprefix || !*dirprefix)

View File

@ -275,7 +275,10 @@ gpgtar_list (const char *filename)
if (filename) if (filename)
{ {
stream = es_fopen (filename, "rb"); if (!strcmp (filename, "-"))
stream = es_stdout;
else
stream = es_fopen (filename, "rb");
if (!stream) if (!stream)
{ {
err = gpg_error_from_syserror (); err = gpg_error_from_syserror ();
@ -284,7 +287,10 @@ gpgtar_list (const char *filename)
} }
} }
else else
stream = es_stdin; /* FIXME: How can we enforce binary mode? */ stream = es_stdin;
if (stream == es_stdin)
es_set_binary (es_stdin);
for (;;) for (;;)
{ {
@ -303,7 +309,7 @@ gpgtar_list (const char *filename)
leave: leave:
xfree (header); xfree (header);
if (filename) if (stream != es_stdin)
es_fclose (stream); es_fclose (stream);
return; return;
} }

View File

@ -48,6 +48,7 @@ enum cmd_and_opt_values
aEncrypt = 'e', aEncrypt = 'e',
aDecrypt = 'd', aDecrypt = 'd',
aSign = 's', aSign = 's',
aList = 't',
oSymmetric = 'c', oSymmetric = 'c',
oRecipient = 'r', oRecipient = 'r',
@ -63,7 +64,6 @@ enum cmd_and_opt_values
oOpenPGP, oOpenPGP,
oCMS, oCMS,
oSetFilename, oSetFilename,
aList,
oNull oNull
}; };
@ -91,8 +91,8 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_s (oFilesFrom, "files-from", ARGPARSE_s_s (oFilesFrom, "files-from",
N_("|FILE|get names to create from FILE")), N_("|FILE|get names to create from FILE")),
ARGPARSE_s_n (oNull, "null", N_("-T reads null-terminated names")), ARGPARSE_s_n (oNull, "null", N_("-T reads null-terminated names")),
ARGPARSE_s_n (oOpenPGP, "--openpgp", "@"), ARGPARSE_s_n (oOpenPGP, "openpgp", "@"),
ARGPARSE_s_n (oCMS, "--cms", "@"), ARGPARSE_s_n (oCMS, "cms", "@"),
ARGPARSE_end () ARGPARSE_end ()
}; };