*** ckconu.c	1987-09-30 02:39:55.000000000 -0400
--- ../kermit/ckconu.c	2016-01-28 14:40:48.000000000 -0500
***************
*** 11,17 ****
   Also enhanced to allow escaping from connect state to command
   interpreter, to allow sending/receiving without breaking connection.
  */
- 
  #include "ckermi.h"
  #include <signal.h>
  #include <setjmp.h>
--- 11,16 ----
*** ckermi.h	1987-09-30 02:40:54.000000000 -0400
--- ../kermit/ckermi.h	2016-01-28 14:55:17.000000000 -0500
***************
*** 1,5 ****
--- 1,15 ----
  /* ckermit.h -- Symbol and macro definitions for C-Kermit */
  
+ #ifdef __EXTENSIONS__
+ #undef __EXTENSIONS__
+ #endif /*  __EXTENSIONS__ */
+ #ifdef _POSIX_C_SOURCE
+ #undef _POSIX_C_SOURCE
+ #endif /* _POSIX_C_SOURCE */
+ #ifdef _XOPEN_SOURCE
+ #undef _XOPEN_SOURCE
+ #endif /* _XOPEN_SOURCE */
+ 
  #include <stdio.h>
  #include <ctype.h>
  #include "ckdebu.h"
***************
*** 54,59 ****
  /* Macros */
  
  #define tochar(ch)  ((ch) + SP )	/* Number to character */
! #define unchar(ch)  ((ch) - SP )	/* Character to number */
  #define ctl(ch)     ((ch) ^ 64 )	/* Controllify/Uncontrollify */
  #define unpar(ch)   ((ch) & 127)	/* Clear parity bit */
--- 64,69 ----
  /* Macros */
  
  #define tochar(ch)  ((ch) + SP )	/* Number to character */
! #define xunchar(ch)  ((ch) - SP )	/* Character to number */
  #define ctl(ch)     ((ch) ^ 64 )	/* Controllify/Uncontrollify */
  #define unpar(ch)   ((ch) & 127)	/* Clear parity bit */
