1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

See ChangeLog: Mon Sep 20 12:24:41 CEST 1999 Werner Koch

This commit is contained in:
Werner Koch 1999-09-20 10:25:21 +00:00
parent eabe7b277c
commit db78307c03
7 changed files with 90 additions and 5 deletions

View file

@ -83,5 +83,63 @@ verify_signatures( int nfiles, char **files )
return rc;
}
static int
verify_one_file( const char *name )
{
IOBUF fp;
armor_filter_context_t afx;
int rc;
fp = iobuf_open(name);
if( !fp ) {
log_error(_("can't open `%s'\n"), print_fname_stdin(name));
return G10ERR_OPEN_FILE;
}
if( !opt.no_armor ) {
if( use_armor_filter( fp ) ) {
memset( &afx, 0, sizeof afx);
iobuf_push_filter( fp, armor_filter, &afx );
}
}
rc = proc_signature_packets( NULL, fp, NULL, name );
iobuf_close(fp);
return rc;
}
/****************
* Verify each file given in the files array or read the names of the
* files from stdin.
* Note: This function can not handle detached signatures.
*/
int
verify_files( int nfiles, char **files )
{
int i;
if( !nfiles ) { /* read the filenames from stdin */
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 G10ERR_GENERAL;
}
/* This code does not work on MSDOS but how cares there are
* also no script languages available. We don't strip any
* spaces, so that we can process nearly all filenames */
line[strlen(line)-1] = 0;
verify_one_file( line );
}
}
else { /* take filenames from the array */
for(i=0; i < nfiles; i++ )
verify_one_file( files[i] );
}
return 0;
}