mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-10 13:04:23 +01:00
New code for encode_crypt_files.
This commit is contained in:
parent
d346578fb1
commit
0bd41cc2e5
@ -1,3 +1,9 @@
|
|||||||
|
2001-01-09 Timo Schulz <ts@winpt.org>
|
||||||
|
|
||||||
|
* 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 <ts@winpt.org>
|
2001-01-09 Timo Schulz <ts@winpt.org>
|
||||||
|
|
||||||
* exec.c: Include windows.h for dosish systems.
|
* exec.c: Include windows.h for dosish systems.
|
||||||
|
31
g10/encode.c
31
g10/encode.c
@ -566,16 +566,35 @@ write_pubkey_enc_from_list( PK_LIST pk_list, DEK *dek, IOBUF out )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
encode_crypt_files(int argc, char **argv, STRLIST remusr)
|
encode_crypt_files(int nfiles, char **files, STRLIST remusr)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
while (argc--) {
|
if (!nfiles) {
|
||||||
print_file_status(STATUS_FILE_START, *argv, 2);
|
char line[2048];
|
||||||
if ( (rc = encode_crypt(*argv, remusr)) )
|
unsigned int lno = 0;
|
||||||
log_error("%s: encryption failed: %s\n", print_fname_stdin(*argv),
|
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) );
|
g10_errstr(rc) );
|
||||||
write_status( STATUS_FILE_DONE );
|
write_status( STATUS_FILE_DONE );
|
||||||
argv++;
|
}
|
||||||
|
}
|
||||||
|
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++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -816,7 +816,7 @@ main( int argc, char **argv )
|
|||||||
opt.homedir = buf;
|
opt.homedir = buf;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#undef USE_SHM_COPROCESSING
|
||||||
#ifdef USE_SHM_COPROCESSING
|
#ifdef USE_SHM_COPROCESSING
|
||||||
if( opt.shm_coprocess ) {
|
if( opt.shm_coprocess ) {
|
||||||
init_shm_coprocessing(requested_shm_size, 1 );
|
init_shm_coprocessing(requested_shm_size, 1 );
|
||||||
@ -1541,7 +1541,6 @@ main( int argc, char **argv )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case aEncrFiles: /* encrypt the given files */
|
case aEncrFiles: /* encrypt the given files */
|
||||||
if (argc)
|
|
||||||
encode_crypt_files(argc, argv, remusr);
|
encode_crypt_files(argc, argv, remusr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ void display_online_help( const char *keyword );
|
|||||||
int encode_symmetric( const char *filename );
|
int encode_symmetric( const char *filename );
|
||||||
int encode_store( const char *filename );
|
int encode_store( const char *filename );
|
||||||
int encode_crypt( const char *filename, STRLIST remusr );
|
int encode_crypt( const char *filename, STRLIST remusr );
|
||||||
void encode_crypt_files(int argc, char **argv, STRLIST remusr);
|
void encode_crypt_files(int nfiles, char **files, STRLIST remusr);
|
||||||
int encrypt_filter( void *opaque, int control,
|
int encrypt_filter( void *opaque, int control,
|
||||||
IOBUF a, byte *buf, size_t *ret_len);
|
IOBUF a, byte *buf, size_t *ret_len);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user