Remove i386_elf_emit_arch_note
[deliverable/binutils-gdb.git] / sim / arm / main.c
index f012b28e6da1bb53fb64b160021aa219c618bad0..b63b3710b09451d0ba89bc6ac8163bb34c512637 100644 (file)
@@ -3,7 +3,7 @@
  
     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
  
     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
+    the Free Software Foundation; either version 3 of the License, or
     (at your option) any later version.
  
     This program is distributed in the hope that it will be useful,
     (at your option) any later version.
  
     This program is distributed in the hope that it will be useful,
@@ -12,8 +12,7 @@
     GNU General Public License for more details.
  
     You should have received a copy of the GNU General Public License
     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. */
+    along with this program; if not, see <http://www.gnu.org/licenses/>. */
 
 /**********************************************************************/
 /* Forks the ARMulator and hangs on a socket passing on RDP messages  */
 
 /**********************************************************************/
 /* Forks the ARMulator and hangs on a socket passing on RDP messages  */
 
 /* Read and write routines down sockets and pipes */
 
 
 /* Read and write routines down sockets and pipes */
 
-void MYread_chars(int sock, void *p, int n);
-unsigned char MYread_char(int sock);
-ARMword MYread_word(int sock);
-void MYread_FPword(int sock, char *putinhere);
+void MYread_chars (int sock, void *p, int n);
+unsigned char MYread_char (int sock);
+ARMword MYread_word (int sock);
+void MYread_FPword (int sock, char *putinhere);
 
 
-void MYwrite_word(int sock, ARMword i);
-void MYwrite_string(int sock, char *s);
-void MYwrite_FPword(int sock, char *fromhere);
-void MYwrite_char(int sock, unsigned char c);
+void MYwrite_word (int sock, ARMword i);
+void MYwrite_string (int sock, char *s);
+void MYwrite_FPword (int sock, char *fromhere);
+void MYwrite_char (int sock, unsigned char c);
 
 
-void passon(int source, int dest, int n);
+void passon (int source, int dest, int n);
 
 
 /* Mother and child processes */
 void parent (void);
 
 
 /* Mother and child processes */
 void parent (void);
-void kid(void);
+void kid (void);
 
 /* The child process id. */
 pid_t child;
 
 /* The child process id. */
 pid_t child;
@@ -86,98 +85,109 @@ unsigned int socketnumber;
 /* Opens a socket to the debugger, and once opened spawns the */
 /* ARMulator and sets up a couple of pipes.                   */
 /**************************************************************/
 /* Opens a socket to the debugger, and once opened spawns the */
 /* ARMulator and sets up a couple of pipes.                   */
 /**************************************************************/
