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: bc20e260f540302280cbd17d52dce424467fa037
parent: d595cab75b9ec1e3a98536f5591a02d1f2d6102a
author: Tim Sedlmeyer <tim@sedlmeyer.org>
date:   Mon, 4 Jun 2018 03:36:21 -0400
Add check for sig_t and add implementation
Mconfigure24++++++++++++++++++++
Mportable.h8+++++++
2 files changed, 32 insertions(+)
diff --git a/configure b/configure
@@ -206,6 +206,21 @@ EOF
   fi
 }
 
+sig_tcheck() {
+  cat << EOF > conftest.c
+#include <signal.h>
+int main(void){sizeof(sig_t);return 0;}
+EOF
+  $cc $tflags -o conftest conftest.c > /dev/null 2>&1
+  if [ $? -eq 0 ] ; then
+    rm -f conftest conftest.c
+    return 0
+  else
+    rm -f conftest conftest.c
+    return 1
+  fi
+}
+
 sranddeterministiccheck() {
   cat << EOF > conftest.c
 #include <stdlib.h>
@@ -535,6 +550,15 @@ else
   echo "no"
 fi
 
+printf "checking for sig_t... "
+sig_tcheck
+if [ $? -eq 0 ] ; then
+  echo "#define HAVE_SIG_T" >> pconfig.h
+  echo "yes"
+else
+  echo "no"
+fi
+
 printf "checking for srand_deterministic... "
 sranddeterministiccheck
 if [ $? -eq 0 ] ; then
diff --git a/portable.h b/portable.h
@@ -201,6 +201,14 @@ extern const char *const sys_signame[NSIG];
 #endif /* !HAVE_SIGNAME */
 #endif /* !HAVE_SIGLIST || !HAVE_SIGNAME */
 
+/*
+ * Types
+ */
+
+#ifndef HAVE_SIG_T
+typedef void (*sig_t) (int); 
+#endif /* !HAVE_SIG_T */
+
 /*
  * OpenBSD sys/queue.h
  */