aboutsummaryrefslogtreecommitdiffstats
path: root/g10/decrypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/decrypt.c')
-rw-r--r--g10/decrypt.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/g10/decrypt.c b/g10/decrypt.c
index f444fda05..6e43295ba 100644
--- a/g10/decrypt.c
+++ b/g10/decrypt.c
@@ -33,6 +33,7 @@
#include "memory.h"
#include "util.h"
#include "main.h"
+#include "status.h"
#include "i18n.h"
@@ -78,5 +79,59 @@ decrypt_message( const char *filename )
return rc;
}
+void
+decrypt_messages(int nfiles, char **files)
+{
+ IOBUF fp;
+ armor_filter_context_t afx;
+ char *p, *output = NULL;
+ int rc = 0;
+
+ if (opt.outfile)
+ {
+ log_error(_("--output doesn't work for this command\n"));
+ return;
+
+ }
+
+ while (nfiles--)
+ {
+ print_file_status(STATUS_FILE_START, *files, 3);
+ output = make_outfile_name(*files);
+ if (!output)
+ continue;
+ fp = iobuf_open(*files);
+ if (!fp)
+ {
+ log_error(_("can't open `%s'\n"), print_fname_stdin(*files));
+ continue;
+ }
+ if (!opt.no_armor)
+ {
+ if (use_armor_filter(fp))
+ {
+ memset(&afx, 0, sizeof afx);
+ iobuf_push_filter(fp, armor_filter, &afx);
+ }
+ }
+ rc = proc_packets(NULL, fp);
+ iobuf_close(fp);
+ if (rc)
+ log_error("%s: decryption failed: %s\n", print_fname_stdin(*files),
+ g10_errstr(rc));
+ p = get_last_passphrase();
+ set_next_passphrase(p);
+ files++;
+ m_free(output);
+ write_status( STATUS_FILE_DONE );
+ }
+ set_next_passphrase(NULL);
+}
+
+
+
+
+
+