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

See ChangeLog: Wed Jan 20 18:59:49 CET 1999 Werner Koch

This commit is contained in:
Werner Koch 1999-01-20 18:10:35 +00:00
parent ce650acf1f
commit 7debff3867
15 changed files with 321 additions and 63 deletions

View file

@ -89,6 +89,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
}
if( pt->len ) {
assert( !clearsig );
for( ; pt->len; pt->len-- ) {
if( (c = iobuf_get(pt->buf)) == -1 ) {
log_error("Problem reading source (%u bytes remaining)\n",
@ -98,7 +99,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
}
if( mfx->md )
md_putc(mfx->md, c );
if( convert && !clearsig && c == '\r' )
if( convert && c == '\r' )
continue; /* fixme: this hack might be too simple */
if( fp ) {
if( putc( c, fp ) == EOF ) {
@ -110,11 +111,11 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
}
}
}
else {
else if( !clearsig ) {
while( (c = iobuf_get(pt->buf)) != -1 ) {
if( mfx->md )
md_putc(mfx->md, c );
if( convert && !clearsig && c == '\r' )
if( convert && c == '\r' )
continue; /* fixme: this hack might be too simple */
if( fp ) {
if( putc( c, fp ) == EOF ) {
@ -127,6 +128,47 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
}
pt->buf = NULL;
}
else { /* clear text signature - don't hash the last cr,lf */
int state = 0;
while( (c = iobuf_get(pt->buf)) != -1 ) {
if( fp ) {
if( putc( c, fp ) == EOF ) {
log_error("Error writing to `%s': %s\n",
fname, strerror(errno) );
rc = G10ERR_WRITE_FILE;
goto leave;
}
}
if( !mfx->md )
continue;
if( state == 2 ) {
md_putc(mfx->md, '\r' );
md_putc(mfx->md, '\n' );
state = 0;
}
if( !state ) {
if( c == '\r' )
state = 1;
else
md_putc(mfx->md, c );
}
else if( state == 1 ) {
if( c == '\n' )
state = 2;
else {
md_putc(mfx->md, '\r' );
if( c == '\r' )
state = 1;
else {
state = 0;
md_putc(mfx->md, c );
}
}
}
}
pt->buf = NULL;
}
if( fp && fp != stdout && fclose(fp) ) {
log_error("Error closing `%s': %s\n", fname, strerror(errno) );