]> andersk Git - moira.git/blobdiff - gdb/gdb.c
posixify source
[moira.git] / gdb / gdb.c
index e38f7e9464bb25ea471e61e92a869da419b30205..b1bebbbf1cf61a32b441545d965a199b1e46205b 100644 (file)
--- a/gdb/gdb.c
+++ b/gdb/gdb.c
@@ -34,6 +34,9 @@ static char *rcsid_gdb_c = "$Header$";
 #include "gdb.h"
 #include "gdb_lib.h"
 #include <errno.h>
+#ifdef POSIX
+#include <sys/utsname.h>
+#endif
 
 extern int sys_nerr;
 extern char *sys_errlist[];
@@ -69,6 +72,14 @@ gdb_init()
 
        struct passwd *pw_struct;               /* passwd entry comes back */
                                                /* here */
+#ifdef POSIX
+       struct utsname nameposix;
+       struct sigaction act;
+
+       sigemptyset(&act.sa_mask);
+       act.sa_flags = 0;
+#endif
+
        /*
         * So we know we've been initialized, and we do it only once
         */
@@ -110,13 +121,23 @@ gdb_init()
         * closed at the other end.  gdb_move_data handles this condition
         * synchronously.
         */
+#ifdef POSIX
+       act.sa_handler = (void(*)()) SIG_IGN;
+       (void) sigaction(SIGPIPE, &act, NULL);
+#else
        (void) signal(SIGPIPE, SIG_IGN);
+#endif
 
        /*
         * Make a note of the local host and user name
         */
+#ifdef POSIX
+       (void) uname(&nameposix);
+       strncpy(hostname, nameposix.nodename, sizeof(hostname) - 1);
+#else
        if (gethostname(hostname, sizeof(hostname)-1)!=0)
                (void) strcpy(hostname, "????");
+#endif
        gdb_host = db_alloc(strlen(hostname)+1);
        (void) strcpy(gdb_host, hostname);
 
This page took 0.065649 seconds and 4 git commands to generate.