# This patch adds an output error check when
# the E option is set.
# This patch also modifies the man page to explain why
# the output error checking is not done when E is not set.

Index: par-1.52/par.1
===================================================================
--- par-1.52.orig/par.1	2007-08-24 07:31:16.000000000 +0530
+++ par-1.52/par.1	2007-08-24 07:51:14.000000000 +0530
@@ -1144,10 +1144,14 @@
 or environment variable syntax are accompanied by
 the same usage message that the help option produces.
 .LP
-Of course, trying to print an error message would be
+Unless the option
+.BI E
+is set, trying to print an error message would be
 futile if an error resulted from an output function, so
 .B par
-doesn't bother doing any error checking on output functions.
+doesn't bother doing any error checking on output functions if
+.BI E
+is 0.
 .SH EXAMPLES
 .de VS
 .RS -.5i
Index: par-1.52/par.c
===================================================================
--- par-1.52.orig/par.c	2007-08-24 07:31:16.000000000 +0530
+++ par-1.52/par.c	2007-08-24 07:49:06.000000000 +0530
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 #undef NULL
 #define NULL ((void *) 0)
@@ -893,6 +894,11 @@
   if (props) free(props);
   if (outlines) freelines(outlines);
 
+  if (Err == 1) {
+  	if ( fclose(stdout) == EOF )
+	       	sprintf(errmsg,"%.*s\n",errmsg_size,strerror(errno));
+  }
+
   errout = Err ? stderr : stdout;
   if (*errmsg) fprintf(errout, "par error:\n%.*s", errmsg_size, errmsg);
   if (version) fputs("par 1.52\n",errout);
