aboutsummaryrefslogtreecommitdiffstats
path: root/g10/textfilter.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2000-07-14 17:34:53 +0000
committerWerner Koch <[email protected]>2000-07-14 17:34:53 +0000
commit92cd25550836198cf1e3a6aac239eef98364359d (patch)
tree4fad355126fae79c93535e0e7c6afd91e384552a /g10/textfilter.c
parentSee ChangeLog: Thu May 25 18:39:11 CEST 2000 Werner Koch (diff)
downloadgnupg-92cd25550836198cf1e3a6aac239eef98364359d.tar.gz
gnupg-92cd25550836198cf1e3a6aac239eef98364359d.zip
See ChangeLog: Fri Jul 14 19:38:23 CEST 2000 Werner Koch
Diffstat (limited to 'g10/textfilter.c')
-rw-r--r--g10/textfilter.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/g10/textfilter.c b/g10/textfilter.c
index 06f85dc64..a360ffccb 100644
--- a/g10/textfilter.c
+++ b/g10/textfilter.c
@@ -1,5 +1,5 @@
/* textfilter.c
- * Copyright (C) 1998,1999 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -31,7 +31,13 @@
#include "util.h"
#include "filter.h"
#include "i18n.h"
+#include "options.h"
+#ifdef HAVE_DOSISH_SYSTEM
+ #define LF "\r\n"
+#else
+ #define LF "\n"
+#endif
#define MAX_LINELEN 19995 /* a little bit smaller than in armor.c */
/* to make sure that a warning is displayed while */
@@ -151,6 +157,9 @@ copy_clearsig_text( IOBUF out, IOBUF inp, GCRY_MD_HD md,
int truncated = 0;
int pending_lf = 0;
+ if( !opt.pgp2_workarounds )
+ pgp2mode = 0;
+
if( !escape_dash )
escape_from = 0;
@@ -183,12 +192,37 @@ copy_clearsig_text( IOBUF out, IOBUF inp, GCRY_MD_HD md,
iobuf_put( out, '-' );
iobuf_put( out, ' ' );
}
+
+ #if 0 /*defined(HAVE_DOSISH_SYSTEM)*/
+ /* We don't use this anymore because my interpretation of rfc2440 7.1
+ * is that there is no conversion needed. If one decides to
+ * clearsign a unix file on a DOS box he will get a mixed line endings.
+ * If at some point it turns out, that a conversion is a nice feature
+ * we can make an option out of it.
+ */
+ /* make sure the lines do end in CR,LF */
+ if( n > 1 && ( (buffer[n-2] == '\r' && buffer[n-1] == '\n' )
+ || (buffer[n-2] == '\n' && buffer[n-1] == '\r'))) {
+ iobuf_write( out, buffer, n-2 );
+ iobuf_put( out, '\r');
+ iobuf_put( out, '\n');
+ }
+ else if( n && buffer[n-1] == '\n' ) {
+ iobuf_write( out, buffer, n-1 );
+ iobuf_put( out, '\r');
+ iobuf_put( out, '\n');
+ }
+ else
+ iobuf_write( out, buffer, n );
+
+ #else
iobuf_write( out, buffer, n );
+ #endif
}
/* at eof */
if( !pending_lf ) { /* make sure that the file ends with a LF */
- iobuf_put( out, '\n');
+ iobuf_writestr( out, LF );
if( !escape_dash )
gcry_md_putc( md, '\n' );
}