In a recent note, Thomas Dickey said:

> Date: Sat, 29 Jul 2006 11:49:00 -0400 (EDT)
> 
> I think there's a problem with the analogy.  Without more information from 
> Lawrence, I suspect he's downloaded a file containing the URL information
> and is starting realplay.exe with _that_.  In that case, lynx wouldn't be
> doing the streaming.
> 
Aha!  I didn't think Lynx could stream, except with the -source
option.

> > BTW, when /tmp overflowed, Lynx never detected nor reported
> > an error -- it just continued updating its status odometer.
> > I might try to fix this.  Can Lynx use strerror()?
> 
> yes - actually it's using a wrapper LYStrerror()
> 
Well, it's easy enough to detect the error from fwrite
and issue HTAlert.  But I'm completely lost as to how
to interrupt the download.  What happens when I press
ctrl-G?  Signal?  longjump?  Set a global variable?
or does download code poll periodically?

I'm supplying what I have as a patch.  Perhaps another
can improve it.  It's likely a candidate for 2.8.7.

Thanks,
gil
-- 
StorageTek
INFORMATION made POWERFUL
%%% Created Sat Jul 29 21:10:42 MDT 2006 by target lynx.patch. %%%
diff -bru orig/lynx2-8-6/src/HTFWriter.c lynx2-8-6/src/HTFWriter.c
--- orig/lynx2-8-6/src/HTFWriter.c      Sun Jan 22 18:16:14 2006
+++ lynx2-8-6/src/HTFWriter.c   Sat Jul 29 21:02:12 2006
@@ -81,9 +81,27 @@
  *
  *                     A C T I O N     R O U T I N E S
  *  Bug:
- *     All errors are ignored.
+ *     Most errors are ignored.
  */
 
+/*     Error handling
+ *     ------------------
+ */
+static void HTFWriter_error(HTStream *me, char *id)
+{
+    char buf[200];
+
+    sprintf(buf, "%.60s: %.60s: %.60s",
+               id,
+               me->isa->name,
+               LYStrerror(errno));
+       HTAlert(buf);
+/*
+ * Only disaster results from:
+ *     me->isa->_abort(me, NULL);
+ */
+}
+
 /*     Character handling
  *     ------------------
  */
@@ -109,8 +127,13 @@
  */
 static void HTFWriter_write(HTStream *me, const char *s, int l)
 {
+    size_t result;
+
     if (me->fp) {
-       fwrite(s, 1, l, me->fp);
+       result = fwrite(s, 1, l, me->fp);
+       if (result!=l) {
+           HTFWriter_error(me, "HTFWriter_write");
+       }
     }
 }
 
@@ -487,7 +510,8 @@
     "FileWriter",
     HTFWriter_free,
     HTFWriter_abort,
-    HTFWriter_put_character, HTFWriter_put_string,
+    HTFWriter_put_character,
+    HTFWriter_put_string,
     HTFWriter_write
 };
 
_______________________________________________
Lynx-dev mailing list
Lynx-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/lynx-dev

Reply via email to