* Boston, MA 02111-1307, USA.
*/
+/*
+ * Modified by the GLib Team and others 1997-1999. 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/.
+ */
+
/*
* MT safe ; except for g_on_error_stack_trace, but who wants thread safety
* then
#include <string.h> /* for bzero on BSD systems */
#endif
-#ifdef _MSC_VER
-#include <process.h> /* For _getpid() */
+#ifdef G_OS_WIN32
+# define STRICT /* Strict typing, please */
+# include <windows.h>
+# include <process.h> /* For _getpid() */
#endif
#ifndef NO_FD_SET
# define SELECT_MASK fd_set
#else
-# ifndef _AIX
- typedef long fd_mask;
-# endif
# if defined(_IBMR2)
# define SELECT_MASK void
# else
void
g_on_error_query (const gchar *prg_name)
{
+#ifndef G_OS_WIN32
static const gchar *query1 = "[E]xit, [H]alt";
static const gchar *query2 = ", show [S]tack trace";
static const gchar *query3 = " or [P]roceed";
query3);
fflush (stdout);
- fgets (buf, 8, stdin);
+ if (isatty(0) && isatty(1))
+ fgets (buf, 8, stdin);
+ else
+ strcpy (buf, "E\n");
if ((buf[0] == 'E' || buf[0] == 'e')
&& buf[1] == '\n')
}
else
goto retry;
+#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);
+ _exit(0);
+#endif
}
void
g_on_error_stack_trace (const gchar *prg_name)
{
-#ifndef NATIVE_WIN32
+#ifdef G_OS_UNIX
pid_t pid;
gchar buf[16];
gchar *args[4] = { "gdb", NULL, NULL, NULL };
static void
stack_trace (char **args)
{
-#ifndef NATIVE_WIN32
+#ifdef G_OS_UNIX
pid_t pid;
int in_fd[2];
int out_fd[2];