test/report error writing to stdout
[mmh] / uip / mhlsbr.c
index 882304c..c310e2a 100644 (file)
@@ -3,13 +3,17 @@
  * mhlsbr.c -- main routines for nmh message lister
  *
  * $Id$
+ *
+ * This code is Copyright (c) 2002, by the authors of nmh.  See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
  */
 
 #include <h/mh.h>
 #include <h/signals.h>
 #include <h/addrsbr.h>
 #include <h/fmt_scan.h>
-#include <zotnet/tws/tws.h>
+#include <h/tws.h>
 #include <setjmp.h>
 #include <signal.h>
 
@@ -476,6 +480,11 @@ mhl (int argc, char **argv)
                    vecp > 1 ? "s" : "");
     }
 
+    fflush(stdout);
+    if(ferror(stdout)){
+           adios("output", "error writing");
+    }
+    
     if (clearflg > 0 && ontty == NOTTY)
        clear_screen ();