upgrade to xpdf 3.00.
[swftools.git] / pdf2swf / xpdf / Error.cc
1 //========================================================================
2 //
3 // Error.cc
4 //
5 // Copyright 1996-2003 Glyph & Cog, LLC
6 //
7 //========================================================================
8
9 #include <aconf.h>
10
11 #ifdef USE_GCC_PRAGMAS
12 #pragma implementation
13 #endif
14
15 #include <stdio.h>
16 #include <stddef.h>
17 #include <stdarg.h>
18 #include "GlobalParams.h"
19 #include "Error.h"
20
21 void CDECL error(int pos, char *msg, ...) {
22   va_list args;
23
24   // NB: this can be called before the globalParams object is created
25   if (globalParams && globalParams->getErrQuiet()) {
26     return;
27   }
28   if (pos >= 0) {
29     fprintf(stderr, "Error (%d): ", pos);
30   } else {
31     fprintf(stderr, "Error: ");
32   }
33   va_start(args, msg);
34   vfprintf(stderr, msg, args);
35   va_end(args);
36   fprintf(stderr, "\n");
37   fflush(stderr);
38 }