-int main(int argc, char *argv[]) {
+int
+main (int argc, char *argv[])
+{
   int i;
   struct sockaddr_in devil, isa;
   struct hostent *hp;
 
 
   int i;
   struct sockaddr_in devil, isa;
   struct hostent *hp;
 
 
-  if (argc == 1) {
-    fprintf(stderr, "No socket number\n");
-    return 1;
-  }
+  if (argc == 1)
+    {
+      fprintf (stderr, "No socket number\n");
+      return 1;
+    }
 
 
-  sscanf(argv[1], "%d", &socketnumber);
-  if (!socketnumber || socketnumber > 0xffff) {
-    fprintf(stderr, "Invalid socket number: %d\n", socketnumber);
-    return 1;
-  }
+  sscanf (argv[1], "%d", &socketnumber);
+  if (!socketnumber || socketnumber > 0xffff)
+    {
+      fprintf (stderr, "Invalid socket number: %d\n", socketnumber);
+      return 1;
+    }
 
 
-  gethostname(localhost, MAXHOSTNAMELENGTH);
-  hp = gethostbyname(localhost);
-  if (!hp) {
-    fprintf(stderr, "Cannot get local host info\n");
-    return 1;
-  }
+  gethostname (localhost, MAXHOSTNAMELENGTH);
+  hp = gethostbyname (localhost);
+  if (!hp)
+    {
+      fprintf (stderr, "Cannot get local host info\n");
+      return 1;
+    }
 
   /* Open a socket */
 
   /* Open a socket */
-  sockethandle = socket(hp->h_addrtype, SOCK_STREAM, 0);
-  if (sockethandle < 0) {
-    perror("socket");
-    return 1;
-  }
+  sockethandle = socket (hp->h_addrtype, SOCK_STREAM, 0);
+  if (sockethandle == -1)
+    {
+      perror ("socket");
+      return 1;
+    }
 
   devil.sin_family = hp->h_addrtype;
 
   devil.sin_family = hp->h_addrtype;
-  devil.sin_port = htons(socketnumber);
+  devil.sin_port = htons (socketnumber);
   devil.sin_addr.s_addr = 0;
   devil.sin_addr.s_addr = 0;
-  for(i = 0; i < sizeof(devil.sin_zero); i++) devil.sin_zero[i] = '\000';
-  memcpy(&devil.sin_addr, hp->h_addr_list[0], hp->h_length);
+  for (i = 0; i < sizeof (devil.sin_zero); i++)
+    devil.sin_zero[i] = '\000';
+  memcpy (&devil.sin_addr, hp->h_addr_list[0], hp->h_length);
 
 
-  if (bind(sockethandle, &devil, sizeof(devil)) < 0) {
-    perror("bind");
-    return 1;
-  }
+  if (bind (sockethandle, &devil, sizeof (devil)) < 0)
+    {
+      perror ("bind");
+      return 1;
+    }
 
   /* May only accept one debugger at once */
 
 
   /* May only accept one debugger at once */
 
-  if (listen(sockethandle, 0)) {
-    perror("listen");
-    return 1;
-  }
-
-  fprintf(stderr, "Waiting for connection from debugger...");
-
-  debugsock = accept(sockethandle, &isa, &i);
-  if (debugsock < 0) {
-    perror("accept");
-    return 1;
-  }
-  
-  fprintf(stderr, " done.\nConnection Established.\n");
-
-  nfds = getdtablesize();
-
-  if (pipe(mumkid)) {
-    perror("pipe");
-    return 1;
-  }
-  if (pipe(kidmum)) {
-    perror("pipe");
-    return 1;
-  }
-  
-  if (pipe(DebuggerARMul)) {
-    perror("pipe");
-    return 1;
-  }
-  
+  if (listen (sockethandle, 0))
+    {
+      perror ("listen");
+      return 1;
+    }
+
+  fprintf (stderr, "Waiting for connection from debugger...");
+
+  debugsock = accept (sockethandle, &isa, &i);
+  if (debugsock == -1)
+    {
+      perror ("accept");
+      return 1;
+    }
+
+  fprintf (stderr, " done.\nConnection Established.\n");
+
+  nfds = getdtablesize ();
+
+  if (pipe (mumkid))
+    {
+      perror ("pipe");
+      return 1;
+    }
+  if (pipe (kidmum))
+    {
+      perror ("pipe");
+      return 1;
+    }
+
+  if (pipe (DebuggerARMul))
+    {
+      perror ("pipe");
+      return 1;
+    }
+
 #ifdef DEBUG
 #ifdef DEBUG
-      fprintf(stderr, "Created pipes ok\n");
+  fprintf (stderr, "Created pipes ok\n");
 #endif
 
 #endif
 
-  child = fork();
+  child = fork ();
 
 #ifdef DEBUG
 
 #ifdef DEBUG
-  fprintf(stderr, "fork() ok\n");
+  fprintf (stderr, "fork() ok\n");
 #endif
 
 #endif
 
-  if (child ==  0) kid ();
-  if (child != -1) parent ();
+  if (child == 0)
+    kid ();
+  if (child != -1)
+    parent ();
 
 
-  perror("fork");
+  perror ("fork");
   return 1;
 }
   return 1;
 }
-
-
-
-
This page took 0.025072 seconds and 4 git commands to generate.