mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
See ChangeLog: Tue Mar 2 10:38:42 CET 1999 Werner Koch
This commit is contained in:
parent
0f5bb383b5
commit
c27c7416d5
9 changed files with 60 additions and 128 deletions
100
g10/sign.c
100
g10/sign.c
|
@ -455,106 +455,6 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/****************
|
||||
* Note: We do not calculate the hash over the last CR,LF
|
||||
*/
|
||||
static int
|
||||
write_dash_escaped( IOBUF inp, IOBUF out, MD_HANDLE md )
|
||||
{
|
||||
int c;
|
||||
int lastlf = 1;
|
||||
int state = 0;
|
||||
|
||||
if( opt.not_dash_escaped ) {
|
||||
lastlf = 0;
|
||||
while( (c = iobuf_get(inp)) != -1 ) {
|
||||
md_putc(md, c );
|
||||
iobuf_put( out, c );
|
||||
lastlf = c;
|
||||
}
|
||||
if( lastlf != '\n' ) {
|
||||
/* add a missing trailing LF */
|
||||
md_putc(md, '\n' );
|
||||
iobuf_put( out, '\n' );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
while( (c = iobuf_get(inp)) != -1 ) {
|
||||
if( lastlf ) {
|
||||
if( c == '-' ) {
|
||||
iobuf_put( out, c );
|
||||
iobuf_put( out, ' ' );
|
||||
}
|
||||
else if( c == 'F' && opt.escape_from ) {
|
||||
int i;
|
||||
|
||||
if( state >= 1 )
|
||||
md_putc(md, '\r');
|
||||
if( state >= 2 )
|
||||
md_putc(md, '\n');
|
||||
state = 0;
|
||||
|
||||
for( i=1; i < 5 && (c = iobuf_get(inp)) != -1; i++ ) {
|
||||
if( "From "[i] != c )
|
||||
break;
|
||||
}
|
||||
if( i < 5 ) {
|
||||
iobuf_write( out, "From", i );
|
||||
md_write( md, "From", i );
|
||||
if( c == -1 )
|
||||
break;
|
||||
}
|
||||
else {
|
||||
iobuf_writestr( out, "- From" );
|
||||
md_write( md, "From", 4 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
again:
|
||||
switch( state ) {
|
||||
case 0:
|
||||
if( c == '\r' )
|
||||
state = 1;
|
||||
else
|
||||
md_putc(md, c );
|
||||
break;
|
||||
case 1:
|
||||
if( c == '\n' )
|
||||
state = 2;
|
||||
else {
|
||||
md_putc(md, '\r');
|
||||
state = 0;
|
||||
goto again;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
md_putc(md, '\r');
|
||||
md_putc(md, '\n');
|
||||
state = 0;
|
||||
goto again;
|
||||
default: BUG();
|
||||
}
|
||||
iobuf_put( out, c );
|
||||
lastlf = c == '\n';
|
||||
}
|
||||
if( state == 1 )
|
||||
md_putc(md, '\r');
|
||||
else if( state == 2 ) { /* file ended with a new line */
|
||||
md_putc(md, '\r');
|
||||
md_putc(md, '\n');
|
||||
iobuf_put( out, '\n');
|
||||
}
|
||||
|
||||
if( !lastlf )
|
||||
iobuf_put( out, '\n' );
|
||||
|
||||
return 0; /* fixme: add error handling */
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************
|
||||
* make a clear signature. note that opt.armor is not needed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue