summaryrefslogtreecommitdiffstats
path: root/g10/plaintext.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1999-05-19 16:12:26 +0200
committerWerner Koch <wk@gnupg.org>1999-05-19 16:12:26 +0200
commitbfb32130e503119bb9bfd79c540466f3b06f4c51 (patch)
treea7accfba0fbbf79b413c1fc0e859e6295ab72c95 /g10/plaintext.c
parentSee ChangeLog: Mon May 17 21:54:43 CEST 1999 Werner Koch (diff)
downloadgnupg2-bfb32130e503119bb9bfd79c540466f3b06f4c51.tar.xz
gnupg2-bfb32130e503119bb9bfd79c540466f3b06f4c51.zip
See ChangeLog: Wed May 19 16:04:30 CEST 1999 Werner Koch
Diffstat (limited to 'g10/plaintext.c')
-rw-r--r--g10/plaintext.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/g10/plaintext.c b/g10/plaintext.c
index 98c4314ea..577641a6d 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -247,7 +247,7 @@ ask_for_detached_datafile( md_filter_context_t *mfx, const char *inname )
static void
-do_hash( MD_HANDLE md, IOBUF fp, int textmode )
+do_hash( MD_HANDLE md, MD_HANDLE md2, IOBUF fp, int textmode )
{
text_filter_context_t tfx;
int c;
@@ -256,8 +256,18 @@ do_hash( MD_HANDLE md, IOBUF fp, int textmode )
memset( &tfx, 0, sizeof tfx);
iobuf_push_filter( fp, text_filter, &tfx );
}
- while( (c = iobuf_get(fp)) != -1 )
- md_putc(md, c );
+ if( md2 ) { /* work around a strange behaviour in pgp2 */
+ while( (c = iobuf_get(fp)) != -1 ) {
+ if( c == '\n' )
+ md_putc(md2, '\r' );
+ md_putc(md, c );
+ md_putc(md2, c );
+ }
+ }
+ else {
+ while( (c = iobuf_get(fp)) != -1 )
+ md_putc(md, c );
+ }
}
@@ -266,7 +276,7 @@ do_hash( MD_HANDLE md, IOBUF fp, int textmode )
* If FILES is NULL, hash stdin.
*/
int
-hash_datafiles( MD_HANDLE md, STRLIST files,
+hash_datafiles( MD_HANDLE md, MD_HANDLE md2, STRLIST files,
const char *sigfilename, int textmode )
{
IOBUF fp;
@@ -276,7 +286,7 @@ hash_datafiles( MD_HANDLE md, STRLIST files,
/* check whether we can open the signed material */
fp = open_sigfile( sigfilename );
if( fp ) {
- do_hash( md, fp, textmode );
+ do_hash( md, md2, fp, textmode );
iobuf_close(fp);
return 0;
}
@@ -295,7 +305,7 @@ hash_datafiles( MD_HANDLE md, STRLIST files,
free_strlist(sl);
return G10ERR_OPEN_FILE;
}
- do_hash( md, fp, textmode );
+ do_hash( md, md2, fp, textmode );
iobuf_close(fp);
}