diff options
-rw-r--r-- | g10/ChangeLog | 5 | ||||
-rw-r--r-- | g10/encode.c | 83 |
2 files changed, 59 insertions, 29 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 5ae14b4f8..61acb9ba1 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -11,13 +11,14 @@ --delete-secret-key(s) and --delete-secret-and-public-key(s) as well. -2001-01-09 Timo Schulz <[email protected]> +2002-01-09 Timo Schulz <[email protected]> * encode.c (encode_crypt_files): Now it behaves like verify_files. + * g10.c (main): We don't need to check argc for encode_crypt_files any longer. -2001-01-09 Timo Schulz <[email protected]> +2002-01-09 Timo Schulz <[email protected]> * exec.c: Include windows.h for dosish systems. diff --git a/g10/encode.c b/g10/encode.c index d2dba0fd0..38c672433 100644 --- a/g10/encode.c +++ b/g10/encode.c @@ -569,32 +569,61 @@ void encode_crypt_files(int nfiles, char **files, STRLIST remusr) { int rc = 0; + + if (opt.outfile) + { + if (opt.verbose) + log_info(_("ignore --output for multiple files")); + opt.outfile = NULL; + } - if (!nfiles) { - char line[2048]; - unsigned int lno = 0; - while ( fgets(line, DIM(line), stdin) ) { - lno++; - if (!*line || line[strlen(line)-1] != '\n') { - log_error("input line %u too long or missing LF\n", lno); - return; - } - line[strlen(line)-1] = '\0'; - print_file_status(STATUS_FILE_START, line, 2); - if ( (rc = encode_crypt(line, remusr)) ) - log_error("%s: encryption failed: %s\n", print_fname_stdin(line), - g10_errstr(rc) ); - write_status( STATUS_FILE_DONE ); - } - } - else { - while (nfiles--) { - print_file_status(STATUS_FILE_START, *files, 2); - if ( (rc = encode_crypt(*files, remusr)) ) - log_error("%s: encryption failed: %s\n", print_fname_stdin(*files), - g10_errstr(rc) ); - write_status( STATUS_FILE_DONE ); - files++; - } - } + if (!nfiles) + { + char line[2048]; + unsigned int lno = 0; + while ( fgets(line, DIM(line), stdin) ) + { + lno++; + if (!*line || line[strlen(line)-1] != '\n') + { + log_error("input line %u too long or missing LF\n", lno); + return; + } + line[strlen(line)-1] = '\0'; + print_file_status(STATUS_FILE_START, line, 2); + if ( (rc = encode_crypt(line, remusr)) ) + log_error("%s: encryption failed: %s\n", + print_fname_stdin(line), g10_errstr(rc) ); + write_status( STATUS_FILE_DONE ); + } + } + else + { + while (nfiles--) + { + print_file_status(STATUS_FILE_START, *files, 2); + if ( (rc = encode_crypt(*files, remusr)) ) + log_error("%s: encryption failed: %s\n", + print_fname_stdin(*files), g10_errstr(rc) ); + write_status( STATUS_FILE_DONE ); + files++; + } + } } + + + + + + + + + + + + + + + + + |