yapf18 (yet another patch for 0.18)
Gert Doering (gert@greenie.muc.de)
Tue, 1 Mar 1994 23:00:34 +0100
Hi,
remember the last patch, where I made "fax_wait_for()" recognize \n *and*
\r as response-line separator? Well, doing this, I "broke" fax reception
- all received faxes now start with a "0x0a" byte... g3topbm and g3cat
don't care, though ;-)
OK, here's the patch.
gert
-----------
--- faxrec.c.old Tue Mar 1 22:34:50 1994
+++ faxrec.c Tue Mar 1 22:00:48 1994
@@ -261,13 +261,35 @@
signal( SIGHUP, fax_sig_hangup );
fax_timeout = FALSE;
+ WasDLE = 0;
+
+ /* skip any leading garbage
+ * it's reasonable to assume that a fax will start with a zero
+ * byte (actually, T.4 requires it).
+ * This has the additional benefit that we'll see error messages
+ */
+
+ lprintf( L_NOISE, "fax_get_page_data: wait for EOL, got: " );
+ alarm( FAX_PAGE_TIMEOUT );
+
+ while ( !fax_timeout )
+ {
+ if ( fax_read_byte( fd, &c ) != 1 )
+ {
+ lprintf( L_ERROR, "error waiting for page start" );
+ return ERROR;
+ }
+ lputc( L_NOISE, c );
+ if ( c == 0 ) { fputc( c, fax_fp ); break; }
+ if ( c == DLE ) { WasDLE = 1; break; }
+ }
+
lprintf( L_MESG, "fax_get_page_data: receiving %s...", temp );
- WasDLE = 0;
- do
+ while ( !fax_timeout )
{
/* refresh alarm timer every 1024 bytes
- * (to refresh it for every byte is considered too expensive)
+ * (to refresh it for every byte is far too expensive)
*/
if ( ( ByteCount & 0x3ff ) == 0 )
{
@@ -297,7 +319,6 @@
WasDLE = 0;
}
}
- while ( !fax_timeout );
alarm(0);
--
It can hardly be a coincidence that no language on Earth has ever
produced the expression `as pretty as an airport'. -- D.Adams