]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Make ngIRCd compile and run on NeXTSTEP 3.3 and OPENSTEP 4.2
authorAlexander Barton <alex@barton.de>
Fri, 1 Aug 2008 14:21:16 +0000 (16:21 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 1 Aug 2008 14:21:16 +0000 (16:21 +0200)
by Steven D. Blackford <kb7sqi@aol.com>:

"I wanted to let you know that I've done a quick port of ngircd-0.12.0 for
NEXTSTEP3.3/OPENSTEP4.2. There wasn't a lot of changes required to get it
to compile clean, but I did make the necessary changes so that I didn't
have to use -posix flag. The NeXT has a pretty buggy POSIX implementation
so I always try to work around it. :-)
Anway, here's the changes required to get it to compile."

src/ngircd/ngircd.c
src/portab/Makefile.am
src/portab/portab.h
src/portab/waitpid.c [new file with mode: 0644]

index 4cf4ff425af3192b8125d8af958915f7620e0f4d..9239edfe11ca601a635dcf8977e188f7c1ccbac1 100644 (file)
@@ -784,7 +784,11 @@ NGIRCd_Init( bool NGIRCd_NoDaemon )
                }
 
                /* New child process */
+#ifndef NeXT
                (void)setsid( );
+#else
+               setpgrp(0, getpid());
+#endif
                chdir( "/" );
 
                /* Detach stdin, stdout and stderr */
index c48e67add1e47017b89a555371d9d197584f2bcd..125cc31a8e34fdde6043b3ced4095562472f6488 100644 (file)
@@ -14,7 +14,7 @@ AUTOMAKE_OPTIONS = ansi2knr
 
 noinst_LIBRARIES = libngportab.a
 
-libngportab_a_SOURCES = strdup.c strlcpy.c strtok_r.c vsnprintf.c
+libngportab_a_SOURCES = strdup.c strlcpy.c strtok_r.c vsnprintf.c waitpid.c
 
 check_PROGRAMS = portabtest
 
index 83e11313d4ae3aa1ff555cd40ecf6eee1d40b514..56d4249b7509376144cde84524f29695b28c3ef2 100644 (file)
@@ -99,6 +99,14 @@ typedef unsigned char bool;
 #endif
 #endif
 
+#ifdef NeXT
+#define S_IRUSR 0000400                /* read permission, owner */
+#define S_IWUSR 0000200                /* write permission, owner */
+#define S_IRGRP 0000040                /* read permission, group */
+#define S_IROTH 0000004                /* read permission, other */
+#define ssize_t int
+#endif
+
 #undef GLOBAL
 #define GLOBAL
 
diff --git a/src/portab/waitpid.c b/src/portab/waitpid.c
new file mode 100644 (file)
index 0000000..0c16960
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * ngIRCd -- The Next Generation IRC Daemon
+ *
+ * waitpid() implementation. Public domain.
+ * Written by Steven D. Blackford for the NeXT system.
+ *
+ */
+
+#include "portab.h"
+
+#include "imp.h"
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+#include "exp.h"
+
+#ifndef HAVE_WAITPID
+
+GLOBAL int
+waitpid(pid, stat_loc, options)
+int pid, *stat_loc, options;
+{
+       for (;;) {
+               int wpid = wait(stat_loc);
+               if (wpid == pid || wpid == -1)
+                       return wpid;
+       }
+}
+
+#endif