]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/gdbserver/remote-utils.c
import gdb-1999-07-07 post reformat
[thirdparty/binutils-gdb.git] / gdb / gdbserver / remote-utils.c
index 0a7e0fbc7978886d7e6ed1a12f3b3545731988f5..4dab2abb8d570e5775bbb4a860faafcdf4577557 100644 (file)
@@ -1,21 +1,22 @@
 /* Remote utility routines for the remote server for GDB.
    Copyright (C) 1986, 1989, 1993 Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "server.h"
 #include "terminal.h"
@@ -53,17 +54,17 @@ remote_open (name)
 #ifdef HAVE_TERMIOS
       {
        struct termios termios;
-       tcgetattr(remote_desc, &termios);
+       tcgetattr (remote_desc, &termios);
 
        termios.c_iflag = 0;
        termios.c_oflag = 0;
        termios.c_lflag = 0;
-       termios.c_cflag &= ~(CSIZE|PARENB);
+       termios.c_cflag &= ~(CSIZE | PARENB);
        termios.c_cflag |= CLOCAL | CS8;
        termios.c_cc[VMIN] = 0;
        termios.c_cc[VTIME] = 0;
 
-       tcsetattr(remote_desc, TCSANOW, &termios);
+       tcsetattr (remote_desc, TCSANOW, &termios);
       }
 #endif
 
@@ -75,7 +76,7 @@ remote_open (name)
        termio.c_iflag = 0;
        termio.c_oflag = 0;
        termio.c_lflag = 0;
-       termio.c_cflag &= ~(CSIZE|PARENB);
+       termio.c_cflag &= ~(CSIZE | PARENB);
        termio.c_cflag |= CLOCAL | CS8;
        termio.c_cc[VMIN] = 0;
        termio.c_cc[VTIME] = 0;
@@ -115,19 +116,19 @@ remote_open (name)
 
       /* Allow rapid reuse of this port. */
       tmp = 1;
-      setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *)&tmp,
-                 sizeof(tmp));
+      setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp,
+                 sizeof (tmp));
 
       sockaddr.sin_family = PF_INET;
-      sockaddr.sin_port = htons(port);
+      sockaddr.sin_port = htons (port);
       sockaddr.sin_addr.s_addr = INADDR_ANY;
 
-      if (bind (tmp_desc, (struct sockaddr *)&sockaddr, sizeof (sockaddr))
+      if (bind (tmp_desc, (struct sockaddr *) &sockaddr, sizeof (sockaddr))
          || listen (tmp_desc, 1))
        perror_with_name ("Can't bind address");
 
       tmp = sizeof (sockaddr);
-      remote_desc = accept (tmp_desc, (struct sockaddr *)&sockaddr, &tmp);
+      remote_desc = accept (tmp_desc, (struct sockaddr *) &sockaddr, &tmp);
       if (remote_desc == -1)
        perror_with_name ("Accept failed");
 
@@ -137,18 +138,18 @@ remote_open (name)
 
       /* Enable TCP keep alive process. */
       tmp = 1;
-      setsockopt (tmp_desc, SOL_SOCKET, SO_KEEPALIVE, (char *)&tmp, sizeof(tmp));
+      setsockopt (tmp_desc, SOL_SOCKET, SO_KEEPALIVE, (char *) &tmp, sizeof (tmp));
 
       /* Tell TCP not to delay small packets.  This greatly speeds up
-        interactive response. */
+         interactive response. */
       tmp = 1;
       setsockopt (remote_desc, protoent->p_proto, TCP_NODELAY,
-                 (char *)&tmp, sizeof(tmp));
+                 (char *) &tmp, sizeof (tmp));
 
       close (tmp_desc);                /* No longer need this */
 
-      signal (SIGPIPE, SIG_IGN); /* If we don't do this, then gdbserver simply
-                                   exits when the remote side dies.  */
+      signal (SIGPIPE, SIG_IGN);       /* If we don't do this, then gdbserver simply
+                                          exits when the remote side dies.  */
     }
 
 #if defined(F_SETFL) && defined (FASYNC)
@@ -160,7 +161,7 @@ remote_open (name)
 }
 
 void
-remote_close()
+remote_close ()
 {
   close (remote_desc);
 }
@@ -260,7 +261,7 @@ putpkt (buf)
    will cause us to send a SIGINT to the child.  */
 
 static void
-input_interrupt()
+input_interrupt ()
 {
   int cc;
   char c;
@@ -269,7 +270,7 @@ input_interrupt()
 
   if (cc != 1 || c != '\003')
     {
-      fprintf(stderr, "input_interrupt, cc = %d c = %d\n", cc, c);
+      fprintf (stderr, "input_interrupt, cc = %d c = %d\n", cc, c);
       return;
     }
 
@@ -277,13 +278,13 @@ input_interrupt()
 }
 
 void
-enable_async_io()
+enable_async_io ()
 {
   signal (SIGIO, input_interrupt);
 }
 
 void
-disable_async_io()
+disable_async_io ()
 {
   signal (SIGIO, SIG_IGN);
 }
@@ -358,7 +359,7 @@ getpkt (buf)
 
       c1 = fromhex (readchar ());
       c2 = fromhex (readchar ());
-      
+
       if (csum == (c1 << 4) + c2)
        break;
 
@@ -430,7 +431,7 @@ convert_ascii_to_int (from, to, n)
 }
 
 static char *
-outreg(regno, buf)
+outreg (regno, buf)
      int regno;
      char *buf;
 {
@@ -479,7 +480,7 @@ prepare_resume_reply (buf, status, signo)
 #endif
 
       /* If the debugger hasn't used any thread features, don't burden it with
-        threads.  If we didn't check this, GDB 4.13 and older would choke.  */
+         threads.  If we didn't check this, GDB 4.13 and older would choke.  */
       if (cont_thread != 0)
        {
          if (old_thread_from_wait != thread_from_wait)