--- mailx-8.1.1-fixed.orig/cmd2.c
+++ mailx-8.1.1-fixed/cmd2.c
@@ -383,7 +383,7 @@
 	void *v;
 {
 	int pid;
-	extern union wait wait_status;
+	extern int wait_status;
 
 	switch (pid = vfork()) {
 	case -1:
@@ -396,7 +396,7 @@
 	printf("Okie dokie");
 	fflush(stdout);
 	wait_child(pid);
-	if (wait_status.w_coredump)
+	if (WCOREDUMP(wait_status))
 		printf(" -- Core dumped.\n");
 	else
 		printf(" -- Can't dump core.\n");
--- mailx-8.1.1-fixed.orig/def.h
+++ mailx-8.1.1-fixed/def.h
@@ -43,6 +43,7 @@
  */
 
 #include <sys/param.h>
+#include <sys/cdefs.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 
--- mailx-8.1.1-fixed.orig/extern.h
+++ mailx-8.1.1-fixed/extern.h
@@ -37,6 +37,8 @@
  *	$NetBSD: extern.h,v 1.4 1996/06/08 19:48:21 christos Exp $
  */
 
+#include <sys/cdefs.h>
+
 struct name;
 struct name *cat __P((struct name *, struct name *));
 struct name *delname __P((struct name *, char []));
--- mailx-8.1.1-fixed.orig/fio.c
+++ mailx-8.1.1-fixed/fio.c
@@ -47,7 +47,6 @@
 #include <sys/wait.h>
 
 #include <unistd.h>
-#include <paths.h>
 #include <errno.h>
 #include "extern.h"
 
@@ -326,7 +325,7 @@
 	register char *cp, *shell;
 	int pivec[2];
 	struct stat sbuf;
-	extern union wait wait_status;
+	extern int wait_status;
 
 	/*
 	 * The order of evaluation is "%" and "#" expand into constants.
@@ -378,7 +377,7 @@
 	close(pivec[1]);
 	l = read(pivec[0], xname, BUFSIZ);
 	close(pivec[0]);
-	if (wait_child(pid) < 0 && wait_status.w_termsig != SIGPIPE) {
+	if (wait_child(pid) < 0 && WIFSIGNALED(wait_status) && WTERMSIG(wait_status) != SIGPIPE) {
 		fprintf(stderr, "\"%s\": Expansion failed.\n", name);
 		return NOSTR;
 	}
--- mailx-8.1.1-fixed.orig/pathnames.h
+++ mailx-8.1.1-fixed/pathnames.h
@@ -44,3 +44,4 @@
 #define	_PATH_TILDE	"/usr/share/misc/mail.tildehelp"
 #define	_PATH_MASTER_RC	"/etc/mail.rc"
 #define	_PATH_MORE	"/usr/bin/more"
+#define	_PATH_CSHELL	"/bin/csh"
--- mailx-8.1.1-fixed.orig/popen.c
+++ mailx-8.1.1-fixed/popen.c
@@ -62,7 +62,7 @@
 	int pid;
 	char done;
 	char free;
-	union wait status;
+	int status;
 	struct child *link;
 };
 static struct child *child;
@@ -341,7 +341,7 @@
 	int signo;
 {
 	int pid;
-	union wait status;
+	int status;
 	register struct child *cp;
 
 	while ((pid =
@@ -356,7 +356,7 @@
 	}
 }
 
-union wait wait_status;
+int wait_status;
 
 /*
  * Wait for a specific child to die.
@@ -376,7 +376,9 @@
 	wait_status = cp->status;
 	delchild(cp);
 	sigprocmask(SIG_SETMASK, &oset, NULL);
-	return wait_status.w_status ? -1 : 0;
+	if (WIFEXITED(wait_status) && WEXITSTATUS(wait_status) == 0)
+		return 0;
+	return -1;
 }
 
 /*
--- mailx-8.1.1-fixed.orig/quit.c
+++ mailx-8.1.1-fixed/quit.c
@@ -43,6 +43,7 @@
 #endif /* not lint */
 
 #include "rcv.h"
+#include <sys/file.h>
 #include <fcntl.h>
 #include "extern.h"
 
