imported 9.0.299 Beta.01
[ckermit.git] / ckcdeb.h
index 31f9c55..34ff008 100644 (file)
--- a/ckcdeb.h
+++ b/ckcdeb.h
@@ -1,13 +1,13 @@
 /*  C K C D E B . H  */
 
 /*
-  Tue Apr  6 14:00:16 2004
+Mon Aug 23 09:22:05 2010
 
   NOTE TO CONTRIBUTORS: This file, and all the other C-Kermit files, must be
   compatible with C preprocessors that support only #ifdef, #else, #endif,
   #define, and #undef.  Please do not use #if, logical operators, or other
   later-model preprocessor features in any of the portable C-Kermit modules.
-  You can, of course, use these constructions in platform-specific modules 
+  You can, of course, use these constructions in platform-specific modules
   when you know they are supported.
 */
 
@@ -26,7 +26,7 @@
   Author: Frank da Cruz <fdc@columbia.edu>,
   Columbia University Academic Information Systems, New York City.
 
-  Copyright (C) 1985, 2004,
+  Copyright (C) 1985, 2010,
     Trustees of Columbia University in the City of New York.
     All rights reserved.  See the C-Kermit COPYING.TXT file or the
     copyright text in the ckcmai.c module for disclaimer and permissions.
 /*
   Etymology: The name of this file means "C-Kermit Common-C-Language Debugging
   Header", because originally it contained only the formats (F000-F111) for
-  the debug() and tlog() functions.  Since then it has grown to inlcude all
+  the debug() and tlog() functions.  Since then it has grown to include all
   material required by all other C-Kermit modules, including the non-Kermit
-  specific ones.
+  specific ones.  In other words, this is the one header file that is
+  guaranteed to be included by all C-Kermit source modules.
 */
 
 #ifndef CKCDEB_H                       /* Don't include me more than once. */
 #endif /* ULONG */
 #endif /* OS2 */
 
-/* Structure definitions for Kermit file attributes */
-/* All strings come as pointer and length combinations */
-/* Empty string (or for numeric variables, -1) = unused attribute. */
-
-struct zstr {             /* string format */
-    int len;             /* length */
-    char *val;            /* value */
-};
-struct zattr {            /* Kermit File Attribute structure */
-    long lengthk;         /* (!) file length in K */
-    struct zstr type;     /* (") file type (text or binary) */
-    struct zstr date;     /* (#) file creation date yyyymmdd[ hh:mm[:ss]] */
-    struct zstr creator;  /* ($) file creator id */
-    struct zstr account;  /* (%) file account */
-    struct zstr area;     /* (&) area (e.g. directory) for file */
-    struct zstr password; /* (') password for area */
-    long blksize;         /* (() file blocksize */
-    struct zstr xaccess;  /* ()) file access: new, supersede, append, warn */
-    struct zstr encoding; /* (*) encoding (transfer syntax) */
-    struct zstr disp;     /* (+) disposition (mail, message, print, etc) */
-    struct zstr lprotect; /* (,) protection (local syntax) */
-    struct zstr gprotect; /* (-) protection (generic syntax) */
-    struct zstr systemid; /* (.) ID for system of origin */
-    struct zstr recfm;    /* (/) record format */
-    struct zstr sysparam; /* (0) system-dependent parameter string */
-    long length;          /* (1) exact length on system of origin */
-    struct zstr charset;  /* (2) transfer syntax character set */
-#ifdef OS2
-    struct zstr longname; /* OS/2 longname if applicable */
-#endif /* OS2 */
-    struct zstr reply;    /* This goes last, used for attribute reply */
-};
-
-/* Kermit file information structure */
-
-struct filinfo {
-  int bs;                              /* Blocksize */
-  int cs;                              /* Character set */
-  long rl;                             /* Record length */
-  int org;                             /* Organization */
-  int fmt;                             /* Record format */
-  int cc;                              /* Carriage control */
-  int typ;                             /* Type (text/binary) */
-  int dsp;                             /* Disposition */
-  char *os_specific;                   /* OS-specific attributes */
-#ifdef OS2
-  unsigned long int lblopts;           /* LABELED FILE options bitmask */
-#else
-  int lblopts;
-#endif /* OS2 */
-};
-
 #ifdef MACOSX10                                /* Mac OS X 1.0 */
 #ifndef MACOSX                         /* implies Mac OS X */
 #define MACOSX
