mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
2005-04-19 Marcus Brinkmann <marcus@g10code.de>
* symcryptrun.c: Add --input option.
This commit is contained in:
parent
eff62d82bf
commit
92ee8d4886
@ -1,3 +1,7 @@
|
|||||||
|
2005-04-19 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* symcryptrun.c: Add --input option.
|
||||||
|
|
||||||
2005-04-15 Marcus Brinkmann <marcus@g10code.de>
|
2005-04-15 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* symcryptrun.c (TEMP_FAILURE_RETRY): Define if not defined.
|
* symcryptrun.c (TEMP_FAILURE_RETRY): Define if not defined.
|
||||||
|
@ -124,6 +124,7 @@ enum cmd_and_opt_values
|
|||||||
oKeyfile,
|
oKeyfile,
|
||||||
oDecrypt,
|
oDecrypt,
|
||||||
oEncrypt,
|
oEncrypt,
|
||||||
|
oInput,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -132,23 +133,23 @@ static ARGPARSE_OPTS opts[] =
|
|||||||
{
|
{
|
||||||
{ 301, NULL, 0, N_("@\nCommands:\n ") },
|
{ 301, NULL, 0, N_("@\nCommands:\n ") },
|
||||||
|
|
||||||
{ oDecrypt, "decrypt", 0, N_("decryption modus")},
|
{ oDecrypt, "decrypt", 0, N_("decryption modus") },
|
||||||
{ oEncrypt, "encrypt", 0, N_("encryption modus")},
|
{ oEncrypt, "encrypt", 0, N_("encryption modus") },
|
||||||
|
|
||||||
{ 302, NULL, 0, N_("@\nOptions:\n ") },
|
{ 302, NULL, 0, N_("@\nOptions:\n ") },
|
||||||
|
|
||||||
{ oClass, "class", 2, N_("tool class (confucius)")},
|
{ oClass, "class", 2, N_("tool class (confucius)") },
|
||||||
{ oProgram, "program", 2, N_("program filename")},
|
{ oProgram, "program", 2, N_("program filename") },
|
||||||
|
|
||||||
{ oKeyfile, "keyfile", 2, N_("secret key file (required)")},
|
|
||||||
|
|
||||||
|
{ oKeyfile, "keyfile", 2, N_("secret key file (required)") },
|
||||||
|
{ oInput, "inputfile", 2, N_("input file name (default stdin)") },
|
||||||
{ oVerbose, "verbose", 0, N_("verbose") },
|
{ oVerbose, "verbose", 0, N_("verbose") },
|
||||||
{ oQuiet, "quiet", 0, N_("quiet") },
|
{ oQuiet, "quiet", 0, N_("quiet") },
|
||||||
{ oLogFile, "log-file", 2, N_("use a log file for the server")},
|
{ oLogFile, "log-file", 2, N_("use a log file for the server") },
|
||||||
{ oOptions, "options" , 2, N_("|FILE|read options from FILE")},
|
{ oOptions, "options" , 2, N_("|FILE|read options from FILE") },
|
||||||
|
|
||||||
/* Hidden options. */
|
/* Hidden options. */
|
||||||
{ oNoVerbose, "no-verbose", 0, "@"},
|
{ oNoVerbose, "no-verbose", 0, "@" },
|
||||||
{ oHomedir, "homedir", 2, "@" },
|
{ oHomedir, "homedir", 2, "@" },
|
||||||
{ oNoOptions, "no-options", 0, "@" },/* shortcut for --options /dev/null */
|
{ oNoOptions, "no-options", 0, "@" },/* shortcut for --options /dev/null */
|
||||||
|
|
||||||
@ -166,6 +167,7 @@ struct
|
|||||||
char *class;
|
char *class;
|
||||||
char *program;
|
char *program;
|
||||||
char *keyfile;
|
char *keyfile;
|
||||||
|
char *input;
|
||||||
} opt;
|
} opt;
|
||||||
|
|
||||||
|
|
||||||
@ -755,22 +757,31 @@ confucius_main (int mode)
|
|||||||
int res;
|
int res;
|
||||||
char *tmpdir;
|
char *tmpdir;
|
||||||
char *infile;
|
char *infile;
|
||||||
|
int infile_from_stdin = 0;
|
||||||
char *outfile;
|
char *outfile;
|
||||||
|
|
||||||
tmpdir = confucius_mktmpdir ();
|
tmpdir = confucius_mktmpdir ();
|
||||||
if (!tmpdir)
|
if (!tmpdir)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
if (opt.input && !(opt.input[0] == '-' && opt.input[1] == '\0'))
|
||||||
|
infile = xstrdup (opt.input);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
infile_from_stdin = 1;
|
||||||
|
|
||||||
/* TMPDIR + "/" + "in" + "\0". */
|
/* TMPDIR + "/" + "in" + "\0". */
|
||||||
infile = malloc (strlen (tmpdir) + 1 + 2 + 1);
|
infile = malloc (strlen (tmpdir) + 1 + 2 + 1);
|
||||||
if (!infile)
|
if (!infile)
|
||||||
{
|
{
|
||||||
log_error (_("cannot allocate infile string: %s\n"), strerror (errno));
|
log_error (_("cannot allocate infile string: %s\n"),
|
||||||
|
strerror (errno));
|
||||||
rmdir (tmpdir);
|
rmdir (tmpdir);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
strcpy (infile, tmpdir);
|
strcpy (infile, tmpdir);
|
||||||
strcat (infile, "/in");
|
strcat (infile, "/in");
|
||||||
|
}
|
||||||
|
|
||||||
/* TMPDIR + "/" + "out" + "\0". */
|
/* TMPDIR + "/" + "out" + "\0". */
|
||||||
outfile = malloc (strlen (tmpdir) + 1 + 3 + 1);
|
outfile = malloc (strlen (tmpdir) + 1 + 3 + 1);
|
||||||
@ -784,6 +795,8 @@ confucius_main (int mode)
|
|||||||
strcpy (outfile, tmpdir);
|
strcpy (outfile, tmpdir);
|
||||||
strcat (outfile, "/out");
|
strcat (outfile, "/out");
|
||||||
|
|
||||||
|
if (infile_from_stdin)
|
||||||
|
{
|
||||||
/* Create INFILE and fill it with content. */
|
/* Create INFILE and fill it with content. */
|
||||||
res = confucius_copy_file ("-", infile, mode == oEncrypt);
|
res = confucius_copy_file ("-", infile, mode == oEncrypt);
|
||||||
if (res)
|
if (res)
|
||||||
@ -793,6 +806,7 @@ confucius_main (int mode)
|
|||||||
rmdir (tmpdir);
|
rmdir (tmpdir);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Run the engine and thus create the output file, handling
|
/* Run the engine and thus create the output file, handling
|
||||||
passphrase retrieval. */
|
passphrase retrieval. */
|
||||||
@ -800,6 +814,7 @@ confucius_main (int mode)
|
|||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
remove_file (outfile, mode == oDecrypt);
|
remove_file (outfile, mode == oDecrypt);
|
||||||
|
if (infile_from_stdin)
|
||||||
remove_file (infile, mode == oEncrypt);
|
remove_file (infile, mode == oEncrypt);
|
||||||
free (outfile);
|
free (outfile);
|
||||||
free (infile);
|
free (infile);
|
||||||
@ -812,6 +827,7 @@ confucius_main (int mode)
|
|||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
remove_file (outfile, mode == oDecrypt);
|
remove_file (outfile, mode == oDecrypt);
|
||||||
|
if (infile_from_stdin)
|
||||||
remove_file (infile, mode == oEncrypt);
|
remove_file (infile, mode == oEncrypt);
|
||||||
free (outfile);
|
free (outfile);
|
||||||
free (infile);
|
free (infile);
|
||||||
@ -820,6 +836,7 @@ confucius_main (int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
remove_file (outfile, mode == oDecrypt);
|
remove_file (outfile, mode == oDecrypt);
|
||||||
|
if (infile_from_stdin)
|
||||||
remove_file (infile, mode == oEncrypt);
|
remove_file (infile, mode == oEncrypt);
|
||||||
free (outfile);
|
free (outfile);
|
||||||
free (infile);
|
free (infile);
|
||||||
@ -915,6 +932,7 @@ main (int argc, char **argv)
|
|||||||
case oClass: opt.class = pargs.r.ret_str; break;
|
case oClass: opt.class = pargs.r.ret_str; break;
|
||||||
case oProgram: opt.program = pargs.r.ret_str; break;
|
case oProgram: opt.program = pargs.r.ret_str; break;
|
||||||
case oKeyfile: opt.keyfile = pargs.r.ret_str; break;
|
case oKeyfile: opt.keyfile = pargs.r.ret_str; break;
|
||||||
|
case oInput: opt.input = pargs.r.ret_str; break;
|
||||||
|
|
||||||
case oLogFile: logfile = pargs.r.ret_str; break;
|
case oLogFile: logfile = pargs.r.ret_str; break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user