diff options
Diffstat (limited to 'src/Fl_abort.cxx')
| -rw-r--r-- | src/Fl_abort.cxx | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/src/Fl_abort.cxx b/src/Fl_abort.cxx index 94b8560f6..d18b00d80 100644 --- a/src/Fl_abort.cxx +++ b/src/Fl_abort.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_abort.cxx,v 1.8.2.3.2.1 2001/11/22 15:35:01 easysw Exp $" +// "$Id: Fl_abort.cxx,v 1.8.2.3.2.2 2001/11/25 16:38:11 easysw Exp $" // // Warning/error message code for the Fast Light Tool Kit (FLTK). // @@ -28,57 +28,69 @@ // You can also override this by redefining all of these. #include <FL/Fl.H> -#include <stdarg.h> #include <stdio.h> #include <stdlib.h> -#include <config.h> +#include <stdarg.h> +#include "flstring.h" -#ifndef WIN32 +#ifdef WIN32 +# include <windows.h> static void warning(const char *format, ...) { va_list args; + char buf[1024]; va_start(args, format); - vfprintf(stderr, format, args); + vsnprintf(buf, 1024, format, args); va_end(args); - fputc('\n', stderr); - fflush(stderr); + MessageBox(0,buf,"Warning",MB_ICONEXCLAMATION|MB_OK); } static void error(const char *format, ...) { va_list args; + char buf[1024]; va_start(args, format); - vfprintf(stderr, format, args); + vsnprintf(buf, 1024, format, args); va_end(args); - fputc('\n', stderr); - fflush(stderr); + MessageBox(0,buf,"Error",MB_ICONSTOP|MB_SYSTEMMODAL); +} + +static void fatal(const char *format, ...) { + va_list args; + char buf[1024]; + va_start(args, format); + vsnprintf(buf, 1024, format, args); + va_end(args); + MessageBox(0,buf,"Error",MB_ICONSTOP|MB_SYSTEMMODAL); ::exit(1); } #else -#include <windows.h> -# if !HAVE_VSNPRINTF || defined(__hpux) -extern "C" { -int vsnprintf(char* str, size_t size, const char* fmt, va_list ap); -} -# endif /* !HAVE_VSNPRINTF */ - static void warning(const char *format, ...) { va_list args; - char buf[1024]; va_start(args, format); - vsnprintf(buf, 1024, format, args); + vfprintf(stderr, format, args); va_end(args); - MessageBox(0,buf,"Warning",MB_ICONEXCLAMATION|MB_OK); + fputc('\n', stderr); + fflush(stderr); } static void error(const char *format, ...) { va_list args; - char buf[1024]; va_start(args, format); - vsnprintf(buf, 1024, format, args); + vfprintf(stderr, format, args); va_end(args); - MessageBox(0,buf,"Error",MB_ICONSTOP|MB_SYSTEMMODAL); + fputc('\n', stderr); + fflush(stderr); +} + +static void fatal(const char *format, ...) { + va_list args; + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); + fputc('\n', stderr); + fflush(stderr); ::exit(1); } @@ -86,8 +98,8 @@ static void error(const char *format, ...) { void (*Fl::warning)(const char* format, ...) = ::warning; void (*Fl::error)(const char* format, ...) = ::error; -void (*Fl::fatal)(const char* format, ...) = ::error; +void (*Fl::fatal)(const char* format, ...) = ::fatal; // -// End of "$Id: Fl_abort.cxx,v 1.8.2.3.2.1 2001/11/22 15:35:01 easysw Exp $". +// End of "$Id: Fl_abort.cxx,v 1.8.2.3.2.2 2001/11/25 16:38:11 easysw Exp $". // |