*** ckfns.c	1987-09-30 02:41:43.000000000 -0400
--- ../kermit/ckfns.c	2016-01-28 14:55:17.000000000 -0500
***************
*** 134,140 ****
      while ((a = *buf++) != '\0') {
  	if (rptflg) {			/* Repeat processing? */
  	    if (a == rptq) {		/* Yes, got a repeat prefix? */
! 		rpt = unchar(*buf++);	/* Yes, get the repeat count, */
  		a = *buf++;		/* and get the prefixed character. */
  	    }
  	}
--- 134,140 ----
      while ((a = *buf++) != '\0') {
  	if (rptflg) {			/* Repeat processing? */
  	    if (a == rptq) {		/* Yes, got a repeat prefix? */
! 		rpt = xunchar(*buf++);	/* Yes, get the repeat count, */
  		a = *buf++;		/* and get the prefixed character. */
  	    }
  	}
***************
*** 543,552 ****
  
      len = strlen(data);		    	/* Number of fields */
  
!     spsiz = (len-- > 0) ? unchar(data[0]) : DSPSIZ; 	/* Packet size */
      if (spsiz < 10) spsiz = DSPSIZ;
  
!     x = (len-- > 0) ? unchar(data[1]) : DMYTIM;	/* Timeout */
      if (!timef) {			/* Only use if not overridden */
  	timint = x;
  	if (timint < 0) timint = DMYTIM;
--- 543,552 ----
  
      len = strlen(data);		    	/* Number of fields */
  
!     spsiz = (len-- > 0) ? xunchar(data[0]) : DSPSIZ; 	/* Packet size */
      if (spsiz < 10) spsiz = DSPSIZ;
  
!     x = (len-- > 0) ? xunchar(data[1]) : DMYTIM;	/* Timeout */
      if (!timef) {			/* Only use if not overridden */
  	timint = x;
  	if (timint < 0) timint = DMYTIM;
***************
*** 554,564 ****
  
      npad = 0; padch = '\0';		    	    	/* Padding */
      if (len-- > 0) {
! 	npad = unchar(data[2]);
  	if (len-- > 0) padch = ctl(data[3]); else padch = 0;
      }
  
!     eol = (len-- > 0) ? unchar(data[4]) : '\r';	    	/* Terminator  */
      if ((eol < 2) || (eol > 037)) eol = '\r';
  
      ctlq = (len-- > 0) ? data[5] : CTLQ;    	    	/* Control prefix */
--- 554,564 ----
  
      npad = 0; padch = '\0';		    	    	/* Padding */
      if (len-- > 0) {
! 	npad = xunchar(data[2]);
  	if (len-- > 0) padch = ctl(data[3]); else padch = 0;
      }
  
!     eol = (len-- > 0) ? xunchar(data[4]) : '\r';	    	/* Terminator  */
      if ((eol < 2) || (eol > 037)) eol = '\r';
  
      ctlq = (len-- > 0) ? data[5] : CTLQ;    	    	/* Control prefix */
***************
*** 794,800 ****
  */
  
  cwd(vdir) char *vdir; {
!     vdir[unchar(*vdir) + 1] = '\0';	/* End with a null */
      if (zchdir(vdir+1)) {
  	encstr(vdir+1);
  	ack1(data);
--- 794,800 ----
  */
  
  cwd(vdir) char *vdir; {
!     vdir[xunchar(*vdir) + 1] = '\0';	/* End with a null */
      if (zchdir(vdir+1)) {
  	encstr(vdir+1);
  	ack1(data);
*** ckfns2.c	1987-09-30 02:41:50.000000000 -0400
--- ../kermit/ckfns2.c	2016-01-28 14:55:17.000000000 -0500
***************
*** 274,287 ****
     /***	if (t == 2) doexit(0); *** uncomment this to allow ^A^B cause exit ***/
  
  	if (t == MYEOL) return('Q');
! 	*l = unchar(t);			/* Packet length */
  	debug(F101," pkt len","",*l);
  
  /* sequence number */
  
  	if ((t = recpkt[i++]) == stchr) continue;
  	if (t == MYEOL) return('Q');
! 	*n = unchar(t);
  	debug(F101,"rpack: n","",*n);
  
  /* cont'd... */
--- 274,287 ----
     /***	if (t == 2) doexit(0); *** uncomment this to allow ^A^B cause exit ***/
  
  	if (t == MYEOL) return('Q');
! 	*l = xunchar(t);			/* Packet length */
  	debug(F101," pkt len","",*l);
  
  /* sequence number */
  
  	if ((t = recpkt[i++]) == stchr) continue;
  	if (t == MYEOL) return('Q');
! 	*n = xunchar(t);
  	debug(F101,"rpack: n","",*n);
  
  /* cont'd... */
*** ckprot.c	1987-09-30 02:42:06.000000000 -0400
--- ../kermit/ckprot.c	2016-01-28 14:55:17.000000000 -0500
***************
*** 155,161 ****
  break;
  case 22:
  { x = *(srvcmd+1);			/* Disk Usage query */
!     	     x = ((x == '\0') || (x == unchar(0)));
  	     x = (x ? syscmd(SPACMD,"") : syscmd(SPACM2,srvcmd+2));
      	     if (x) BEGIN ssinit; else { errpkt("Can't check space"); SERVE; }}
  break;
--- 155,161 ----
  break;
  case 22:
  { x = *(srvcmd+1);			/* Disk Usage query */
!     	     x = ((x == '\0') || (x == xunchar(0)));
  	     x = (x ? syscmd(SPACMD,"") : syscmd(SPACM2,srvcmd+2));
      	     if (x) BEGIN ssinit; else { errpkt("Can't check space"); SERVE; }}
  break;
*** ckxunx.c	1987-09-30 02:43:01.000000000 -0400
--- ../kermit/ckxunx.c	2016-01-28 14:25:23.000000000 -0500
***************
*** 138,144 ****
--- 138,148 ----
  #include <termio.h>
  #include <sys/ioctl.h>
  #include <fcntl.h>			/* directory reading for locking */
+ #ifdef SOLARIS
+ #include <dirent.h>
+ #else
  #include <sys/dir.h>
+ #endif /* SOLARIS */
  #include <errno.h>			/* error numbers for system returns */
  extern int errno;			/* system call error return */
  #endif
***************
*** 578,595 ****
--- 582,614 ----
  
  /* Timeout handler for communication line input functions */
  
+ #ifdef SOLARIS                         /* fdc 20160128 */
+ void
+ timerh(int x) {
+     longjmp(sjbuf,1);
+ }
+ #else
  timerh() {
      longjmp(sjbuf,1);
  }
+ #endif /* SOLARIS */
  
   
  /* Set up terminal interrupts on console terminal */
  
  #ifdef UXIII
+ #ifdef SOLARIS
+ void
+ esctrp(x) int x; {                      /* trap console escapes (^\) */
+     conesc = 1;
+     signal(SIGQUIT,SIG_IGN);		/* ignore until trapped */
+ }
+ #else
  esctrp() {				/* trap console escapes (^\) */
      conesc = 1;
      signal(SIGQUIT,SIG_IGN);		/* ignore until trapped */
  }
+ #endif /* SOLARIS */
  #endif
  
  
*** ckzunx.c	1987-09-30 02:43:10.000000000 -0400
--- ../kermit/ckzunx.c	2016-01-28 15:09:01.287188000 -0500
***************
*** 85,92 ****
  /* Includes */
  
  #include "ckermi.h"			/* Kermit definitions, ctype, stdio */
  #include <sys/types.h>			/* Data types */
- #include <sys/dir.h>			/* Directory structure */
  #include <sys/stat.h>			/* File status */
  #include <pwd.h>			/* Password file for shell name */
  
--- 85,96 ----
  /* Includes */
  
  #include "ckermi.h"			/* Kermit definitions, ctype, stdio */
+ #ifdef SOLARIS
+ #include <dirent.h>
+ #else
+ #include <sys/dir.h>
+ #endif /* SOLARIS */
  #include <sys/types.h>			/* Data types */
  #include <sys/stat.h>			/* File status */
  #include <pwd.h>			/* Password file for shell name */
  
***************
*** 110,116 ****
--- 114,122 ----
  
  #ifdef UXIII
  #include <fcntl.h>
+ #ifndef MAXNAMLEN
  #define MAXNAMLEN DIRSIZ
+ #endif /* MAXNAMLEN */
  #endif
  
  #ifndef O_RDONLY
***************
*** 640,648 ****
   struct direct *dirbuf;
  #else
   int fd;
   struct direct dir_entry;
   struct direct *dirbuf = &dir_entry;
! #endif
   struct stat statbuf;
   if (pl == NULL)
   {
--- 646,660 ----
   struct direct *dirbuf;
  #else
   int fd;
+ #ifdef SOLARIS
+  struct dirent dir_entry;
+  struct dirent *dirbuf = &dir_entry;
+ #else
   struct direct dir_entry;
   struct direct *dirbuf = &dir_entry;
! #endif /* SOLARIS */
! #endif /* BSD4 */
! 
   struct stat statbuf;
   if (pl == NULL)
   {
*** kermit.c	1987-09-30 02:43:25.000000000 -0400
--- ../kermit/kermit.c	2016-01-28 14:55:17.000000000 -0500
***************
*** 156,162 ****
  /*
   * tochar: converts a control character to a printable one by adding a space.
   *
!  * unchar: undoes tochar.
   *
   * ctl:	   converts between control characters and printable characters by
   *	   toggling the control bit (ie. ^A becomes A and A becomes ^A).
--- 156,162 ----
  /*
   * tochar: converts a control character to a printable one by adding a space.
   *
!  * xunchar: undoes tochar.
   *
   * ctl:	   converts between control characters and printable characters by
   *	   toggling the control bit (ie. ^A becomes A and A becomes ^A).
***************
*** 165,171 ****
   */
  
  #define tochar(ch)  ((ch) + ' ')
! #define unchar(ch)  ((ch) - ' ')
  #define ctl(ch)	    ((ch) ^ 64 )
  #define unpar(ch)   ((ch) & 127)
  
--- 165,171 ----
   */
  
  #define tochar(ch)  ((ch) + ' ')
! #define xunchar(ch)  ((ch) - ' ')
  #define ctl(ch)	    ((ch) ^ 64 )
  #define unpar(ch)   ((ch) & 127)
  
***************
*** 980,989 ****
      {
  	cchksum = 0;
  	if ((t = cinchr()) == SOH) continue; /* Resynchronize if SOH */
! 	*len = unchar(t)-3;		/* Character count */
  
  	if ((t = cinchr()) == SOH) continue; /* Resynchronize if SOH */
! 	*num = unchar(t);		/* Packet number */
  
  	if ((t = cinchr()) == SOH) continue; /* Resynchronize if SOH */
  	type = t;			/* Packet type */
--- 980,989 ----
      {
  	cchksum = 0;
  	if ((t = cinchr()) == SOH) continue; /* Resynchronize if SOH */
! 	*len = xunchar(t)-3;		/* Character count */
  
  	if ((t = cinchr()) == SOH) continue; /* Resynchronize if SOH */
! 	*num = xunchar(t);		/* Packet number */
  
  	if ((t = cinchr()) == SOH) continue; /* Resynchronize if SOH */
  	type = t;			/* Packet type */
***************
*** 996,1002 ****
  	data[*len] = 0;			/* Mark the end of the data */
  
  	if ((t = inchr()) == SOH) continue; /* Resynchronize if SOH */
! 	rchksum = unchar(t);		/* Convert to numeric */
  	done = TRUE;			/* Got checksum, done */
      }
  
--- 996,1002 ----
  	data[*len] = 0;			/* Mark the end of the data */
  
  	if ((t = inchr()) == SOH) continue; /* Resynchronize if SOH */
! 	rchksum = xunchar(t);		/* Convert to numeric */
  	done = TRUE;			/* Got checksum, done */
      }
  
***************
*** 1181,1191 ****
  rpar(data)
  char data[];
  {
!     spsiz = unchar(data[0]);		/* Maximum send packet size */
!     timint = unchar(data[1]);		/* When I should time out */
!     pad = unchar(data[2]);		/* Number of pads to send */
      padchar = ctl(data[3]);		/* Padding character to send */
!     eol = unchar(data[4]);		/* EOL character I must send */
      quote = data[5];			/* Incoming data quote character */
  }
   
--- 1181,1191 ----
  rpar(data)
  char data[];
  {
!     spsiz = xunchar(data[0]);		/* Maximum send packet size */
!     timint = xunchar(data[1]);		/* When I should time out */
!     pad = xunchar(data[2]);		/* Number of pads to send */
      padchar = ctl(data[3]);		/* Padding character to send */
!     eol = xunchar(data[4]);		/* EOL character I must send */
      quote = data[5];			/* Incoming data quote character */
  }
   
