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