* Modified by the GLib Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
-/*
- * MT safe ; except for g_on_error_stack_trace, but who wants thread safety
+/*
+ * MT safe ; except for g_on_error_stack_trace, but who wants thread safety
* then
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include "glib.h"
-#include "gprintfint.h"
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#include <string.h> /* for bzero on BSD systems */
#ifdef G_OS_WIN32
-# define STRICT /* Strict typing, please */
+# define STRICT /* Strict typing, please */
# define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */
# include <windows.h>
# undef STRICT
#endif
+#include "gtypes.h"
+#include "gprintfint.h"
+
+
#ifndef NO_FD_SET
# define SELECT_MASK fd_set
#else
if (!prg_name)
prg_name = g_get_prgname ();
-
+
retry:
-
+
if (prg_name)
_g_fprintf (stdout,
- "%s (pid:%u): %s%s%s: ",
- prg_name,
- (guint) getpid (),
- query1,
- query2,
- query3);
+ "%s (pid:%u): %s%s%s: ",
+ prg_name,
+ (guint) getpid (),
+ query1,
+ query2,
+ query3);
else
_g_fprintf (stdout,
- "(process:%u): %s%s: ",
- (guint) getpid (),
- query1,
- query3);
+ "(process:%u): %s%s: ",
+ (guint) getpid (),
+ query1,
+ query3);
fflush (stdout);
-
+
if (isatty(0) && isatty(1))
- fgets (buf, 8, stdin);
+ fgets (buf, 8, stdin);
else
strcpy (buf, "E\n");
&& buf[1] == '\n')
_exit (0);
else if ((buf[0] == 'P' || buf[0] == 'p')
- && buf[1] == '\n')
+ && buf[1] == '\n')
return;
else if (prg_name
- && (buf[0] == 'S' || buf[0] == 's')
- && buf[1] == '\n')
+ && (buf[0] == 'S' || buf[0] == 's')
+ && buf[1] == '\n')
{
g_on_error_stack_trace (prg_name);
goto retry;
}
else if ((buf[0] == 'H' || buf[0] == 'h')
- && buf[1] == '\n')
+ && buf[1] == '\n')
{
while (glib_on_error_halt)
- ;
+ ;
glib_on_error_halt = TRUE;
return;
}
#else
if (!prg_name)
prg_name = g_get_prgname ();
-
+
MessageBox (NULL, "g_on_error_query called, program terminating",
- (prg_name && *prg_name) ? prg_name : NULL,
- MB_OK|MB_ICONERROR);
+ (prg_name && *prg_name) ? prg_name : NULL,
+ MB_OK|MB_ICONERROR);
_exit(0);
#endif
}
* Actual use is strongly discouraged of course ;)
*/
#if (defined (__i386__) || defined (__x86_64__)) && defined (__GNUC__) && __GNUC__ >= 2
-# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END
+# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END
#elif (defined (_MSC_VER) || defined (__DMC__)) && defined (_M_IX86)
-# define G_BREAKPOINT() G_STMT_START{ __asm int 3h }G_STMT_END
+# define G_BREAKPOINT() G_STMT_START{ __asm int 3h }G_STMT_END
#elif defined (_MSC_VER)
-# define G_BREAKPOINT() G_STMT_START{ __debugbreak(); }G_STMT_END
+# define G_BREAKPOINT() G_STMT_START{ __debugbreak(); }G_STMT_END
#elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2
-# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END
-#else /* !__i386__ && !__alpha__ */
-# define G_BREAKPOINT() G_STMT_START{ raise (SIGTRAP); }G_STMT_END
-#endif /* __i386__ */
+# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END
+#else /* !__i386__ && !__alpha__ */
+# define G_BREAKPOINT() G_STMT_START{ raise (SIGTRAP); }G_STMT_END
+#endif /* __i386__ */
G_END_DECLS