* configure: Ignore new autoconf configure options.
[binutils-gdb.git] / gdb / utils.c
index ed764e5c0b2df7083c2c21841ce2af962557846a..97b6a9bb4b9fc6928a0c5c2becf6608225e9ea2b 100644 (file)
@@ -15,10 +15,10 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
-#if !defined(__GO32__) && !defined(WIN32)
+#if !defined(__GO32__) && !defined(__WIN32__)
 #include <sys/ioctl.h>
 #include <sys/param.h>
 #include <pwd.h>
@@ -29,7 +29,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <varargs.h>
 #endif
 #include <ctype.h>
-#include <string.h>
+#include "gdb_string.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #include "signals.h"
 #include "gdbcmd.h"
@@ -304,27 +307,31 @@ error_begin ()
 NORETURN void
 error (char *string, ...)
 #else
+void
 error (va_alist)
      va_dcl
 #endif
 {
-#ifdef ANSI_PROTOTYPES
   va_list args;
+#ifdef ANSI_PROTOTYPES
   va_start (args, string);
 #else
   va_start (args);
 #endif
   if (error_hook)
-    error_hook();
+    (*error_hook) ();
   else 
     {
-      char *string1;
       error_begin ();
 #ifdef ANSI_PROTOTYPES
       vfprintf_filtered (gdb_stderr, string, args);
 #else
-      string1 = va_arg (args, char *);
-      vfprintf_filtered (gdb_stderr, string1, args);
+      {
+       char *string1;
+
+       string1 = va_arg (args, char *);
+       vfprintf_filtered (gdb_stderr, string1, args);
+      }
 #endif
       fprintf_filtered (gdb_stderr, "\n");
       va_end (args);
@@ -529,7 +536,7 @@ quit ()
 }
 
 
-#if defined(__GO32__)||defined(WIN32)
+#if defined(__GO32__)||defined(WINGDB)
 
 /* In the absence of signals, poll keyboard for a quit.
    Called from #define QUIT pollquit() in xm-go32.h. */
@@ -558,7 +565,7 @@ pollquit()
 
 
 #endif
-#if defined(__GO32__)||defined(WIN32)
+#if defined(__GO32__)||defined(WINGDB)
 void notice_quit()
 {
   if (kbhit ())
@@ -590,16 +597,21 @@ request_quit (signo)
      int signo;
 {
   quit_flag = 1;
-
   /* Restore the signal handler.  Harmless with BSD-style signals, needed
      for System V-style signals.  So just always do it, rather than worrying
      about USG defines and stuff like that.  */
   signal (signo, request_quit);
 
+/* start-sanitize-gm */
+#ifdef GENERAL_MAGIC_HACKS
+  target_kill ();
+#endif /* GENERAL_MAGIC_HACKS */
+/* end-sanitize-gm */
+
 #ifdef REQUEST_QUIT
   REQUEST_QUIT;
 #else
-  if (immediate_quit)
+  if (immediate_quit) 
     quit ();
 #endif
 }
@@ -1502,7 +1514,7 @@ vfprintf_maybe_filtered (stream, format, args, filter)
 void
 vfprintf_filtered (stream, format, args)
      FILE *stream;
-     char *format;
+     const char *format;
      va_list args;
 {
   vfprintf_maybe_filtered (stream, format, args, 1);
@@ -1511,7 +1523,7 @@ vfprintf_filtered (stream, format, args)
 void
 vfprintf_unfiltered (stream, format, args)
      FILE *stream;
-     char *format;
+     const char *format;
      va_list args;
 {
   char *linebuffer;
@@ -1530,7 +1542,7 @@ vfprintf_unfiltered (stream, format, args)
 
 void
 vprintf_filtered (format, args)
-     char *format;
+     const char *format;
      va_list args;
 {
   vfprintf_maybe_filtered (gdb_stdout, format, args, 1);
@@ -1538,7 +1550,7 @@ vprintf_filtered (format, args)
 
 void
 vprintf_unfiltered (format, args)
-     char *format;
+     const char *format;
      va_list args;
 {
   vfprintf_unfiltered (gdb_stdout, format, args);
@@ -1547,7 +1559,7 @@ vprintf_unfiltered (format, args)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-fprintf_filtered (FILE *stream, char *format, ...)
+fprintf_filtered (FILE *stream, const char *format, ...)
 #else
 fprintf_filtered (va_alist)
      va_dcl
@@ -1571,7 +1583,7 @@ fprintf_filtered (va_alist)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-fprintf_unfiltered (FILE *stream, char *format, ...)
+fprintf_unfiltered (FILE *stream, const char *format, ...)
 #else
 fprintf_unfiltered (va_alist)
      va_dcl
@@ -1598,7 +1610,7 @@ fprintf_unfiltered (va_alist)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-fprintfi_filtered (int spaces, FILE *stream, char *format, ...)
+fprintfi_filtered (int spaces, FILE *stream, const char *format, ...)
 #else
 fprintfi_filtered (va_alist)
      va_dcl
@@ -1627,7 +1639,7 @@ fprintfi_filtered (va_alist)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-printf_filtered (char *format, ...)
+printf_filtered (const char *format, ...)
 #else
 printf_filtered (va_alist)
      va_dcl
@@ -1650,7 +1662,7 @@ printf_filtered (va_alist)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-printf_unfiltered (char *format, ...)
+printf_unfiltered (const char *format, ...)
 #else
 printf_unfiltered (va_alist)
      va_dcl
@@ -1675,7 +1687,7 @@ printf_unfiltered (va_alist)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-printfi_filtered (int spaces, char *format, ...)
+printfi_filtered (int spaces, const char *format, ...)
 #else
 printfi_filtered (va_alist)
      va_dcl
@@ -1704,14 +1716,14 @@ printfi_filtered (va_alist)
 
 void
 puts_filtered (string)
-     char *string;
+     const char *string;
 {
   fputs_filtered (string, gdb_stdout);
 }
 
 void
 puts_unfiltered (string)
-     char *string;
+     const char *string;
 {
   fputs_unfiltered (string, gdb_stdout);
 }
@@ -1853,7 +1865,7 @@ initialize_utils ()
   
   /* These defaults will be used if we are unable to get the correct
      values from termcap.  */
-#if defined(__GO32__) || defined(WIN32)
+#if defined(__GO32__) || defined(__WIN32__)
   lines_per_page = ScreenRows();
   chars_per_line = ScreenCols();
 #else