along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
+/* Written by David MacKenzie <djm@gnu.ai.mit.edu>.
+ * Heavily modified by Dave Bodenstab and ESR.
+ */
#ifdef HAVE_CONFIG_H
# include <config.h>
static unsigned int partial_message_size = 0;
static unsigned int partial_message_size_used = 0;
static char *partial_message;
+static unsigned use_stderr;
/* This variable is incremented each time `error' is called. */
unsigned int error_message_count;
exit (status);
}
\f
+/*
+ * Calling error_init(TRUE) causes error_build and error_complete to write
+ * to stderr without buffering. This is needed for the ticker dots to
+ * work correctly.
+ */
+void error_init(foreground)
+int foreground;
+{
+ use_stderr = foreground;
+}
+\f
/* Build an error message by appending MESSAGE, which is a printf-style
format string with optional args, to the existing error message (which may
be empty.) The completed error message is finally printed (and reset to
}
#endif
#endif
+
+ if (use_stderr && partial_message_size_used != 0)
+ {
+ partial_message_size_used = 0;
+ fputs(partial_message, stderr);
+ }
}
\f
/* Complete an error message by appending MESSAGE, which is a printf-style
if (partial_message_size_used != 0)
{
partial_message_size_used = 0;
- error (status, errnum, "%s", partial_message);
+ if (use_stderr)
+ {
+ fputs(partial_message, stderr);
+ if (errnum)
+ fprintf (stderr, ": %s", strerror (errnum));
+ putc ('\n', stderr);
+ fflush (stderr);
+ ++error_message_count;
+ if (status)
+ exit(status);
+ }
+ else
+ error (status, errnum, "%s", partial_message);
}
}
\f