diff options
author | Arturo Espinosa <unammx@src.gnome.org> | 1999-04-17 02:59:58 (GMT) |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1999-04-17 02:59:58 (GMT) |
commit | d9f9a6449f377b4c933b75d57541b19c6d088994 (patch) | |
tree | 04f7f0c54447ef792fbf83bc5039174f4681b3bb /pdf/xpdf/Error.cc |
Initial revision
Diffstat (limited to 'pdf/xpdf/Error.cc')
-rw-r--r-- | pdf/xpdf/Error.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/pdf/xpdf/Error.cc b/pdf/xpdf/Error.cc new file mode 100644 index 0000000..cbb623b --- /dev/null +++ b/pdf/xpdf/Error.cc @@ -0,0 +1,45 @@ +//======================================================================== +// +// Error.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include <stdio.h> +#include <stddef.h> +#include <stdarg.h> +#include "gtypes.h" +#include "Params.h" +#include "Error.h" + +// Send error messages to /dev/tty instead of stderr. +GBool errorsToTTY = gFalse; + +// File to send error (and other) messages to. +FILE *errFile; + +void errorInit() { + if (!errorsToTTY || !(errFile = fopen("/dev/tty", "w"))) + errFile = stderr; +} + +void CDECL error(int pos, char *msg, ...) { + va_list args; + + if (printCommands) + fflush(stdout); + if (pos >= 0) + fprintf(errFile, "Error (%d): ", pos); + else + fprintf(errFile, "Error: "); + va_start(args, msg); + vfprintf(errFile, msg, args); + va_end(args); + fprintf(errFile, "\n"); + fflush(errFile); +} |