@@ -150,6 +99,20 @@ struct filinfo {
 #endif /* ANYSCO */
 #endif /* UNIXWARE */
 
+#ifndef MINIX                          /* Minix versions */
+#ifdef MINIX315
+#define MINIX
+#else
+#ifdef MINIX3
+#define MINIX
+#else
+#ifdef MINIX2
+#define MINIX
+#endif /* MINIX2 */
+#endif /* MINIX3 */
+#endif /* MINIX315 */
+#endif /* MINIX */
+
 #ifdef CK_SCO32V4                      /* SCO 3.2v4 */
 #ifndef ANYSCO
 #define ANYSCO
@@ -194,6 +157,18 @@ struct filinfo {
 
 /* Built-in makefile entries */
 
+#ifdef SOLARIS11                       /* Solaris 11 implies 10 */
+#ifndef SOLARIS10
+#define SOLARIS10
+#endif /* SOLARIS10 */
+#endif /* SOLARIS11 */
+
+#ifdef SOLARIS10                       /* Solaris 10 implies 9 */
+#ifndef SOLARIS9
+#define SOLARIS9
+#endif /* SOLARIS9 */
+#endif /* SOLARIS10 */
+
 #ifdef SOLARIS9                                /* Solaris 9 implies 8 */
 #ifndef SOLARIS8
 #define SOLARIS8
@@ -242,6 +217,27 @@ struct filinfo {
 #define POSIX_CRTSCTS
 #endif /* POSIX_CRTSCTS */
 #endif /* POSIX */
+#ifndef SVR4
+#define SVR4
+#endif /* SVR4 */
+#ifndef STERMIOX
+#define STERMIOX
+#endif /* STERMIOX */
+#ifndef SELECT
+#define SELECT
+#endif /* SELECT */
+#ifndef FNFLOAT
+#define FNFLOAT
+#endif /* FNFLOAT */
+#ifndef DIRENT
+#define DIRENT
+#endif /* DIRENT */
+#ifndef BIGBUFOK
+#define BIGBUFOK
+#endif /* BIGBUFOK */
+#ifndef CK_NEWTERM
+#define CK_NEWTERM
+#endif /* CK_NEWTERM */
 #endif /* SOLARIS */
 
 #ifdef SUN4S5                          /* Sun-4 System V environment */
@@ -672,6 +668,11 @@ struct filinfo {
 #include <stdio.h>                     /* Begin by including this. */
 #include <ctype.h>                     /* and this. */
 
+#ifdef VMS
+#include <types.h>                     /* Ensure off_t. */
+#include "ckvrms.h"                    /* Get NAMDEF NAMX_C_MAXRSS. */
+#endif /* def VMS */
+
 /* System-type compilation switches */
 
 #ifdef FT21                            /* Fortune For:Pro 2.1 implies 1.8 */
@@ -1148,10 +1149,10 @@ struct filinfo {
 #endif /* OSKORUNIX */
 
 #ifdef OS2
-#define CK_ANSIC            /* OS/2 supports ANSIC and more extensions */
+#define CK_ANSIC                /* OS/2 supports ANSIC and more extensions */
 #endif /* OS2 */
 
-#ifdef OSF50               /* Newer OSF/1 versions imply older ones */
+#ifdef OSF50                      /* Newer OSF/1 versions imply older ones */
 #ifndef OSF40
 #define OSF40
 #endif /* OSF40 */
@@ -1429,15 +1430,40 @@ _PROTOTYP(int ckxfprintf,(FILE *, const char *, ...));
 #endif /* CK_POSIX_SIG */
 #endif /* QNX */
 
-/* Void type */
-
+/* 
+  void type, normally available only in ANSI compilers.
+  The HP-UX exception (for its "bundled" non-ANSI C compiler)
+  is known to be valid back to HP-UX 6.5.
+  Adjustments might be needed for earlier HP-UX versions.
+*/
 #ifndef VOID                           /* Used throughout all C-Kermit */
 #ifdef CK_ANSIC                                /* modules... */
 #define VOID void
 #else
+#ifdef HPUX
+#define VOID void
+#else
 #define VOID int
+#endif /* HPUX */
 #endif /* CK_ANSIC */
 #endif /* VOID */
+/*
+  Exactly the same as VOID but for use in contexts where the VOID symbol
+  conflicts some header-file definition.  This is needed for the section
+  of ckuusx.c that provides C-Kermit's curses interface, roughly the
+  second half of ckuusx.c.
+*/
+#ifndef CKVOID
+#ifdef CK_ANSIC
+#define CKVOID void
+#else
+#ifdef HPUX
+#define CKVOID void
+#else
+#define CKVOID int
+#endif /* HPUX */
+#endif /* CK_ANSIC */
+#endif /* CKVOID */
 
 /* Const type */
 
@@ -1975,18 +2001,6 @@ _PROTOTYP( void bleep, (short) );
 #endif /* TLOG */
 #endif /* NOICP */
 
-#ifndef TLOG
-#define tlog(a,b,c,d)
-#else
-#ifndef CKCMAI
-/* Debugging included.  Declare debug log flag in main program only. */
-extern int tralog, tlogfmt;
-#endif /* CKCMAI */
-_PROTOTYP(VOID dotlog,(int, char *, char *, long));
-#define tlog(a,b,c,d) if (tralog && tlogfmt) dotlog(a,b,c,d)
-_PROTOTYP(VOID doxlog,(int, char *, long, int, int, char *));
-#endif /* TLOG */
-
 /* Formats for debug() and tlog() */
 
 #define F000 0
@@ -2141,14 +2155,43 @@ _PROTOTYP(VOID doxlog,(int, char *, long, int, int, char *));
 #ifdef USE_UU_LOCK                     /* FreeBSD or other with uu_lock() */
 #define USETTYLOCK
 #else
-#ifdef HAVE_BAUDBOY                    /* Red Hat Linux >= 7.2 */
+/*
+  Prior to 8.0.299 Alpha.08 this was HAVE_BAUDBOY which was added for
+  Red Hat 7.2 in May 2003 but which is no longer supported in Debian and
+  OpenSuse (at least).
+*/
+#ifdef HAVE_LOCKDEV
 #define USETTYLOCK
-#endif /* HAVE_BAUDBOY */
+#endif /* HAVE_LOCKDEV */
 #endif /* USE_UU_LOCK */
 #endif /* AIXRS */
 #endif /* USETTYLOCK */
 #endif /* NOTTYLOCK */
 
+#ifndef NO_OPENPTY                     /* Can use openpty() */
+#ifndef HAVE_OPENPTY
+#ifdef __linux__
+#define HAVE_OPENPTY
+#else
+#ifdef __FreeBSD__
+#define HAVE_OPENPTY
+#else
+#ifdef __OpenBSD__
+#define HAVE_OPENPTY
+#else
+#ifdef __NetBSD__
+#define HAVE_OPENPTY
+#else
+#ifdef MACOSX10
+#define HAVE_OPENPTY
+#endif /* MACOSX10 */
+#endif /* __NetBSD__ */
+#endif /* __OpenBSD__ */
+#endif /* __FreeBSD__ */
+#endif /* __linux__ */
+#endif /* HAVE_OPENPTY */
+#endif /* NO_OPENPTY */
+
 /* Kermit feature selection */
 
 #ifndef NOSPL
@@ -2454,7 +2497,7 @@ _PROTOTYP(VOID doxlog,(int, char *, long, int, int, char *));
 extern long ztmsec, ztusec;            /* Fraction of sec of current time */
 #endif /* CKCMAI */
 
-#ifndef NOUNPREFIXZERO                 /* Allow unprefixing of  NUL (0) */
+#ifndef NOUNPREFIXZERO                 /* Allow unprefixing of NUL (0) */
 #ifndef UNPREFIXZERO                   /* in file-transfer packets */
 #define UNPREFIXZERO
 #endif /* UNPREFIXZERO */
@@ -2605,10 +2648,19 @@ extern long ztmsec, ztusec;             /* Fraction of sec of current time */
 #define CKHTTP
 #endif /* mips */
 #endif /* ultrix */
+#ifdef __NetBSD__                      /* NetBSD */
+#define CKHTTP
+#endif /* __NetBSD__ */
+#ifdef __FreeBSD__
+#define CKHTTP
+#endif /* __FreeBSD__ */
+#ifdef __OpenBSD__
+#define CKHTTP
+#endif /* __OpenBSD__ */
 /* Add more here... */
 #endif /* CKHTTP */
 #ifndef CKHTTP                         /* If CKHTTP not defined yet */
-#define NOHTTP                         /* then define HOHTTP */
+#define NOHTTP                         /* then define NOHTTP */
 #endif /* CKHTTP */
 #endif /* NOHTTP */
 
@@ -3332,6 +3384,7 @@ _PROTOTYP( int ttruncmd, (char *) );
 #endif /* CK_TTGWSIZ */
 #endif /* NOTTGWSIZ */
 
+#ifdef OS2
 /* OS/2 C-Kermit features not available in 16-bit version... */
 
 #ifdef OS2ONLY
@@ -3361,14 +3414,10 @@ _PROTOTYP( int ttruncmd, (char *) );
 
 /* OS/2 C-Kermit features not available in Windows NT version... */
 
-#ifdef OS2
 #ifdef NT
 #ifdef PCFONTS                         /* PC Font support */
 #undef PCFONTS
 #endif /* PCFONTS */
-#ifdef NPIPE                           /* Named Pipes communication */
-#undef NPIPE
-#endif /* NPIPE */
 #ifdef OS2PM                           /* Presentation Manager */
 #undef OS2PM
 #endif /* OS2PM */
@@ -4479,15 +4528,23 @@ extern int errno;
 #else
 /*
   The following declaration would cause problems for VMS and OS/2, in which
-  errno is an "extern volatile int noshare"...
+  errno is an "extern volatile int noshare"...  NOTE: by now (2007) the
+  following is an anachronism and should be the execption rather than the
+  rule.
 */
- extern int errno;                     /* Needed by most modules. */
+extern int errno;
 #endif /* __GLIBC__ */
 #endif /* OS2 */
 #endif /* VMS */
 #endif /* STRATUS */
 #endif /* _CRAY */
 
+#ifdef UNIX                            /* Catch-all so we can have */
+#ifndef ESRCH                          /* access to error mnemonics */
+#include <errno.h>                     /* in all modules - 2007/08/25 */
+#endif /* ESRCH */
+#endif /* UNIX */
+
 #ifdef pdp11                           /* Try to make some space on PDP-11 */
 #ifndef NODIAL
 #define NODIAL
@@ -4611,35 +4668,6 @@ extern int errno;
 #endif /* BIGBUFOK */
 #endif /* DEBUG */
 
-#ifndef DEBUG
-/* Compile all the debug() statements away.  Saves a lot of space and time. */
-#define debug(a,b,c,d)
-#define hexdump(a,b,c)
-/* Now define the debug() macro. */
-#else /* DEBUG */
-_PROTOTYP(int dodebug,(int,char *,char *,long));
-_PROTOTYP(int dohexdump,(CHAR *,CHAR *,int));
-#ifdef IFDEBUG
-/* Use this form to avoid function calls: */
-#ifdef COMMENT
-#define debug(a,b,c,d) if (deblog) dodebug(a,b,(char *)(c),(long)d)
-#define hexdump(a,b,c) if (deblog) dohexdump((CHAR *)(a),(CHAR *)(b),c)
-#else
-#ifdef CK_ANSIC
-#define debug(a,b,c,d) ((void)(deblog?dodebug(a,b,(char *)(c),(long)d):0))
-#define hexdump(a,b,c) ((void)(deblog?dohexdump((CHAR *)(a),(CHAR *)(b),c):0))
-#else
-#define debug(a,b,c,d) (deblog?dodebug(a,b,(char *)(c),(long)d):0)
-#define hexdump(a,b,c) (deblog?dohexdump((CHAR *)(a),(CHAR *)(b),c):0)
-#endif /* CK_ANSIC */
-#endif /* COMMENT */
-#else /* IFDEBUG */
-/* Use this form to save space: */
-#define debug(a,b,c,d) dodebug(a,b,(char *)(c),(long)d)
-#define hexdump(a,b,c) dohexdump((CHAR *)(a),(CHAR *)(b),c)
-#endif /* IFDEBUG */
-#endif /* DEBUG */
-
 /* File System Defaults */
 
 #ifndef UIDBUFLEN                      /* Length of User ID */
@@ -4972,6 +5000,203 @@ typedef unsigned int u_int;
 #endif /* STRATUS */                   /* End of types.h section */
 
 /*
+  File lengths and offsets.  This section is expected to grow as we
+  support long files on 32-bit platforms.  We want this data type to be
+  signed because so many functions return either a file size or a negative
+  value to indicate an error.
+*/
+#ifndef CK_OFF_T
+#ifdef OS2
+#ifdef NT
+#define CK_OFF_T __int64
+#else
+#define CK_OFF_T long
+#endif  /* NT */
+#endif /* OS2 */
+#endif /* CK_OFF_T */
+
+/* FreeBSD and OpenBSD set off_t to the appropriate size unconditionally */
+
+#ifndef CK_OFF_T
+#ifdef __FreeBSD__
+#define CK_OFF_T off_t
+#else
+#ifdef __OpenBSD__
+#define CK_OFF_T off_t
+#endif /* __OpenBSD__ */
+#endif /* __FreeBSD__ */
+#endif /* CK_OFF_T */
+
+/* 32-bit platforms that support long files thru "transitional interface" */
+/* These include Linux, Solaris, NetBSD... */
+
+#ifdef AIXRS
+#ifdef _LARGE_FILES
+#ifndef CK_OFF_T
+#define CK_OFF_T off_t
+#endif /* CK_OFF_T */
+#endif /* _LARGE_FILES */
+#endif /* AIXRS */
+
+#ifdef _LARGEFILE_SOURCE
+#ifndef CK_OFF_T
+#define CK_OFF_T off_t
+#endif /* CK_OFF_T */
+#ifdef IRIX
+#define CKFSEEK(a,b,c) fseek64(a,b,c)
+#define CKFTELL(a) ftell64(a)
+#else /* IRIX */
+#define CKFSEEK(a,b,c) fseeko(a,b,c)
+#define CKFTELL(a) ftello(a)
+#endif /* IRIX */
+#else  /* Not  _LARGEFILE_SOURCE */
+#define CKFSEEK(a,b,c) fseek(a,b,c)
+#define CKFTELL(a) ftell(a)
+/* See below the next section for the catch-all case */
+#endif /* _LARGEFILE_SOURCE */
+
+/* 32-bit or 64-bit platforms */
+
+/* CK_64BIT is a compile-time symbol indicating a true 64-bit build */
+/* meaning that longs and pointers are 64 bits */
+
+#ifndef VMS                            /* VMS Alpha and IA64 are 32-bit! */
+#ifndef CK_64BIT
+#ifdef _LP64                           /* Solaris */
+#define CK_64BIT
+#else
+#ifdef __LP64__                                /* MacOS X 10.4 (or _LP64,__ppc64__) */
+#define CK_64BIT
+#else
+#ifdef __arch64__                      /* gcc alpha, sparc */
+#define CK_64BIT
+#else
+#ifdef __alpha                         /* Alpha decc (or __ALPHA) */
+#define CK_64BIT
+#else
+#ifdef __amd64                         /* AMD x86_64 (or __x86_64) */
+#define CK_64BIT
+#else
+#ifdef __ia64                          /* Intel IA64 */
+#ifndef HPUX
+#define CK_64BIT
+#endif /* HPUX */
+#endif /* __ia64 */
+#endif /* __amd64 */
+#endif /* __alpha */
+#endif /* __arch64__ */
+#endif /* __LP64__ */
+#endif /* _LP64 */
+#endif /* CK_64BIT */
+#endif /* VMS */
+
+#ifndef CK_OFF_T
+#ifdef CK_64BIT
+#define CK_OFF_T off_t                 /* This has to be signed */
+#else  /* CK_64BIT */
+#define CK_OFF_T long                  /* Signed */
+#endif /* CK_64BIT */
+#endif /* CK_OFF_T */
+
+#ifndef TLOG
+#define tlog(a,b,c,d)
+#else
+#ifndef CKCMAI
+/* Debugging included.  Declare debug log flag in main program only. */
+extern int tralog, tlogfmt;
+#endif /* CKCMAI */
+_PROTOTYP(VOID dotlog,(int, char *, char *, CK_OFF_T));
+#define tlog(a,b,c,d) if (tralog && tlogfmt) dotlog(a,b,c,(CK_OFF_T)d)
+_PROTOTYP(VOID doxlog,(int, char *, CK_OFF_T, int, int, char *));
+#endif /* TLOG */
+
+#ifndef DEBUG
+/* Compile all the debug() statements away.  Saves a lot of space and time. */
+#define debug(a,b,c,d)
+#define ckhexdump(a,b,c)
+/* Now define the debug() macro. */
+#else /* DEBUG */
+_PROTOTYP(int dodebug,(int,char *,char *,CK_OFF_T));
+_PROTOTYP(int dohexdump,(CHAR *,CHAR *,int));
+#ifdef IFDEBUG
+/* Use this form to avoid function calls: */
+#ifdef COMMENT
+#define debug(a,b,c,d) if (deblog) dodebug(a,b,(char *)(c),(CK_OFF_T)(d))
+#define ckhexdump(a,b,c) if (deblog) dohexdump((CHAR *)(a),(CHAR *)(b),c)
+#else
+#ifdef CK_ANSIC
+#define debug(a,b,c,d) \
+((void)(deblog?dodebug(a,b,(char *)(c),(CK_OFF_T)(d)):0))
+#define ckhexdump(a,b,c) \
+((void)(deblog?dohexdump((CHAR *)(a),(CHAR *)(b),c):0))
+#else
+#define debug(a,b,c,d) (deblog?dodebug(a,b,(char *)(c),(CK_OFF_T)(d)):0)
+#define ckhexdump(a,b,c) (deblog?dohexdump((CHAR *)(a),(CHAR *)(b),c):0)
+#endif /* CK_ANSIC */
+#endif /* COMMENT */
+#else /* IFDEBUG */
+/* Use this form to save space: */
+#define debug(a,b,c,d) dodebug(a,b,(char *)(c),(CK_OFF_T)(d))
+#define ckhexdump(a,b,c) dohexdump((CHAR *)(a),(CHAR *)(b),c)
+#endif /* IFDEBUG */
+#endif /* DEBUG */
+
+
+/* Structure definitions for Kermit file attributes */
+/* All strings come as pointer and length combinations */
+/* Empty string (or for numeric variables, -1) = unused attribute. */
+
+struct zstr {             /* string format */
+    int len;             /* length */
+    char *val;            /* value */
+};
+
+struct zattr {            /* Kermit File Attribute structure */
+    CK_OFF_T lengthk;    /* (!) file length in K */
+    struct zstr type;     /* (") file type (text or binary) */
+    struct zstr date;     /* (#) file creation date yyyymmdd[ hh:mm[:ss]] */
+    struct zstr creator;  /* ($) file creator id */
+    struct zstr account;  /* (%) file account */
+    struct zstr area;     /* (&) area (e.g. directory) for file */
+    struct zstr password; /* (') password for area */
+    long blksize;         /* (() file blocksize */
+    struct zstr xaccess;  /* ()) file access: new, supersede, append, warn */
+    struct zstr encoding; /* (*) encoding (transfer syntax) */
+    struct zstr disp;     /* (+) disposition (mail, message, print, etc) */
+    struct zstr lprotect; /* (,) protection (local syntax) */
+    struct zstr gprotect; /* (-) protection (generic syntax) */
+    struct zstr systemid; /* (.) ID for system of origin */
+    struct zstr recfm;    /* (/) record format */
+    struct zstr sysparam; /* (0) system-dependent parameter string */
+    CK_OFF_T length;      /* (1) exact length on system of origin */
+    struct zstr charset;  /* (2) transfer syntax character set */
+#ifdef OS2
+    struct zstr longname; /* OS/2 longname if applicable */
+#endif /* OS2 */
+    struct zstr reply;    /* This goes last, used for attribute reply */
+};
+
+/* Kermit file information structure */
+
+struct filinfo {
+  int bs;                              /* Blocksize */
+  int cs;                              /* Character set */
+  long rl;                             /* Record length */
+  int org;                             /* Organization */
+  int fmt;                             /* Record format */
+  int cc;                              /* Carriage control */
+  int typ;                             /* Type (text/binary) */
+  int dsp;                             /* Disposition */
+  char *os_specific;                   /* OS-specific attributes */
+#ifdef OS2
+  unsigned long int lblopts;           /* LABELED FILE options bitmask */
+#else
+  int lblopts;
+#endif /* OS2 */
+};
+
+
+/*
   Data type for pids.  If your system uses a different type, put something
   like -DPID_T=pid_t on command line, or override here.
 */
@@ -5113,12 +5338,12 @@ _PROTOTYP( int zchkpid, (unsigned long) );
 _PROTOTYP( VOID z_exec, (char *, char **, int) );
 #endif /* CKEXEC */
 _PROTOTYP( int chkfn, (int) );
-_PROTOTYP( long zchki, (char *) );
+_PROTOTYP( CK_OFF_T zchki, (char *) );
 #ifdef VMSORUNIX
-_PROTOTYP( long zgetfs, (char *) );
+_PROTOTYP( CK_OFF_T zgetfs, (char *) );
 #else
 #ifdef OS2
-_PROTOTYP( long zgetfs, (char *) );
+_PROTOTYP( CK_OFF_T zgetfs, (char *) );
 #else
 #define zgetfs(a) zchki(a)
 #endif /* OS2 */
@@ -5149,7 +5374,7 @@ _PROTOTYP( int znext, (char *) );
 #ifdef ZXREWIND
 _PROTOTYP( int zxrewind, (void) );
 #endif /* ZXREWIND */
-_PROTOTYP( int zchkspa, (char *, long) );
+_PROTOTYP( int zchkspa, (char *, CK_OFF_T) );
 _PROTOTYP( VOID znewn, (char *, char **) );
 _PROTOTYP( int zrename, (char *, char *) );
 _PROTOTYP( int zcopy, (char *, char *) );
@@ -5165,7 +5390,7 @@ _PROTOTYP( int zmail, (char *, char *) );
 _PROTOTYP( int zprint, (char *, char *) );
 _PROTOTYP( char * tilde_expand, (char *) );
 _PROTOTYP( int zmkdir, (char *) ) ;
-_PROTOTYP( int zfseek, (long) ) ;
+_PROTOTYP( int zfseek, (CK_OFF_T) ) ;
 #ifdef ZFNQFP
 _PROTOTYP( struct zfnfp * zfnqfp, (char *, int, char * ) ) ;
 #else
@@ -5685,7 +5910,9 @@ extern int _flsbuf(char c,FILE *stream);
   and pause.  Otherwise, no prototypes.
 */
 #ifdef VMS
+#include <signal.h>  /* SMS: sleep() for old (V4.0-000) DEC C. */
 #include <unixio.h>
+#include <unixlib.h> /* SMS: getpid() for old (V4.0-000) DEC C. */
 #endif /* VMS */
 
 #ifdef NEXT
@@ -5783,6 +6010,12 @@ _PROTOTYP( long atol, (char *) );
 /* or #define NULL ((void *) 0) */
 #endif /* NULL */
 
+/* Macro to differentiate "" from NULL (to avoid comparisons with literals) */
+
+#ifndef isemptystring
+#define isemptystring(s) ((s?(*s?0:1):0))
+#endif /* isemptystring */
+
 /* Maximum length for a fully qualified filename, not counting \0 at end. */
 /*
   This is a rough cut, and errs on the side of being too big.  We don't
@@ -5790,40 +6023,40 @@ _PROTOTYP( long atol, (char *) );
   symbols, for fear of introducing unnecessary conflicts.
 */
 #ifndef CKMAXPATH
+#ifdef VMS                             /* VMS may have bad (small, ODS2) */
+#define CKMAXPATH NAMX_C_MAXRSS                /* PATH_MAX, so use NAMX_C_MAXRSS. */
+#else /* def VMS */
 #ifdef MAXPATHLEN                      /* (it probably isn't) */
 #define CKMAXPATH MAXPATHLEN
 #else
 #ifdef PATH_MAX                                /* POSIX */
 #define CKMAXPATH PATH_MAX
-#else
+#else /* def PATH_MAX */
 #ifdef MAC
 #define CKMAXPATH 63
-#else
+#else /* def MAC */
 #ifdef pdp11
 #define CKMAXPATH 255
-#else
+#else /* def pdp11 */
 #ifdef UNIX                            /* Even though some are way less... */
 #define CKMAXPATH 1024
-#else
-#ifdef VMS
-#define CKMAXPATH 675                  /* (derivation is complicated...) */
-#else
+#else /* def UNIX */
 #ifdef STRATUS
 #define CKMAXPATH 256                  /* == $MXPL from PARU.H */
-#else
+#else /* def STRATUS */
 #ifdef datageneral
 #define CKMAXPATH 256                  /* == $MXPL from PARU.H */
-#else
+#else /* def datageneral */
 #define CKMAXPATH 255
-#endif /* STRATUS */
-#endif /* datageneral */
-#endif /* VMS */
-#endif /* UNIX */
-#endif /* pdp11 */
-#endif /* MAC */
-#endif /* PATH_MAX */
-#endif /* MAXPATHLEN */
-#endif /* CKMAXPATH */
+#endif /* def STRATUS [else] */
+#endif /* def datageneral [else] */
+#endif /* def UNIX [else] */
+#endif /* def pdp11 [else] */
+#endif /* def MAC [else] */
+#endif /* def PATH_MAX [else] */
+#endif /* def MAXPATHLEN [else] */
+#endif /* def VMS [else] */
+#endif /* ndef CKMAXPATH */
 
 /* Maximum length for the name of a tty device */
 
@@ -6275,8 +6508,12 @@ struct keytab {                          /* Keyword table */
 };
 #endif /* CK_KEYTAB */
 
+#ifdef UNIX
+_PROTOTYP( int isalink, (char *));
+#endif /* UNIX */
+
 #ifdef NETPTY
-_PROTOTYP( int do_pty, (char *));
+_PROTOTYP( int do_pty, (int *, char *, int));
 _PROTOTYP( VOID end_pty, (void));
 #endif /* NETPTY */
 
@@ -6363,6 +6600,7 @@ _PROTOTYP(DWORD ckGetLongPathname,(LPCSTR lpFileName,
                                    LPSTR lpBuffer, DWORD cchBuffer));
 #endif /* NT */
 
+
 #include "ckclib.h"
 
 /* End of ckcdeb.h */