$NetBSD: patch-ab,v 1.5 2020/11/25 14:59:24 ryoon Exp $

- Use NAME_MAX if available rather than relying on MAXNAMLEN.
- Fix Solaris preprocessor symbols.
- Fix bad calls to execlp() that break on 64-bit platforms.

--- compfile.c.orig	2018-11-30 14:25:04.000000000 +0000
+++ compfile.c
@@ -2,6 +2,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <limits.h>
 #include <unistd.h>
 #include <string.h>
 
@@ -224,7 +225,7 @@ void waitforgzip()
  * version;
  */
 
-#if ( defined(sun) && defined(__svr4__) ) || defined(__CYGWIN32__)
+#if ( defined(__sun) && defined(__svr4__) ) || defined(__CYGWIN32__)
 #include <dirent.h>
 #else
 #include <sys/dir.h>
@@ -299,7 +300,9 @@ compressfile (int *fdp, char *name, reg 
 #ifdef NAME_MAX
     if (strlen (tmpcomp) + 2 > NAME_MAX)
 #else
-#ifdef MAXNAMLEN	   /* BSD otherwise should be sysV (FFS on sysV?) */
+#if defined(NAME_MAX)
+    if (strlen (tmpcomp) + 2 > NAME_MAX)
+#elif defined(MAXNAMLEN)  /* BSD otherwise should be sysV (FFS on sysV?) */
     if (strlen (tmpcomp) + 2 > MAXNAMLEN)
 #else
     if (strlen (tmpcomp) + 2 > DIRSIZ)
