[PSDK]
[reactos.git] / irc / ArchBlackmann / panic.cpp
1 // panic.cpp
2 // This file is (C) 2003-2004 Royce Mitchell III
3 // and released under the BSD & LGPL licenses
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <stdarg.h>
8 #ifdef WIN32
9 #include <conio.h>
10 #include <windows.h>
11 #endif//WIN32
12 #include "panic.h"
13
14 void panic ( const char* format, ... )
15 {
16 va_list arg;
17 int done;
18
19 va_start(arg, format);
20 #if defined(WIN32) && !defined(_CONSOLE)
21 char buf[4096];
22 _vsnprintf ( buf, sizeof(buf)-1, format, arg );
23 MessageBox ( NULL, buf, "Panic!", MB_OK|MB_ICONEXCLAMATION );
24 #else
25 done = vprintf(format, arg);
26 printf ( "\n" );
27 #endif
28 va_end(arg);
29 #if defined(WIN32) && defined(_CONSOLE)
30 printf ( "Press any key to exit\n" );
31 (void)getch();
32 #endif//WIN32 && _CONSOLE
33 exit ( -1 );
34 }