oksh-noxz

[fork] Portable OpenBSD ksh, based on the Public Domain Korn Shell (pdksh).
git clone https://noxz.tech/git/oksh-noxz.git
oksh-noxz

commit: ff087120b86b2f889a41d28108b76fe04db2b5a0
parent: 832467341161469d6969477e5586ab1553194af1
author: Tim Sedlmeyer <tim@sedlmeyer.org>
date:   Mon, 4 Jun 2018 04:06:07 -0400
Add support for AIX
Mconfigure5+++++
Mportable.h21++++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
@@ -502,6 +502,11 @@ case "x$os" in
     tflags="-D_OPENBSD_SOURCE"
     cflags="$cflags $tflags"
     ;;
+  "xAIX")
+    tflags="-D_ALL_SOURCE"
+    cflags="$cflags $tflags"
+    ldflags="-lbsd"
+    ;;
 esac
 
 cat << EOF > pconfig.h
diff --git a/portable.h b/portable.h
@@ -26,6 +26,10 @@
 #include <mach/mach.h>
 #endif /* __APPLE__ */
 
+#ifdef _AIX
+#include <sys/file.h>
+#endif /* _AIX */
+
 #include <time.h>
 
 #include "pconfig.h"
@@ -43,13 +47,13 @@
 #endif /* !O_EXLOCK */
 
 #ifndef _PW_NAME_LEN
-#if defined(__linux__) || defined(__CYGWIN__)
+#if defined(__linux__) || defined(__CYGWIN__) || defined(_AIX)
 #define _PW_NAME_LEN	LOGIN_NAME_MAX
 #elif defined(__NetBSD__)
 #define _PW_NAME_LEN	MAXLOGNAME
 #else
 #define _PW_NAME_LEN	MAXLOGNAME - 1
-#endif /* __linux__ || __CYGWIN__ || __NetBSD__ */
+#endif /* __linux__ || __CYGWIN__ || _AIX || __NetBSD__ */
 #endif /* !_PW_NAME_LEN */
 
 #ifndef RLIMIT_RSS
@@ -76,6 +80,15 @@
 	(y)->tv_nsec = mts.tv_nsec;
 #endif /* __APPLE__ */
 
+#ifdef _AIX
+#define VWERASE VWERSE
+#define VDISCARD VDISCRD
+#define _PATH_DEFPATH "/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
+#define WCOREFLAG 0200
+#define WCOREDUMP(x) ((x) & WCOREFLAG)
+#undef BAD
+#endif /* _AIX */
+
 #ifndef HAVE_SETRESGID
 #define setresgid(x, y, z)	setgid(x); setegid(y); setgid(z)
 #endif /* !HAVE_SETRESGID */
@@ -220,7 +233,7 @@ typedef void (*sig_t) (int);
 
 /* The following should only be necessary on non-BSD systems.  */
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(_AIX)
 
 /*	$OpenBSD: queue.h,v 1.38 2013/07/03 15:05:21 fgsch Exp $	*/
 /*	$NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $	*/
@@ -866,6 +879,6 @@ struct {								\
 	_Q_INVALIDATE((elm)->field.cqe_next);				\
 } while (0)
 
-#endif /* __linux__ */
+#endif /* __linux__ || _AIX */
 
 #endif /* !_OKSH_PORTABLE_H_ */