summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2008-08-01 16:21:16 +0200
committerAlexander Barton <alex@barton.de>2008-08-01 16:21:16 +0200
commitdfc3de131c349a8677d4d4b885dc27f2b2f73567 (patch)
treed11cb31b3a8c549e7591854da70768917f72d5ec /src
parent338c6432501e9c50a5fc03b8b2f917b54b8f5a0b (diff)
downloadngircd-dfc3de131c349a8677d4d4b885dc27f2b2f73567.tar.gz
ngircd-dfc3de131c349a8677d4d4b885dc27f2b2f73567.zip
Make ngIRCd compile and run on NeXTSTEP 3.3 and OPENSTEP 4.2
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."
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/ngircd.c4
-rw-r--r--src/portab/Makefile.am2
-rw-r--r--src/portab/portab.h8
-rw-r--r--src/portab/waitpid.c31
4 files changed, 44 insertions, 1 deletions
diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c
index 4cf4ff42..9239edfe 100644
--- a/src/ngircd/ngircd.c
+++ b/src/ngircd/ngircd.c
@@ -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 */
diff --git a/src/portab/Makefile.am b/src/portab/Makefile.am
index c48e67ad..125cc31a 100644
--- a/src/portab/Makefile.am
+++ b/src/portab/Makefile.am
@@ -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
 
diff --git a/src/portab/portab.h b/src/portab/portab.h
index 83e11313..56d4249b 100644
--- a/src/portab/portab.h
+++ b/src/portab/portab.h
@@ -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
index 00000000..0c169601
--- /dev/null
+++ b/src/portab/waitpid.c
@@ -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