/*****************************************************************************
 *	SEAlink - Sliding window file transfer protocol
 *
 *	@(#) sealink.c 2.9 89/03/02 
 *	UNIX SVR2 and BSD versions by Scott Reynolds
 *
 *	Based on:
 *	MS-DOS Version 1.20, created on 08/05/87 at 17:51:40
 *   (C)COPYRIGHT 1986,87 by System Enhancement Associates; ALL RIGHTS RESERVED
 *	By:  Thom Henderson
 *
 *	Description:
 *	This is the history of the SEAlink program from present back
 *	to the first working version.  Many thanks to Sandy Zelkovitz
 *	(alphacm!sandy) for his help in getting it to run under SCO XENIX/286
 *	and to the faculty at Northern Michigan University for allowing
 *	the use of their VAX lab to develop the BSD code.
 *
 ****************************************************************************/

2.9 89/03/02 21:11:01 scott
Handle case where temporary and specified files are on different filesystems

2.8 88/10/22 03:40:15 scott
Add switch for CRC method (table or calculation); future-minded changes made

2.7 88/08/04 11:19:45 scott
take out #include <sys/timeb.h> -- it's useless

2.6 88/07/11 19:49:54 scott
added short block debug error message

2.5 88/07/09 17:47:18 scott
remove -1 option, all writes go to fd 1 and all reads come from fd 0;
nap() used in com_getc() if NO_NAP is undefined (better XMODEM compatibility);
mktemp() is employed to get a guaranteed unique temporary filename;
a CRC lookup table is employed for better execution time

2.4 88/03/30 11:44:28 scott
use getopt() for options; clean it up a bit

2.3 88/02/06 14:01:51 scott
Correct final fwrite() call -- pass it an integer rather than long!

2.2 88/02/06 01:27:57 scott
added block file output to rcvfile()

2.1 88/02/04 19:40:22 scott
Update version number to reflect BSD additions; put in uucp address

1.23 88/02/04 19:26:41 scott
Added BSD UNIX calls, slicked it up a little bit

1.22 87/10/07 01:56:17 scott
"o" option added for disabling overdrive mode

1.21 87/10/05 01:37:18 scott
Based on MS-DOS ver 1.20; ACKless mode added

1.20 87/10/02 09:17:18 scott
memset() call in sendblk() fixed

1.19 87/09/30 00:12:59 scott
NAKEOT is defined now, it really has purpose.

1.18 87/09/23 00:03:15 scott
receiver gets a between-file delay too

1.17 87/09/20 20:37:33 scott
more receiver filename debugging

1.16 87/09/20 20:02:59 scott
fixed receive when no filename given

1.15 87/09/20 19:14:22 scott
added check for writable file when receiving and better abort check

1.14 87/09/17 23:24:48 scott
delay added in main's xmtfile() loop

1.13 87/09/17 00:27:02 scott
sendabort() flushes output before sending abort sequence

1.12 87/09/16 12:47:04 scott
minor cosmetic changes...

1.11 87/09/16 00:10:49 scott
cleaned up generally using lint(1)

1.10 87/09/15 23:31:28 scott
sendabort() uses ^X; memset(), final ioctl() calls fixed;
SYSV replaces IBMXENIX and UNIX flags

1.9 87/09/15 12:37:46 scott
expanded to support full pathnames, portability increased

1.8 87/09/13 12:51:38 scott
filename conversion handled correctly; more EOT experimenting

1.7 87/09/13 03:13:58 scott
endrcv in rcvfile(): forgot EOT message is for debug only

1.6 87/09/13 02:43:47 scott
remove EOT NAK from receiver!  Useless, screws it up...

1.5 87/09/13 01:26:17 scott
ACKing EOF didn't work.  NAK again, back to original...

1.4 87/09/12 01:50:10 scott
endrcv: NAK of EOT doesn't work so hot.  Try ACKing it

1.3 87/09/12 00:45:23 scott
com_getc() modified for straight Sys V calls, ackchk() reflects this

1.2 87/09/04 20:57:12 scott
SCO/IBM differences eliminated; code cleaned up a bit

1.1 87/09/02 23:31:14 scott
date and time created 87/09/02 23:31:14 by scott

