- (djm) Fixes from Andrew McGill <andrewm@datrix.co.za>:
  - Platform define for SCO 3.x which breaks on /dev/ptmx
  - Detect and try to fix missing MAXPATHLEN
diff --git a/CREDITS b/CREDITS
index f95260e..dab15a3 100644
--- a/CREDITS
+++ b/CREDITS
@@ -4,7 +4,8 @@
 Theo de Raadt, and Dug Song - Creators of OpenSSH
 
 Andrew Stribblehill <a.d.stribblehill@durham.ac.uk> - Bugfixes
-Andre Lucas <andre.lucas@dial.pipex.com> - build, login and many other fixes
+Andre Lucas <andre.lucas@dial.pipex.com> - new login code, many fixes
+Andrew McGill <andrewm@datrix.co.za> - SCO fixes
 Andy Sloane <andy@guildsoftware.com> - bugfixes
 Arkadiusz Miskiewicz <misiek@pld.org.pl> - IPv6 compat fixes
 Ben Taylor <bent@clark.net> - Solaris debugging and fixes
diff --git a/ChangeLog b/ChangeLog
index b7f40e2..b360d36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+20000613
+ - (djm) Fixes from Andrew McGill <andrewm@datrix.co.za>:
+  - Platform define for SCO 3.x which breaks on /dev/ptmx
+  - Detect and try to fix missing MAXPATHLEN
+
 20000612
  - (djm) Glob manpages in RPM spec files to catch compressed files
  - (djm) Full license in auth-pam.c
diff --git a/configure.in b/configure.in
index 77ece44..3bdf411 100644
--- a/configure.in
+++ b/configure.in
@@ -129,6 +129,14 @@
 	mansubdir=cat
 	LIBS="$LIBS -lgen -lsocket"
 	;;
+*-*-sco3*)
+	CFLAGS="$CFLAGS -I/usr/local/include"
+	LDFLAGS="$LDFLAGS -L/usr/local/lib"
+	MANTYPE='$(CATMAN)'
+	mansubdir=cat
+	LIBS="$LIBS -lgen -lsocket"
+	no_dev_ptmx=1
+	;;
 esac
 
 # Allow user to specify flags
@@ -170,7 +178,7 @@
 fi
 
 # Checks for header files.
-AC_CHECK_HEADERS(bstring.h endian.h lastlog.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h util.h utmp.h utmpx.h)
+AC_CHECK_HEADERS(bstring.h endian.h lastlog.h limits.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h util.h utmp.h utmpx.h)
 
 # Checks for library functions.
 AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy vsnprintf vhangup _getpty __b64_ntop)
diff --git a/defines.h b/defines.h
index e60a587..871adbf 100644
--- a/defines.h
+++ b/defines.h
@@ -4,33 +4,29 @@
 /* Necessary headers */
 
 #include <sys/types.h> /* For [u]intxx_t */
-
 #include <sys/socket.h> /* For SHUT_XXXX */
-
-# include <netinet/in_systm.h> /* For typedefs */
+#include <sys/param.h> /* For MAXPATHLEN */
+#include <netinet/in_systm.h> /* For typedefs */
 #include <netinet/in.h> /* For IPv6 macros */
 #include <netinet/ip.h> /* For IPTOS macros */
-
 #ifdef HAVE_SYS_BITYPES_H
 # include <sys/bitypes.h> /* For u_intXX_t */
 #endif 
-
 #ifdef HAVE_PATHS_H
 # include <paths.h> /* For _PATH_XXX */
 #endif 
-
+#ifdef HAVE_LIMITS_H
+# include <limits.h> /* For PATH_MAX */
+#endif 
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h> /* For timersub */
 #endif
-
 #ifdef HAVE_MAILLOCK_H
 # include <maillock.h> /* For _PATH_MAILDIR */
 #endif
-
 #ifdef HAVE_SYS_CDEFS_H
 # include <sys/cdefs.h> /* For __P() */
 #endif 
-
 #ifdef HAVE_SYS_SYSMACROS_H
 # include <sys/sysmacros.h> /* For MIN, MAX, etc */
 #endif
@@ -57,6 +53,14 @@
 # define IPTOS_MINCOST           IPTOS_LOWCOST
 #endif /* IPTOS_LOWDELAY */
 
+#ifndef MAXPATHLEN
+# ifdef PATH_MAX
+#  define MAXPATHLEN PATH_MAX
+# else /* PATH_MAX */
+#  define MAXPATHLEN 64 /* Should be safe */
+# endif /* PATH_MAX */
+#endif /* MAXPATHLEN */
+
 /* Types */
 
 /* If sys/types.h does not supply intXX_t, supply them ourselves */
diff --git a/includes.h b/includes.h
index da1ee9c..31b7f34 100644
--- a/includes.h
+++ b/includes.h
@@ -23,7 +23,6 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -58,9 +57,6 @@
 #ifdef HAVE_NETDB_H
 # include <netdb.h>
 #endif 
-#ifdef HAVE_PATHS_H
-# include <paths.h>
-#endif 
 #ifdef HAVE_ENDIAN_H
 # include <endian.h>
 #endif