diff --git a/CVSROOT/checkoutlist b/CVSROOT/checkoutlist
deleted file mode 100755
index b04b3501f5efd94313942eb7439457bc82f5a2f5..0000000000000000000000000000000000000000
--- a/CVSROOT/checkoutlist
+++ /dev/null
@@ -1,13 +0,0 @@
-# The "checkoutlist" file is used to support additional version controlled
-# administrative files in $CVSROOT/CVSROOT, such as template files.
-#
-# The first entry on a line is a filename which will be checked out from
-# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
-# The remainder of the line is an error message to use if the file cannot
-# be checked out.
-#
-# File format:
-#
-#	[<whitespace>]<filename><whitespace><error message><end-of-line>
-#
-# comment lines begin with '#'
diff --git a/CVSROOT/commitinfo b/CVSROOT/commitinfo
deleted file mode 100755
index b19e7b7a63e8e90cdb49c43f02035646c4a76e0a..0000000000000000000000000000000000000000
--- a/CVSROOT/commitinfo
+++ /dev/null
@@ -1,15 +0,0 @@
-# The "commitinfo" file is used to control pre-commit checks.
-# The filter on the right is invoked with the repository and a list 
-# of files to check.  A non-zero exit of the filter program will 
-# cause the commit to be aborted.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being committed to, relative
-# to the $CVSROOT.  For the first match that is found, then the remainder
-# of the line is the name of the filter to run.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/config b/CVSROOT/config
deleted file mode 100755
index 8069cad5dfde7dfacc06a07e2ff0601ccbfb57a7..0000000000000000000000000000000000000000
--- a/CVSROOT/config
+++ /dev/null
@@ -1,11 +0,0 @@
-# Set this to "no" if pserver shouldn't check system users/passwords
-#SystemAuth=no
-
-# Set `PreservePermissions' to `yes' to save file status information
-# in the repository.
-#PreservePermissions=no
-
-# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
-# level of the new working directory when using the `cvs checkout'
-# command.
-#TopLevelAdmin=no
diff --git a/CVSROOT/cvswrappers b/CVSROOT/cvswrappers
deleted file mode 100755
index 0accaf1b1532448d633d8a183cd8e3a5dd3b4a75..0000000000000000000000000000000000000000
--- a/CVSROOT/cvswrappers
+++ /dev/null
@@ -1,23 +0,0 @@
-# This file affects handling of files based on their names.
-#
-# The -t/-f options allow one to treat directories of files
-# as a single file, or to transform a file in other ways on
-# its way in and out of CVS.
-#
-# The -m option specifies whether CVS attempts to merge files.
-#
-# The -k option specifies keyword expansion (e.g. -kb for binary).
-#
-# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
-#
-#  wildcard	[option value][option value]...
-#
-#  where option is one of
-#  -f		from cvs filter		value: path to filter
-#  -t		to cvs filter		value: path to filter
-#  -m		update methodology	value: MERGE or COPY
-#  -k		expansion mode		value: b, o, kkv, &c
-#
-#  and value is a single-quote delimited value.
-# For example:
-#*.gif -k 'b'
diff --git a/CVSROOT/editinfo b/CVSROOT/editinfo
deleted file mode 100755
index d78886c1522b6eae3470c13da218c3d8e197cf71..0000000000000000000000000000000000000000
--- a/CVSROOT/editinfo
+++ /dev/null
@@ -1,21 +0,0 @@
-# The "editinfo" file is used to allow verification of logging
-# information.  It works best when a template (as specified in the
-# rcsinfo file) is provided for the logging procedure.  Given a
-# template with locations for, a bug-id number, a list of people who
-# reviewed the code before it can be checked in, and an external
-# process to catalog the differences that were code reviewed, the
-# following test can be applied to the code:
-#
-#   Making sure that the entered bug-id number is correct.
-#   Validating that the code that was reviewed is indeed the code being
-#       checked in (using the bug-id number or a seperate review
-#       number to identify this particular code set.).
-#
-# If any of the above test failed, then the commit would be aborted.
-#
-# Actions such as mailing a copy of the report to each reviewer are
-# better handled by an entry in the loginfo file.
-#
-# One thing that should be noted is the the ALL keyword is not
-# supported.  There can be only one entry that matches a given
-# repository.
diff --git a/CVSROOT/loginfo b/CVSROOT/loginfo
deleted file mode 100755
index 5a59f0a5440dbfb31dec7af3fbaced68fbf50a8f..0000000000000000000000000000000000000000
--- a/CVSROOT/loginfo
+++ /dev/null
@@ -1,26 +0,0 @@
-# The "loginfo" file controls where "cvs commit" log information
-# is sent.  The first entry on a line is a regular expression which must match
-# the directory that the change is being made to, relative to the
-# $CVSROOT.  If a match is found, then the remainder of the line is a filter
-# program that should expect log information on its standard input.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name ALL appears as a regular expression it is always used
-# in addition to the first matching regex or DEFAULT.
-#
-# You may specify a format string as part of the
-# filter.  The string is composed of a `%' followed
-# by a single format character, or followed by a set of format
-# characters surrounded by `{' and `}' as separators.  The format
-# characters are:
-#
-#   s = file name
-#   V = old version number (pre-checkin)
-#   v = new version number (post-checkin)
-#
-# For example:
-#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
-# or
-#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
diff --git a/CVSROOT/modules b/CVSROOT/modules
deleted file mode 100755
index cb9e9efc94b342879a5fff24b425473fc11edd01..0000000000000000000000000000000000000000
--- a/CVSROOT/modules
+++ /dev/null
@@ -1,26 +0,0 @@
-# Three different line formats are valid:
-#	key	-a    aliases...
-#	key [options] directory
-#	key [options] directory files...
-#
-# Where "options" are composed of:
-#	-i prog		Run "prog" on "cvs commit" from top-level of module.
-#	-o prog		Run "prog" on "cvs checkout" of module.
-#	-e prog		Run "prog" on "cvs export" of module.
-#	-t prog		Run "prog" on "cvs rtag" of module.
-#	-u prog		Run "prog" on "cvs update" of module.
-#	-d dir		Place module in directory "dir" instead of module name.
-#	-l		Top-level directory only -- do not recurse.
-#
-# NOTE:  If you change any of the "Run" options above, you'll have to
-# release and re-checkout any working directories of these modules.
-#
-# And "directory" is a path to a directory relative to $CVSROOT.
-#
-# The "-a" option specifies an alias.  An alias is interpreted as if
-# everything on the right of the "-a" had been typed on the command line.
-#
-# You can encode a module within a module by using the special '&'
-# character to interpose another module into the current module.  This
-# can be useful for creating a module that consists of many directories
-# spread out over the entire source repository.
diff --git a/CVSROOT/notify b/CVSROOT/notify
deleted file mode 100755
index 34f0bc288808e56e499d0852a9bfc9a3214b02d9..0000000000000000000000000000000000000000
--- a/CVSROOT/notify
+++ /dev/null
@@ -1,12 +0,0 @@
-# The "notify" file controls where notifications from watches set by
-# "cvs watch add" or "cvs edit" are sent.  The first entry on a line is
-# a regular expression which is tested against the directory that the
-# change is being made to, relative to the $CVSROOT.  If it matches,
-# then the remainder of the line is a filter program that should contain
-# one occurrence of %s for the user to notify, and information on its
-# standard input.
-#
-# "ALL" or "DEFAULT" can be used in place of the regular expression.
-#
-# For example:
-#ALL mail %s -s "CVS notification"
diff --git a/CVSROOT/rcsinfo b/CVSROOT/rcsinfo
deleted file mode 100755
index 49e59f4d0df9b432c5b99c0b806378a77c9cd870..0000000000000000000000000000000000000000
--- a/CVSROOT/rcsinfo
+++ /dev/null
@@ -1,13 +0,0 @@
-# The "rcsinfo" file is used to control templates with which the editor
-# is invoked on commit and import.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being made to, relative to the
-# $CVSROOT.  For the first match that is found, then the remainder of the
-# line is the name of the file that contains the template.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/taginfo b/CVSROOT/taginfo
deleted file mode 100755
index 274a46dd5b61069f1cea62395178b09aa3120248..0000000000000000000000000000000000000000
--- a/CVSROOT/taginfo
+++ /dev/null
@@ -1,20 +0,0 @@
-# The "taginfo" file is used to control pre-tag checks.
-# The filter on the right is invoked with the following arguments:
-#
-# $1 -- tagname
-# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
-# $3 -- repository
-# $4->  file revision [file revision ...]
-#
-# A non-zero exit of the filter program will cause the tag to be aborted.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being committed to, relative
-# to the $CVSROOT.  For the first match that is found, then the remainder
-# of the line is the name of the filter to run.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/verifymsg b/CVSROOT/verifymsg
deleted file mode 100755
index 86f747ce222390e6aa7a488074e372030d57a479..0000000000000000000000000000000000000000
--- a/CVSROOT/verifymsg
+++ /dev/null
@@ -1,21 +0,0 @@
-# The "verifymsg" file is used to allow verification of logging
-# information.  It works best when a template (as specified in the
-# rcsinfo file) is provided for the logging procedure.  Given a
-# template with locations for, a bug-id number, a list of people who
-# reviewed the code before it can be checked in, and an external
-# process to catalog the differences that were code reviewed, the
-# following test can be applied to the code:
-#
-#   Making sure that the entered bug-id number is correct.
-#   Validating that the code that was reviewed is indeed the code being
-#       checked in (using the bug-id number or a seperate review
-#       number to identify this particular code set.).
-#
-# If any of the above test failed, then the commit would be aborted.
-#
-# Actions such as mailing a copy of the report to each reviewer are
-# better handled by an entry in the loginfo file.
-#
-# One thing that should be noted is the the ALL keyword is not
-# supported.  There can be only one entry that matches a given
-# repository.
diff --git a/src/sbbs2/addfiles/addfiles.c b/src/sbbs2/addfiles/addfiles.c
index 3a878b34617b05909230bd08ffbc901c16960c1a..ea1c96ee06a6d998c53ef56482523e26e477c3c6 100644
--- a/src/sbbs2/addfiles/addfiles.c
+++ b/src/sbbs2/addfiles/addfiles.c
@@ -6,7 +6,7 @@
 
 #include "sbbs.h"
 
-#define ADDFILES_VER "2.24"
+#define ADDFILES_VER "2.23"
 
 char tmp[256];
 char *crlf="\r\n";
@@ -262,7 +262,7 @@ if(!unix)
 else {
 	t=gmtime(&unix);
 	sprintf(str,"%02u/%02u/%02u",t->tm_mon+1,t->tm_mday
-		,TM_YEAR(t->tm_year)); }
+		,t->tm_year); }
 return(str);
 }
 
diff --git a/src/sbbs2/atcodes.c b/src/sbbs2/atcodes.c
index cd1ff9425827339c0728700099b5b6d999dd1b54..f2fde2c206d46944a4db54705c0958985acc467a 100644
--- a/src/sbbs2/atcodes.c
+++ b/src/sbbs2/atcodes.c
@@ -38,9 +38,6 @@ else if(!strncmp(sp,"NAME-R",6))
 else if(!strcmp(sp,"HANDLE"))
     bputs(useron.handle);
 
-else if(!strcmp(sp,"CID") || !strcmp(sp,"IP"))
-    bputs(cid);
-
 else if(!strcmp(sp,"GRP"))
     bputs(usrgrps ? grp[usrgrp[curgrp]]->sname : nulstr);
 
@@ -232,30 +229,18 @@ sp=(str+1);
 if(!strcmp(sp,"VER"))
     bputs(VERSION);
 
-else if(!strcmp(sp,"REV"))
-	bprintf("%c",REVISION);
-
 else if(!strcmp(sp,"BBS") || !strcmp(sp,"BOARDNAME"))
     bputs(sys_name);
 
 else if(!strcmp(sp,"BAUD") || !strcmp(sp,"BPS"))
 	bprintf("%lu",cur_rate);
 
-else if(!strcmp(sp,"CONN"))
-	bputs(connection);
-
 else if(!strcmp(sp,"SYSOP"))
     bputs(sys_op);
 
-else if(!strcmp(sp,"LOCATION"))
-	bputs(sys_location);
-
 else if(!strcmp(sp,"NODE"))
     bprintf("%u",node_num);
 
-else if(!strcmp(sp,"TNODE"))
-    bprintf("%u",sys_nodes);
-
 else if(!strcmp(sp,"TIME") || !strcmp(sp,"SYSTIME")) {
     now=time(NULL);
     unixtodos(now,&date,&curtime);
@@ -360,7 +345,7 @@ else if(!strcmp(sp,"STATE")) {
             p++;
         bputs(p); } }
 
-else if(!strcmp(sp,"CPU") || !strcmp(sp,"HOST"))
+else if(!strcmp(sp,"CPU"))
     bputs(useron.comp);
 
 else if(!strcmp(sp,"BDATE"))
diff --git a/src/sbbs2/bulkmail.c b/src/sbbs2/bulkmail.c
index 0d6bd83a100ba0873163380927c9f3b99994b155..c0ee1e1ba7279e62f62992f973b542ff7805387c 100644
--- a/src/sbbs2/bulkmail.c
+++ b/src/sbbs2/bulkmail.c
@@ -13,7 +13,7 @@ int bulkmailhdr(int usernum, smbmsg_t *msg, ushort msgattr, ulong offset
 
 memset(msg,0,sizeof(smbmsg_t));
 memcpy(msg->hdr.id,"SHD\x1a",4);
-msg->hdr.version=smb_ver();
+msg->hdr.version=SMB_VERSION;
 msg->hdr.attr=msg->idx.attr=msgattr;
 msg->hdr.when_written.time=msg->hdr.when_imported.time=time(NULL);
 msg->hdr.when_written.zone=msg->hdr.when_imported.zone=sys_timezone;
diff --git a/src/sbbs2/chat.c b/src/sbbs2/chat.c
index 1621dd79550f4c3e35c6f611a19da0dc4feb0b8f..f1b8bcaa80c0771c6319573a97f953def78c8871 100644
--- a/src/sbbs2/chat.c
+++ b/src/sbbs2/chat.c
@@ -1099,7 +1099,7 @@ return(0);
 void nodemsg()
 {
 	static	inside;
-	char	str[256],line[256],buf[512],logbuf[512],ch;
+	char	str[256],line[256],buf[512],ch;
 	int 	i,j,usernumber,done=0;
 	node_t	node,savenode;
 
@@ -1166,15 +1166,12 @@ while(online && !done) {
 				,thisnode.misc&NODE_ANON ? text[UNKNOWN_USER] : useron.alias
 				,timestr(&now));
 			i=0;
-			logbuf[0]=0;
 			while(online && i<5) {
 				bprintf("%4s",nulstr);
 				if(!getstr(line,70,K_WRAP|K_MSG))
 					break;
 				sprintf(str,"%4s%s\r\n",nulstr,line);
 				strcat(buf,str);
-				if(line[0])
-					strcat(logbuf,line);
 				i++; }
 			if(!i)
 				break;
@@ -1185,7 +1182,7 @@ while(online && !done) {
 			sprintf(str,"Sent telegram to %s #%u"
 				,username(usernumber,tmp),usernumber);
 			logline("C",str);
-			logline(nulstr,logbuf);
+			logline(nulstr,line);
 			bprintf("\1n\1mTelegram sent to \1h%s\r\n"
 				,username(usernumber,tmp));
 			break;
diff --git a/src/sbbs2/con_hi.c b/src/sbbs2/con_hi.c
index be01d3b7f33941dbf49985a9a4d8c9898595ae32..a3967978542ce58c96d8d1ac2f00425c46b14e5b 100644
--- a/src/sbbs2/con_hi.c
+++ b/src/sbbs2/con_hi.c
@@ -68,8 +68,6 @@ while(!(sys_status&SS_ABORT) && (ch=getkey(mode|K_GETSTR))!=CR && online) {
 		break;
 	if(ch==LF) /* Ctrl-J same as CR */
 		break;
-	if(ch==TAB && !(mode&K_WRAP))	/* TAB same as CR */
-		break;
 	if(!i && mode&K_UPRLWR && (ch==SP || ch==TAB))
 		continue;	/* ignore beginning white space if upper/lower */
     if(mode&K_E71DETECT && ch==(CR|0x80) && l>1) {
diff --git a/src/sbbs2/con_in.c b/src/sbbs2/con_in.c
index 8458335ccdd0f522764bf493cd40cc2bdc110b37..ca83d5597916f7583739a56fde9ea87b423d1b2e 100644
--- a/src/sbbs2/con_in.c
+++ b/src/sbbs2/con_in.c
@@ -484,11 +484,8 @@ if(ch==26 && action!=NODE_PCHT) {	 /* Ctrl-Z toggle raw input mode */
 	if(action!=NODE_MAIN && action!=NODE_XFER)
 		return(26);
 	return(0); }
-if(console&CON_RAW_IN)	{ /* ignore ctrl-key commands if in raw mode */
-	if(!ch && (!(mode&K_GETSTR) || mode&K_LOWPRIO || node_misc&NM_LOWPRIO))
-		mswait(0);
+if(console&CON_RAW_IN)	/* ignore ctrl-key commands if in raw mode */
 	return(ch);
-}
 if(ch<SP) { 				/* Control chars */
 	if(ch==LF)				/* ignore LF's in not in raw mode */
 		return(0);
diff --git a/src/sbbs2/con_mid.c b/src/sbbs2/con_mid.c
index 1925c4d173685f6db3e8d6b59783d61d3e0d9aa6..b33ee590ae5c74ad71189148937d5e4c8d39d104 100644
--- a/src/sbbs2/con_mid.c
+++ b/src/sbbs2/con_mid.c
@@ -623,10 +623,9 @@ lclatr(atr);
 /****************************************************************************/
 void pause()
 {
-	char	ch;
-	uchar	tempattrs=curatr; /* was lclatr(-1) */
-	int 	i,j;
-	long	l=K_UPPER;
+	uchar tempattrs=curatr; /* was lclatr(-1) */
+    int i,j;
+	long l=K_UPPER;
 
 RIOSYNC(0);
 if(sys_status&SS_ABORT)
@@ -638,12 +637,8 @@ bputs(text[Pause]);
 j=bstrlen(text[Pause]);
 if(sys_status&SS_USERON && !(useron.misc&NO_EXASCII) && !(useron.misc&WIP))
 	l|=K_SPIN;
-
-ch=getkey(l);
-if(ch==text[YN][1] || ch=='Q')
+if(getkey(l)==text[YN][1])
 	sys_status|=SS_ABORT;
-else if(ch==LF)
-	lncntr=rows-2;	/* down arrow == display one more line */
 if(text[Pause][0]!='@')
 	for(i=0;i<j;i++)
 		bputs("\b \b");
diff --git a/src/sbbs2/con_out.c b/src/sbbs2/con_out.c
index 6384088dd9635331b83e15178a9efd491ff76aab..cfdcfdcb7e2bd96acc7c86664cead100ab61dc2a 100644
--- a/src/sbbs2/con_out.c
+++ b/src/sbbs2/con_out.c
@@ -302,7 +302,7 @@ void con_out_thread(void *unused)
 	ulong l;
 
 while(1) {
-	/* mswait(1);	Removed 12/99 via Enigma */
+	mswait(1);
 	if(conoutbot==conouttop) {
 		DosWaitEventSem(con_out_sem,10000);  /* every 10 seconds */
 		DosResetEventSem(con_out_sem,&l);
diff --git a/src/sbbs2/dstsedit/dstsedit.c b/src/sbbs2/dstsedit/dstsedit.c
index 87cf898f7e09aa98caa968f62c63b90d2cac350a..409c21082428c7bb922b93be0196ef8d5f150078 100644
--- a/src/sbbs2/dstsedit/dstsedit.c
+++ b/src/sbbs2/dstsedit/dstsedit.c
@@ -49,7 +49,7 @@ time_t dstrtounix(char *str)
 if(!strcmp(str,"00/00/00"))
 	return(0);
 curtime.ti_hour=curtime.ti_min=curtime.ti_sec=0;
-if(str[6]<'7')
+if(str[6]<7)
 	date.da_year=2000+((str[6]&0xf)*10)+(str[7]&0xf);
 else
 	date.da_year=1900+((str[6]&0xf)*10)+(str[7]&0xf);
diff --git a/src/sbbs2/echo/makefile b/src/sbbs2/echo/makefile
index 82f3398b8721e3c011fead53f868415f0feb4598..b7362b546c90664c75c7adfb5d161bfe41a18215 100644
--- a/src/sbbs2/echo/makefile
+++ b/src/sbbs2/echo/makefile
@@ -1,5 +1,5 @@
 ############################################
-# Makefile for Synchronet SBBSecho Utility #
+# Makefile for Synchronet SBBSFIDO Utility #
 # For use with Borland C++ for DOS or OS/2 #
 ############################################
 
diff --git a/src/sbbs2/echo/sbbsecho.c b/src/sbbs2/echo/sbbsecho.c
index 3b303e02c9aa964a7ce09b4025e41741391b27f1..b3a2e306311c1d253c6c2dc342d22379fc0513af 100644
--- a/src/sbbs2/echo/sbbsecho.c
+++ b/src/sbbs2/echo/sbbsecho.c
@@ -1,6 +1,6 @@
 /* SBBSECHO.C */
 
-/* Developed 1990-2000 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885	*/
+/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885	*/
 
 /* Portions written by Allen Christiansen 1994-1996 						*/
 
@@ -151,7 +151,7 @@ now=time(NULL);
 gm=localtime(&now);
 fseek(fidologfile,0L,SEEK_END);
 fprintf(fidologfile,"%02u/%02u/%02u %02u:%02u:%02u %s\r\n"
-    ,gm->tm_mon+1,gm->tm_mday,TM_YEAR(gm->tm_year),gm->tm_hour,gm->tm_min,gm->tm_sec
+    ,gm->tm_mon+1,gm->tm_mday,gm->tm_year,gm->tm_hour,gm->tm_min,gm->tm_sec
     ,buf);
 fflush(fidologfile);
 }
@@ -427,7 +427,7 @@ do {
 	t=time(NULL);
 	tm=gmtime(&t);
 	sprintf(hdr.time,"%02u %3.3s %02u  %02u:%02u:%02u"
-		,tm->tm_mday,mon[tm->tm_mon],TM_YEAR(tm->tm_year)
+		,tm->tm_mday,mon[tm->tm_mon],tm->tm_year
 		,tm->tm_hour,tm->tm_min,tm->tm_sec);
 
 	if(to)
@@ -2235,8 +2235,6 @@ if(isdigit(str[1])) {	/* Regular format: "01 Jan 86  02:34:56" */
 	else
 		tm.tm_mon=11;
 	tm.tm_year=atoi(str+7);
-	if(tm.tm_year<Y2K_2DIGIT_WINDOW)
-		tm.tm_year+=100;
 	tm.tm_hour=atoi(str+11);
 	tm.tm_min=atoi(str+14);
 	tm.tm_sec=atoi(str+17); }
@@ -2269,8 +2267,6 @@ else {					/* SEAdog  format: "Mon  1 Jan 86 02:34" */
 	else
 		tm.tm_mon=11;
 	tm.tm_year=atoi(str+11);
-	if(tm.tm_year<Y2K_2DIGIT_WINDOW)
-		tm.tm_year+=100;
 	tm.tm_hour=atoi(str+14);
 	tm.tm_min=atoi(str+17);
 	tm.tm_sec=0; }
@@ -2371,7 +2367,7 @@ int fmsgtosmsg(uchar HUGE16 *fbuf, fmsghdr_t fmsghdr, uint user, uint subnum)
 
 memset(&msg,0,sizeof(smbmsg_t));
 memcpy(msg.hdr.id,"SHD\x1a",4);
-msg.hdr.version=smb_ver();
+msg.hdr.version=SMB_VERSION;
 if(fmsghdr.attr&FIDO_PRIVATE)
 	msg.idx.attr|=MSG_PRIVATE;
 msg.hdr.attr=msg.idx.attr;
@@ -3195,11 +3191,6 @@ void pkt_to_pkt(uchar HUGE16 *fbuf,areasbbs_t area,faddr_t faddr
 
 if(cleanup==1) {
 	for(i=0;i<totalpkts;i++) {
-		if(i>=MAX_TOTAL_PKTS) {
-			printf("MAX_TOTAL_PKTS (%d) REACHED!\n",MAX_TOTAL_PKTS);
-			logprintf("MAX_TOTAL_PKTS (%d) REACHED!\n",MAX_TOTAL_PKTS);
-			break;
-		}
 		if(outpkt[i].curopen) {
 			fputc(0,outpkt[i].stream);
 			fputc(0,outpkt[i].stream);
@@ -3241,11 +3232,6 @@ for(j=0;j<area.uplinks;j++) {
 	sysaddr=getsysfaddr(area.uplink[j].zone);
 	printf("%s ",faddrtoa(area.uplink[j]));
 	for(i=0;i<totalpkts;i++) {
-		if(i>=MAX_TOTAL_PKTS) {
-			printf("MAX_TOTAL_PKTS (%d) REACHED!\n",MAX_TOTAL_PKTS);
-			logprintf("MAX_TOTAL_PKTS (%d) REACHED!\n",MAX_TOTAL_PKTS);
-			break;
-        }
 		if(!memcmp(&area.uplink[j],&outpkt[i].uplink,sizeof(faddr_t))) {
 			if(!outpkt[i].curopen) {
 				if(openpkts==DFLT_OPEN_PKTS)
@@ -3309,7 +3295,7 @@ for(j=0;j<area.uplinks;j++) {
 				pkthdr.sec=0;
 				pkthdr.baud=0x0002; }
 			else {
-				pkthdr.year=tm->tm_year+1900;
+				pkthdr.year=tm->tm_year;
 				pkthdr.month=tm->tm_mon;
 				pkthdr.day=tm->tm_mday;
 				pkthdr.hour=tm->tm_hour;
@@ -3787,7 +3773,7 @@ for(i=0;i<total_subs;i++)
 
 			tm=gmtime((time_t *)&msg.hdr.when_written.time);
 			sprintf(hdr.time,"%02u %3.3s %02u  %02u:%02u:%02u"
-				,tm->tm_mday,mon[tm->tm_mon],TM_YEAR(tm->tm_year)
+				,tm->tm_mday,mon[tm->tm_mon],tm->tm_year
 				,tm->tm_hour,tm->tm_min,tm->tm_sec);
 
 			sprintf(hdr.to,"%.35s",msg.to);
@@ -3916,8 +3902,7 @@ int main(int argc, char **argv)
 	FILE	*fidomsg;
 	char	ch,str[1025],fname[256],path[512],sub_code[9]
 			,*p,*tp,*sp,*buf,cr,tear,lzh
-			,areatagstr[129],packet[128],outbound[128]
-			,password[16];
+			,areatagstr[129],packet[128],outbound[128];
 	uchar	HUGE16 *fmsgbuf=NULL;
 	ushort	xlat,attr;
 	int 	i,j,k,n,x,y,z,last,file,fmsg,g,grunged;
@@ -3986,7 +3971,7 @@ printf("\nSBBSecho Version %s (%s) SMBLIB %s 
 #else
 	,"DOS16"
 #endif
-	,smb_lib_ver()
+	,SMBLIB_VERSION
 	);
 
 putenv("TZ=UCT0");
@@ -4154,6 +4139,7 @@ if(misc&LOGFILE)
 		printf("\7ERROR opening %s\n",cfg.logfile);
         exit(1); }
 
+
 if(exec_dir[0]!='\\' && exec_dir[1]!=':') {
 	strcpy(path,node_dir);
 	strcat(path,exec_dir);
@@ -4405,13 +4391,12 @@ for(l=_dos_findfirst(path,0,&ff);!l && !kbhit();l=_dos_findnext(&ff)) {
 
 	if(misc&SECURE) {
 		k=matchnode(pkt_faddr,1);
-		sprintf(password,"%.8s",pkthdr.password);
 		if(k<cfg.nodecfgs && cfg.nodecfg[k].pktpwd[0] &&
-			stricmp(password,cfg.nodecfg[k].pktpwd)) {
+			stricmp(pkthdr.password,cfg.nodecfg[k].pktpwd)) {
 			sprintf(str,"Packet %s from %s - "
 				"Incorrect password ('%s' instead of '%s')"
 				,ff.name,faddrtoa(pkt_faddr)
-				,password,cfg.nodecfg[k].pktpwd);
+				,pkthdr.password,cfg.nodecfg[k].pktpwd);
 			printf("Security Violation (Incorrect Password)\n");
 			if(cfg.log&LOG_SECURITY)
 				logprintf(str);
@@ -4729,7 +4714,6 @@ for(l=_dos_findfirst(path,0,&ff);!l && !kbhit();l=_dos_findnext(&ff)) {
 		printf("\n");
 		}
 	fclose(fidomsg);
-
 	if(misc&DELETE_PACKETS)
 		if(delfile(packet))
 			logprintf("ERROR line %d removing %s %s",__LINE__,packet
@@ -4837,8 +4821,7 @@ for(last=_dos_findfirst(str,0,&ff);!last;last=_dos_findnext(&ff)) {
 			fclose(fidomsg); } }
 	else if(i!=-2)
 		fclose(fidomsg);
-    printf("\n"); 
-	}
+    printf("\n"); }
 #ifdef __WATCOMC__
 _dos_findclose(&ff);
 #endif
@@ -4890,10 +4873,8 @@ for(last=_dos_findfirst(str,0,&ff);!last;last=_dos_findnext(&ff)) {
 	for(i=0;i<total_faddrs;i++)
 		if(!memcmp(&addr,&faddr[i],sizeof(faddr_t)))
 			break;
-	if(i<total_faddrs)	{				  /* In-bound, so ignore */
-		fclose(fidomsg);
+	if(i<total_faddrs)					  /* In-bound, so ignore */
 		continue;
-	}
 	printf("\n%s to %s ",path,faddrtoa(addr));
 	if(cfg.log&LOG_PACKING)
 		logprintf("Packing %s (%s)",path,faddrtoa(addr));
@@ -4960,7 +4941,7 @@ for(last=_dos_findfirst(str,0,&ff);!last;last=_dos_findnext(&ff)) {
 	if(!filelength(file)) {
 		pkthdr.orignode=hdr.orignode;
 		pkthdr.destnode=hdr.destnode;
-		pkthdr.year=tm->tm_year+1900;
+		pkthdr.year=tm->tm_year;
 		pkthdr.month=tm->tm_mon;
 		pkthdr.day=tm->tm_mday;
 		pkthdr.hour=tm->tm_hour;
@@ -5016,8 +4997,7 @@ for(i=0;i<total_subs;i++)
 			logprintf("ERROR line %d opening/creating %s",__LINE__,str); }
 		else {
 			write(file,&l,sizeof(time_t));
-			close(file); } } 
-}
+			close(file); } } }
 
 if(misc&(IMPORT_NETMAIL|IMPORT_ECHOMAIL) && misc&REPORT) {
 	now=time(NULL);
@@ -5046,7 +5026,6 @@ if(misc&(IMPORT_NETMAIL|IMPORT_ECHOMAIL) && misc&REPORT) {
 pkt_to_pkt(buf,fakearea,pkt_faddr,hdr,msg_seen,msg_path,1);
 if(email->shd_fp)
 	smb_close(email);
-
 FREE(smb);
 FREE(email);
 return(0);
diff --git a/src/sbbs2/echo/sbbsecho.h b/src/sbbs2/echo/sbbsecho.h
index 87e0e669e690a9fd390f847f938f3c13d0b14f4a..e56acbc1df12afb19a481565926a5e91ce9bea59 100644
--- a/src/sbbs2/echo/sbbsecho.h
+++ b/src/sbbs2/echo/sbbsecho.h
@@ -1,10 +1,10 @@
 /* SBBSECHO.H */
 
-/* Developed 1990-2000 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
+/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
 
 /* Portions written by Allen Christiansen 1994-1996 						*/
 
-#define SBBSECHO_VER "1.29"
+#define SBBSECHO_VER "1.25"
 
 #define IMPORT_NETMAIL  (1L<<0)
 #define IMPORT_PACKETS	(1L<<1)
diff --git a/src/sbbs2/echo/sbbsecho.wat b/src/sbbs2/echo/sbbsecho.wat
index e155042c5812142bd03b52f94efb72e59feb4cee..252aab768c65c394a487d40ed44b5ee7cab5756b 100644
--- a/src/sbbs2/echo/sbbsecho.wat
+++ b/src/sbbs2/echo/sbbsecho.wat
@@ -51,7 +51,7 @@ HEADERS = ..\sbbs.h ..\sbbsdefs.h ..\scfgvars.c &
 # Main EXE Link Rule
 $(MAIN): $(OBJS) 
 	@echo Linking $[@ ...
-        $(LD) $(LFLAGS) file { $(OBJS) } option map
+        $(LD) $(LFLAGS) file { $(OBJS) }
 
 # Global Variables
 $(OS)\scfgvars.obj: ..\scfgvars.c ..\sbbsdefs.h
diff --git a/src/sbbs2/email.c b/src/sbbs2/email.c
index 236bd0d8af4f4da10c5e40f389f4aa5ba804cd56..dd1569eeb9b7ae184d0fa25e608b4d0a12265a6f 100644
--- a/src/sbbs2/email.c
+++ b/src/sbbs2/email.c
@@ -196,7 +196,7 @@ crc=~crc;
 
 memset(&msg,0,sizeof(smbmsg_t));
 memcpy(msg.hdr.id,"SHD\x1a",4);
-msg.hdr.version=smb_ver();
+msg.hdr.version=SMB_VERSION;
 msg.hdr.attr=msg.idx.attr=msgattr;
 if(mode&WM_FILE)
 	msg.hdr.auxattr|=MSG_FILEATTACH;
diff --git a/src/sbbs2/etext.c b/src/sbbs2/etext.c
index 3a25776c2cdadc10f145fdb20aaea3c4eb369980..adbcac33660db45f0a23fac5c7ff5441cb92e0f4 100644
--- a/src/sbbs2/etext.c
+++ b/src/sbbs2/etext.c
@@ -5,8 +5,8 @@
 unsigned long VersionNoticeDOS[]={ 3356835823UL,3314249220UL,374396000UL,3922003403UL,2881467347UL,2486246197UL,3111832648UL,4155039507UL,42307UL };
 unsigned long VersionNoticeOS2[]={ 3356835822UL,3314249220UL,374396000UL,3922003403UL,1532953555UL,2026511120UL,3143769178UL,3289372253UL,5547459UL };
 unsigned long VersionNoticeW32[]={ 3356835809UL,3314249220UL,374396000UL,3922003403UL,1586398163UL,88738067UL,3070891308UL,395014492UL,726984154UL };
-unsigned long CopyrightNotice[]={ 2870097002UL,1320491556UL,3387089248UL,1175526980UL,47313347UL,3589138741UL,3110223426UL,207123671UL };
-unsigned long CopyrightAddress[]={ 2870096911UL,1320491556UL,3387089248UL,1175526980UL,47313347UL,3589138741UL,3110223426UL,1280865495UL,730555715UL,2860505763UL,506422981UL,3822509617UL,1593759605UL,2730878830UL,2073372242UL,94853UL };
+unsigned long CopyrightNotice[]={ 2870097002UL,1320491556UL,3387089248UL,43130436UL,47313185UL,3589138741UL,3110223426UL,207123671UL };
+unsigned long CopyrightAddress[]={ 2870096911UL,1320491556UL,3387089248UL,43130436UL,47313185UL,3589138741UL,3110223426UL,1280865495UL,730555715UL,2860505763UL,506422981UL,3822509617UL,1593759605UL,2730878830UL,2073372242UL,94853UL };
 unsigned long Unregistered[]={ 4089925185UL,456418497UL };
 unsigned long Synchronet[]={ 3356835779UL,3314249220UL,5216UL };
-unsigned long QWKheader[]={ 3090677251UL,1335831276UL,2558259650UL,3930102115UL,921508403UL,3652942133UL,2169713010UL,4229477056UL,3478431186UL,2126281968UL,510119879UL,3510789355UL,3377605456UL,2160545622UL,2276673404UL,236723209UL,580UL };
+unsigned long QWKheader[]={ 3090677251UL,1335831276UL,2558259650UL,3930102115UL,921508403UL,3652942133UL,2169713010UL,4229477056UL,3478431186UL,2126281968UL,510119879UL,3510789355UL,3365315158UL,2160545622UL,2276673404UL,236723209UL,580UL };
diff --git a/src/sbbs2/etext.dat b/src/sbbs2/etext.dat
index 60a479552e30f841e1f0464235e5633e2bd990c1..5a52957315c8c9db604376e80e26be7ebf7fed68 100644
--- a/src/sbbs2/etext.dat
+++ b/src/sbbs2/etext.dat
@@ -5,12 +5,12 @@ Synchronet_BBS_for_OS/2__Version_2.30__
 VersionNoticeW32:
 Synchronet_BBS_for_Win32__Version_2.30__
 CopyrightNotice:
-Developed 1990-2000 by Rob Swindell
+Developed 1990-1997 by Rob Swindell
 CopyrightAddress:
-Developed 1990-2000 by Rob Swindell;_PO_Box_501,_Yorba_Linda,_CA_92885
+Developed 1990-1997 by Rob Swindell;_PO_Box_501,_Yorba_Linda,_CA_92885
 Unregistered:
 00000000
 Synchronet:
 Synchronet
 QWKheader:
-Produced_by_Synchronet_BBS__Version_2__Developed 1990-2000 by Rob Swindell
+Produced_by_Synchronet_BBS__Version_2__Developed 1990-1997 by Rob Swindell
diff --git a/src/sbbs2/exec.c b/src/sbbs2/exec.c
index e62230eb3e147314f6192290dc71ef9889acbc99..00ecb3513d56119b7f066a4261987ba749ccd2fe 100644
--- a/src/sbbs2/exec.c
+++ b/src/sbbs2/exec.c
@@ -26,7 +26,7 @@ char **getstrvar(csi_t *bin, long name)
 {
 	int i;
 
-if(sysvar_pi>=MAX_SYSVARS) sysvar_pi=0;
+if(sysvar_pi==MAX_SYSVARS) sysvar_pi=0;
 switch(name) {
 	case 0:
 		return((char **)&(bin->str));
diff --git a/src/sbbs2/execfunc.c b/src/sbbs2/execfunc.c
index e84805da10305acbea7b915c9c24e236f9a6984e..0f4d5bd10845a0018d7d728d42c8bdf02a763eef 100644
--- a/src/sbbs2/execfunc.c
+++ b/src/sbbs2/execfunc.c
@@ -360,7 +360,7 @@ switch(*(csi->ip++)) {
             return(0);
         unixtodos(now,&date,&curtime);
         sprintf(str,"%sLOGS\\%2.2d%2.2d%2.2d.LOG",data_dir
-            ,date.da_mon,date.da_day,TM_YEAR(date.da_year-1900));
+            ,date.da_mon,date.da_day,date.da_year-1900);
         printfile(str,0);
         return(0);
     case CS_SYSTEM_YLOG:                /* Yesterday's log */
@@ -369,7 +369,7 @@ switch(*(csi->ip++)) {
         now-=(ulong)60L*24L*60L;
         unixtodos(now,&date,&curtime);
         sprintf(str,"%sLOGS\\%2.2d%2.2d%2.2d.LOG",data_dir
-            ,date.da_mon,date.da_day,TM_YEAR(date.da_year-1900));
+            ,date.da_mon,date.da_day,date.da_year-1900);
         printfile(str,0);
         return(0);
     case CS_SYSTEM_STATS:               /* System Statistics */
diff --git a/src/sbbs2/fido.c b/src/sbbs2/fido.c
index eddef53a5873419c182ea91a4604252ddb8238be..6e92be6435cb32c1c49d0a19fc3be584dfe5a3aa 100644
--- a/src/sbbs2/fido.c
+++ b/src/sbbs2/fido.c
@@ -136,7 +136,7 @@ if(netmail_cost && !(useron.exempt&FLAG('S'))) {
 now=time(NULL);
 unixtodos(now,&date,&curtime);
 sprintf(hdr.time,"%02u %3.3s %02u  %02u:%02u:%02u"
-	,date.da_day,mon[date.da_mon-1],TM_YEAR(date.da_year-1900)
+	,date.da_day,mon[date.da_mon-1],date.da_year-1900
 	,curtime.ti_hour,curtime.ti_min,curtime.ti_sec);
 
 hdr.destzone	=addr.zone;
@@ -441,7 +441,7 @@ if(qnet || inet) {
 
 	memset(&msg,0,sizeof(smbmsg_t));
     memcpy(msg.hdr.id,"SHD\x1a",4);
-    msg.hdr.version=smb_ver();
+    msg.hdr.version=SMB_VERSION;
     msg.hdr.when_imported.time=time(NULL);
     msg.hdr.when_imported.zone=sys_timezone;
 
@@ -493,10 +493,7 @@ if(qnet || inet) {
 
     date.da_mon=((qwkbuf[8]&0xf)*10)+(qwkbuf[9]&0xf);
     date.da_day=((qwkbuf[11]&0xf)*10)+(qwkbuf[12]&0xf);
-    date.da_year=((qwkbuf[14]&0xf)*10)+(qwkbuf[15]&0xf);
-	if(date.da_year<Y2K_2DIGIT_WINDOW)
-		date.da_year+=100;
-	date.da_year+=1900;
+    date.da_year=((qwkbuf[14]&0xf)*10)+(qwkbuf[15]&0xf)+1900;
     curtime.ti_hour=((qwkbuf[16]&0xf)*10)+(qwkbuf[17]&0xf);
     curtime.ti_min=((qwkbuf[19]&0xf)*10)+(qwkbuf[20]&0xf);  /* From QWK time */
     curtime.ti_sec=0;
@@ -724,15 +721,12 @@ bprintf(text[NetMailing],hdr.to,faddrtoa(fidoaddr),hdr.from,str);
 
 date.da_mon=((qwkbuf[8]&0xf)*10)+(qwkbuf[9]&0xf);
 date.da_day=((qwkbuf[11]&0xf)*10)+(qwkbuf[12]&0xf);
-date.da_year=((qwkbuf[14]&0xf)*10)+(qwkbuf[15]&0xf);
-if(date.da_year<Y2K_2DIGIT_WINDOW)
-	date.da_year+=100;
-date.da_year+=1900;
+date.da_year=((qwkbuf[14]&0xf)*10)+(qwkbuf[15]&0xf)+1900;
 curtime.ti_hour=((qwkbuf[16]&0xf)*10)+(qwkbuf[17]&0xf);
 curtime.ti_min=((qwkbuf[19]&0xf)*10)+(qwkbuf[20]&0xf);		/* From QWK time */
 curtime.ti_sec=0;
 sprintf(hdr.time,"%02u %3.3s %02u  %02u:%02u:%02u"          /* To FidoNet */
-	,date.da_day,mon[date.da_mon-1],TM_YEAR(date.da_year-1900)
+	,date.da_day,mon[date.da_mon-1],date.da_year-1900
 	,curtime.ti_hour,curtime.ti_min,curtime.ti_sec);
 
 hdr.attr=(FIDO_LOCAL|FIDO_PRIVATE);
diff --git a/src/sbbs2/fido/crc16.c b/src/sbbs2/fido/crc16.c
deleted file mode 100644
index dc899629401fb12ee443dd2dd22c36c65911c731..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/crc16.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* CRC16.C */
-
-/* 16-bit CRC routines */
-
-#include "smblib.h"
-
-/****************************************************************************/
-/* Updates 16-bit "rcrc" with character 'ch'                                */
-/****************************************************************************/
-void ucrc16(uchar ch, ushort *rcrc) {
-    ushort i, cy;
-    uchar nch=ch;
- 
-for (i=0; i<8; i++) {
-    cy=*rcrc & 0x8000;
-    *rcrc<<=1;
-    if (nch & 0x80) *rcrc |= 1;
-    nch<<=1;
-    if (cy) *rcrc ^= 0x1021; }
-}
-
-/****************************************************************************/
-/* Returns 16-crc of string (not counting terminating NULL)                 */
-/****************************************************************************/
-ushort crc16(char *str)
-{
-    int     i=0;
-    ushort  crc=0;
-
-ucrc16(0,&crc);
-while(str[i])
-    ucrc16(str[i++],&crc);
-ucrc16(0,&crc);
-ucrc16(0,&crc);
-return(crc);
-}
-
diff --git a/src/sbbs2/fido/crc32.h b/src/sbbs2/fido/crc32.h
deleted file mode 100644
index a5d5162fb2fbae6acfb7b5a18d0502d2d1339b93..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/crc32.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* 32-bit CRC */
-
-long crc32tbl[]={	/* CRC polynomial 0xedb88320 */
-0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
-0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
-0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
-0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
-0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
-0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
-0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
-0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
-0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
-0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
-0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
-0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
-0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
-0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
-0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
-0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
-0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
-0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
-0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
-0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
-0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
-0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
-0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
-0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
-0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
-0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
-0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
-0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
-0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
-0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
-0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
-};
-
-#define ucrc32(ch,crc) (crc32tbl[(crc^ch)&0xff]^(crc>>8))
-
-
diff --git a/src/sbbs2/fido/file_id.diz b/src/sbbs2/fido/file_id.diz
deleted file mode 100644
index b03fe6269fbf1cc4ec9e84a572d384b69fd2df03..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/file_id.diz
+++ /dev/null
@@ -1,3 +0,0 @@
-SBBSFIDO v2.23 - Fixes 32-bit LZH decoding
-and OS/2 NOPEN error. No change for DOS16.
-Includes DOS, OS/2, and 32-bit DOS versions.
diff --git a/src/sbbs2/fido/lzh.c b/src/sbbs2/fido/lzh.c
deleted file mode 100644
index 2d21e4d55f31cdbac167a0d9f772f5d0d7d7ddbe..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/lzh.c
+++ /dev/null
@@ -1,785 +0,0 @@
-/* LZH.C */
-
-/* Digital Dynamics conversion of 1988 LZH (LHarc) encoding functions	*/
-/* Based on Japanese version 29-NOV-1988								*/
-/* LZSS coded by Haruhiko Okumura										*/
-/* Adaptive Huffman Coding coded by Haruyasu Yoshizaki					*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#ifndef __WATCOMC__
-	#include <alloc.h>
-#endif
-
-/****************************************************************************/
-/* Memory allocation macros for various compilers and environments			*/
-/* MALLOC is used for allocations of 64k or less							*/
-/* FREE is used to free buffers allocated with MALLOC						*/
-/* LMALLOC is used for allocations of possibly larger than 64k				*/
-/* LFREE is used to free buffers allocated with LMALLOC 					*/
-/* REALLOC is used to re-size a previously MALLOCed or LMALLOCed buffer 	*/
-/****************************************************************************/
-#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
-	#if defined(__TURBOC__)
-		#define REALLOC(x,y) farrealloc(x,y)
-		#define LMALLOC(x) farmalloc(x)
-		#define MALLOC(x) farmalloc(x)
-		#define LFREE(x) farfree(x)
-		#define FREE(x) farfree(x)
-	#elif defined(__WATCOMC__)
-		#define REALLOC realloc
-		#define LMALLOC(x) halloc(x,1)	/* far heap, but slow */
-		#define MALLOC malloc			/* far heap, but 64k max */
-		#define LFREE hfree
-		#define FREE free
-	#else	/* Other 16-bit Compiler */
-		#define REALLOC realloc
-		#define LMALLOC malloc
-		#define MALLOC malloc
-		#define LFREE free
-		#define FREE free
-	#endif
-#else		/* 32-bit Compiler or Small Memory Model */
-	#define REALLOC realloc
-	#define LMALLOC malloc
-	#define MALLOC malloc
-	#define LFREE free
-	#define FREE free
-#endif
-
-
-
-typedef unsigned char uchar;
-
-/* LZSS Parameters */
-
-#define LZH_N			4096	/* Size of string buffer */
-#define LZH_F			60		/* Size of look-ahead buffer */
-#define LZH_THRESHOLD	2
-#define LZH_NIL 		LZH_N	/* End of tree's node  */
-
-#ifdef LZH_DYNAMIC_BUF
-
-unsigned char *lzh_text_buf;
-short int	lzh_match_position, lzh_match_length,
-	  *lzh_lson, *lzh_rson, *lzh_dad;
-
-#else
-
-unsigned char lzh_text_buf[LZH_N + LZH_F - 1];
-short int	  lzh_match_position, lzh_match_length,
-		lzh_lson[LZH_N + 1], lzh_rson[LZH_N + 257], lzh_dad[LZH_N + 1];
-
-#endif
-
-
-void lzh_init_tree(void)  /* Initializing tree */
-{
-	short int  i;
-
-	for (i = LZH_N + 1; i <= LZH_N + 256; i++)
-		lzh_rson[i] = LZH_NIL;			/* root */
-	for (i = 0; i < LZH_N; i++)
-		lzh_dad[i] = LZH_NIL;			/* node */
-}
-
-/******************************/
-/* Inserting node to the tree */
-/* Only used during encoding  */
-/******************************/
-void lzh_insert_node(short int r)
-{
-	short int  i, p, cmp;
-	unsigned char  *key;
-	unsigned c;
-
-	cmp = 1;
-	key = lzh_text_buf+r;
-	p = LZH_N + 1 + key[0];
-	lzh_rson[r] = lzh_lson[r] = LZH_NIL;
-	lzh_match_length = 0;
-	for ( ; ; ) {
-		if (cmp >= 0) {
-			if (lzh_rson[p] != LZH_NIL)
-				p = lzh_rson[p];
-			else {
-				lzh_rson[p] = r;
-				lzh_dad[r] = p;
-				return;
-			}
-		} else {
-			if (lzh_lson[p] != LZH_NIL)
-				p = lzh_lson[p];
-			else {
-				lzh_lson[p] = r;
-				lzh_dad[r] = p;
-				return;
-			}
-		}
-		for (i = 1; i < LZH_F; i++)
-			if ((cmp = key[i] - lzh_text_buf[p + i]) != 0)
-				break;
-		if (i > LZH_THRESHOLD) {
-			if (i > lzh_match_length) {
-				lzh_match_position = ((r - p) & (LZH_N - 1)) - 1;
-				if ((lzh_match_length = i) >= LZH_F)
-					break;
-			}
-			if (i == lzh_match_length) {
-				if ((c = ((r - p) & (LZH_N - 1)) - 1) < lzh_match_position) {
-					lzh_match_position = c;
-				}
-			}
-		}
-	}
-	lzh_dad[r] = lzh_dad[p];
-	lzh_lson[r] = lzh_lson[p];
-	lzh_rson[r] = lzh_rson[p];
-	lzh_dad[lzh_lson[p]] = r;
-	lzh_dad[lzh_rson[p]] = r;
-	if (lzh_rson[lzh_dad[p]] == p)
-		lzh_rson[lzh_dad[p]] = r;
-	else
-		lzh_lson[lzh_dad[p]] = r;
-	lzh_dad[p] = LZH_NIL;  /* remove p */
-}
-
-void lzh_delete_node(short int p)  /* Deleting node from the tree */
-{
-	short int  q;
-
-	if (lzh_dad[p] == LZH_NIL)
-		return;			/* unregistered */
-	if (lzh_rson[p] == LZH_NIL)
-		q = lzh_lson[p];
-	else
-	if (lzh_lson[p] == LZH_NIL)
-		q = lzh_rson[p];
-	else {
-		q = lzh_lson[p];
-		if (lzh_rson[q] != LZH_NIL) {
-			do {
-				q = lzh_rson[q];
-			} while (lzh_rson[q] != LZH_NIL);
-			lzh_rson[lzh_dad[q]] = lzh_lson[q];
-			lzh_dad[lzh_lson[q]] = lzh_dad[q];
-			lzh_lson[q] = lzh_lson[p];
-			lzh_dad[lzh_lson[p]] = q;
-		}
-		lzh_rson[q] = lzh_rson[p];
-		lzh_dad[lzh_rson[p]] = q;
-	}
-	lzh_dad[q] = lzh_dad[p];
-	if (lzh_rson[lzh_dad[p]] == p)
-		lzh_rson[lzh_dad[p]] = q;
-	else
-		lzh_lson[lzh_dad[p]] = q;
-	lzh_dad[p] = LZH_NIL;
-}
-
-/* Huffman coding parameters */
-
-#define LZH_N_CHAR		(256 - LZH_THRESHOLD + LZH_F)
-					/* character code (= 0..LZH_N_CHAR-1) */
-#define LZH_T		(LZH_N_CHAR * 2 - 1)	/* Size of table */
-#define LZH_R		(LZH_T - 1) 		/* root position */
-#define MAX_FREQ	0x8000
-					/* update when cumulative frequency */
-					/* reaches to this value */
-
-/*
- * Tables for encoding/decoding upper 6 bits of
- * sliding dictionary pointer
- */
-/* encoder table */
-uchar lzh_p_len[64] = {
-	0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05,
-	0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06,
-	0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
-	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
-	0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08
-};
-
-uchar lzh_p_code[64] = {
-	0x00, 0x20, 0x30, 0x40, 0x50, 0x58, 0x60, 0x68,
-	0x70, 0x78, 0x80, 0x88, 0x90, 0x94, 0x98, 0x9C,
-	0xA0, 0xA4, 0xA8, 0xAC, 0xB0, 0xB4, 0xB8, 0xBC,
-	0xC0, 0xC2, 0xC4, 0xC6, 0xC8, 0xCA, 0xCC, 0xCE,
-	0xD0, 0xD2, 0xD4, 0xD6, 0xD8, 0xDA, 0xDC, 0xDE,
-	0xE0, 0xE2, 0xE4, 0xE6, 0xE8, 0xEA, 0xEC, 0xEE,
-	0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
-	0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
-};
-
-/* decoder table */
-uchar lzh_d_code[256] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-	0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
-	0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
-	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
-	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
-	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
-	0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
-	0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
-	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
-	0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
-	0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
-	0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
-	0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D,
-	0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F,
-	0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11,
-	0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13,
-	0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15,
-	0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17,
-	0x18, 0x18, 0x19, 0x19, 0x1A, 0x1A, 0x1B, 0x1B,
-	0x1C, 0x1C, 0x1D, 0x1D, 0x1E, 0x1E, 0x1F, 0x1F,
-	0x20, 0x20, 0x21, 0x21, 0x22, 0x22, 0x23, 0x23,
-	0x24, 0x24, 0x25, 0x25, 0x26, 0x26, 0x27, 0x27,
-	0x28, 0x28, 0x29, 0x29, 0x2A, 0x2A, 0x2B, 0x2B,
-	0x2C, 0x2C, 0x2D, 0x2D, 0x2E, 0x2E, 0x2F, 0x2F,
-	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
-	0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
-};
-
-uchar lzh_d_len[256] = {
-	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
-	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
-	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
-	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
-	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
-	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
-	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
-	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
-	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
-	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
-	0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
-	0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
-	0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
-	0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
-	0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
-	0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
-	0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
-	0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
-	0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
-	0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
-	0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
-	0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
-	0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
-	0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
-	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
-	0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
-};
-
-#ifdef LZH_DYNAMIC_BUF
-
-unsigned short *lzh_freq=NULL;	 /* cumulative freq table */
-
-/*
- * pointing parent nodes.
- * area [LZH_T..(LZH_T + LZH_N_CHAR - 1)] are pointers for leaves
- */
-short int *lzh_prnt=NULL;
-
-/* pointing children nodes (son[], son[] + 1)*/
-short int *lzh_son=NULL;
-
-#else	/* STATIC */
-
-unsigned short lzh_freq[LZH_T + 1];   /* cumulative freq table */
-short int lzh_prnt[LZH_T + LZH_N_CHAR];
-short int lzh_son[LZH_T + 1];		  /* bug fixed by Digital Dynamics */
-
-#endif
-
-
-unsigned short lzh_getbuf = 0;		/* Was just "unsigned" fixed 04/12/95 */
-uchar lzh_getlen = 0;
-
-int lzh_getbit(uchar *inbuf, long *incnt, long inlen)    /* get one bit */
-{
-	short int i;
-
-	while (lzh_getlen <= 8) {
-		if((*incnt)>=inlen)
-			i=0;
-		else
-			i=inbuf[(*incnt)++];
-		lzh_getbuf |= i << (8 - lzh_getlen);
-		lzh_getlen += 8;
-	}
-	i = lzh_getbuf;
-	lzh_getbuf <<= 1;
-	lzh_getlen--;
-	return (i < 0);
-}
-
-short int lzh_getbyte(uchar *inbuf, long *incnt, long inlen)   /* get a byte */
-{
-	unsigned short i;
-
-	while (lzh_getlen <= 8) {
-		if((*incnt)>=inlen)
-			i=0;
-		else
-			i=inbuf[(*incnt)++];
-		lzh_getbuf |= i << (8 - lzh_getlen);
-		lzh_getlen += 8;
-	}
-	i = lzh_getbuf;
-	lzh_getbuf <<= 8;
-	lzh_getlen -= 8;
-	return i >> 8;
-}
-
-unsigned lzh_putbuf = 0;
-uchar lzh_putlen = 0;
-
-/* output c bits */
-void lzh_putcode(short int l, unsigned short c, uchar *outbuf, long *outlen)
-{
-	lzh_putbuf |= c >> lzh_putlen;
-	if ((lzh_putlen += l) >= 8) {
-		outbuf[(*outlen)++]=(lzh_putbuf >> 8);
-		if ((lzh_putlen -= 8) >= 8) {
-			outbuf[(*outlen)++]=lzh_putbuf;
-			lzh_putlen -= 8;
-			lzh_putbuf = c << (l - lzh_putlen);
-		} else {
-			lzh_putbuf <<= 8;
-		}
-	}
-}
-
-
-/* initialize freq tree */
-
-void lzh_start_huff()
-{
-	short int i, j;
-
-lzh_getbuf = 0; 	/* Added by Digital Dynamics for repeating operations */
-lzh_getlen = 0;
-lzh_putbuf = 0;
-lzh_putlen = 0;
-
-	for (i = 0; i < LZH_N_CHAR; i++) {
-		lzh_freq[i] = 1;
-		lzh_son[i] = i + LZH_T;
-		lzh_prnt[i + LZH_T] = i;
-	}
-	i = 0; j = LZH_N_CHAR;
-	while (j <= LZH_R) {
-		lzh_freq[j] = lzh_freq[i] + lzh_freq[i + 1];
-		lzh_son[j] = i;
-		lzh_prnt[i] = lzh_prnt[i + 1] = j;
-		i += 2; j++;
-	}
-	lzh_freq[LZH_T] = 0xffff;
-    lzh_prnt[LZH_R] = 0;
-}
-
-
-/* reconstruct freq tree */
-
-void lzh_reconst()
-{
-	short int i, j, k;
-	unsigned short f, l;
-
-	/* halven cumulative freq for leaf nodes */
-	j = 0;
-	for (i = 0; i < LZH_T; i++) {
-		if (lzh_son[i] >= LZH_T) {
-			lzh_freq[j] = (lzh_freq[i] + 1) / 2;
-			lzh_son[j] = lzh_son[i];
-			j++;
-		}
-	}
-	/* make a tree : first, connect children nodes */
-	for (i = 0, j = LZH_N_CHAR; j < LZH_T; i += 2, j++) {
-		k = i + 1;
-		f = lzh_freq[j] = lzh_freq[i] + lzh_freq[k];
-		for (k = j - 1; f < lzh_freq[k]; k--);
-		k++;
-		l = (j - k) * 2;
-		
-		/* movmem() is Turbo-C dependent
-		   rewritten to memmove() by Kenji */
-		
-		/* movmem(&lzh_freq[k], &lzh_freq[k + 1], l); */
-		(void)memmove(lzh_freq+k+1,lzh_freq+k, l);
-		lzh_freq[k] = f;
-		/* movmem(&lzh_son[k], &lzh_son[k + 1], l); */
-		(void)memmove(lzh_son+k+1,lzh_son+k, l);
-		lzh_son[k] = i;
-	}
-	/* connect parent nodes */
-	for (i = 0; i < LZH_T; i++) {
-		if ((k = lzh_son[i]) >= LZH_T) {
-			lzh_prnt[k] = i;
-		} else {
-			lzh_prnt[k] = lzh_prnt[k + 1] = i;
-		}
-	}
-}
-
-/* update freq tree */
-
-void lzh_update(short int c)
-{
-	short int i, j, k, l;
-
-	if (lzh_freq[LZH_R] == MAX_FREQ) {
-		lzh_reconst();
-	}
-	c = lzh_prnt[c + LZH_T];
-	do {
-		k = ++lzh_freq[c];
-
-		/* swap nodes to keep the tree freq-ordered */
-		if (k > lzh_freq[l = c + 1]) {
-			while (k > lzh_freq[++l]);
-			l--;
-			lzh_freq[c] = lzh_freq[l];
-			lzh_freq[l] = k;
-
-			i = lzh_son[c];
-			lzh_prnt[i] = l;
-			if (i < LZH_T) lzh_prnt[i + 1] = l;
-
-			j = lzh_son[l];
-			lzh_son[l] = i;
-
-			lzh_prnt[j] = c;
-			if (j < LZH_T) lzh_prnt[j + 1] = c;
-			lzh_son[c] = j;
-
-			c = l;
-		}
-	} while ((c = lzh_prnt[c]) != 0);	/* do it until reaching the root */
-}
-
-unsigned short lzh_code, lzh_len;
-
-void lzh_encode_char(unsigned short c, uchar *outbuf, long *outlen)
-{
-	unsigned short i;
-	short int j, k;
-
-	i = 0;
-	j = 0;
-	k = lzh_prnt[c + LZH_T];
-
-	/* search connections from leaf node to the root */
-	do {
-		i >>= 1;
-
-		/*
-		if node's address is odd, output 1
-		else output 0
-		*/
-		if (k & 1) i += 0x8000;
-
-		j++;
-	} while ((k = lzh_prnt[k]) != LZH_R);
-	lzh_putcode(j, i, outbuf, outlen);
-	lzh_code = i;
-	lzh_len = j;
-	lzh_update(c);
-}
-
-void lzh_encode_position(unsigned short c, uchar *outbuf, long *outlen)
-{
-	unsigned short i;
-
-	/* output upper 6 bits with encoding */
-	i = c >> 6;
-	lzh_putcode(lzh_p_len[i], (unsigned)lzh_p_code[i] << 8, outbuf, outlen);
-
-	/* output lower 6 bits directly */
-	lzh_putcode(6, (c & 0x3f) << 10, outbuf, outlen);
-}
-
-void lzh_encode_end(uchar *outbuf, long *outlen)
-{
-	if (lzh_putlen) {
-		outbuf[(*outlen)++]=(lzh_putbuf >> 8);
-	}
-}
-
-short int lzh_decode_char(uchar *inbuf, long *incnt, long inlen)
-{
-	unsigned short c;
-
-	c = lzh_son[LZH_R];
-
-	/*
-	 * start searching tree from the root to leaves.
-	 * choose node #(lzh_son[]) if input bit == 0
-	 * else choose #(lzh_son[]+1) (input bit == 1)
-	 */
-	while (c < LZH_T) {
-		c += lzh_getbit(inbuf,incnt,inlen);
-		c = lzh_son[c];
-	}
-	c -= LZH_T;
-	lzh_update(c);
-	return c;
-}
-
-short int lzh_decode_position(uchar *inbuf, long *incnt, long inlen)
-{
-	unsigned short i, j, c;
-
-	/* decode upper 6 bits from given table */
-	i = lzh_getbyte(inbuf,incnt,inlen);
-	c = (unsigned)lzh_d_code[i] << 6;
-	j = lzh_d_len[i];
-
-	/* input lower 6 bits directly */
-	j -= 2;
-	while (j--) {
-		i = (i << 1) + lzh_getbit(inbuf,incnt,inlen);
-	}
-	return c | i & 0x3f;
-}
-
-/* Compression */
-
-/* Encoding/Compressing */
-/* Returns length of outbuf */
-long lzh_encode(uchar *inbuf, long inlen, uchar *outbuf)
-{
-	short int  i, c, len, r, s, last_match_length;
-	long incnt,outlen; /* textsize=0; */
-
-#ifdef LZH_DYNAMIC_BUF
-
-	if((lzh_text_buf=(uchar *)MALLOC(LZH_N + LZH_F - 1))==NULL)
-		return(-1);
-	if((lzh_freq=(unsigned short*)MALLOC((LZH_T + 1)*sizeof(unsigned short)))==NULL) {
-		FREE(lzh_text_buf);
-		return(-1); }
-	if((lzh_prnt=(short *)MALLOC((LZH_T + LZH_N_CHAR)*sizeof(short)))==NULL) {
-		FREE(lzh_text_buf);
-		FREE(lzh_freq);
-		return(-1); }
-	if((lzh_son=(short *)MALLOC((LZH_T + 1) * sizeof(short)))==NULL) {
-		FREE(lzh_text_buf);
-		FREE(lzh_prnt);
-		FREE(lzh_freq);
-		return(-1); }
-	if((lzh_lson=(short *)MALLOC((LZH_N + 1)*sizeof(short)))==NULL) {
-		FREE(lzh_text_buf);
-		FREE(lzh_prnt);
-		FREE(lzh_freq);
-		FREE(lzh_son);
-		return(-1); }
-	if((lzh_rson=(short *)MALLOC((LZH_N + 257)*sizeof(short)))==NULL) {
-		FREE(lzh_text_buf);
-		FREE(lzh_prnt);
-		FREE(lzh_freq);
-		FREE(lzh_son);
-		FREE(lzh_lson);
-		return(-1); }
-	if((lzh_dad=(short *)MALLOC((LZH_N + 1)*sizeof(short)))==NULL) {
-		FREE(lzh_text_buf);
-		FREE(lzh_prnt);
-		FREE(lzh_freq);
-		FREE(lzh_son);
-        FREE(lzh_lson);
-		FREE(lzh_rson);
-		return(-1); }
-#endif
-
-	incnt=0;
-	memcpy(outbuf,&inlen,sizeof(inlen));
-	outlen=sizeof(inlen);
-	if(!inlen) {
-#ifdef LZH_DYNAMIC_BUF
-		FREE(lzh_text_buf);
-		FREE(lzh_prnt);
-		FREE(lzh_freq);
-		FREE(lzh_son);
-        FREE(lzh_lson);
-        FREE(lzh_rson);
-		FREE(lzh_dad);
-#endif
-		return(outlen); }
-	lzh_start_huff();
-	lzh_init_tree();
-	s = 0;
-	r = LZH_N - LZH_F;
-	for (i = s; i < r; i++)
-		lzh_text_buf[i] = ' ';
-	for (len = 0; len < LZH_F && incnt<inlen; len++)
-		lzh_text_buf[r + len] = inbuf[incnt++];
-	/* textsize = len; */
-	for (i = 1; i <= LZH_F; i++)
-		lzh_insert_node(r - i);
-	lzh_insert_node(r);
-	do {
-		if (lzh_match_length > len)
-			lzh_match_length = len;
-		if (lzh_match_length <= LZH_THRESHOLD) {
-			lzh_match_length = 1;
-			lzh_encode_char(lzh_text_buf[r],outbuf,&outlen);
-		} else {
-			lzh_encode_char(255 - LZH_THRESHOLD + lzh_match_length
-				,outbuf,&outlen);
-			lzh_encode_position(lzh_match_position
-				,outbuf,&outlen);
-		}
-		last_match_length = lzh_match_length;
-		for (i = 0; i < last_match_length && incnt<inlen; i++) {
-			lzh_delete_node(s);
-			c=inbuf[incnt++];
-			lzh_text_buf[s] = c;
-			if (s < LZH_F - 1)
-				lzh_text_buf[s + LZH_N] = c;
-			s = (s + 1) & (LZH_N - 1);
-			r = (r + 1) & (LZH_N - 1);
-			lzh_insert_node(r);
-		}
-/***
-		if ((textsize += i) > printcount) {
-			printf("%12ld\r", textsize);
-			printcount += 1024;
-		}
-***/
-		while (i++ < last_match_length) {
-			lzh_delete_node(s);
-			s = (s + 1) & (LZH_N - 1);
-			r = (r + 1) & (LZH_N - 1);
-			if (--len) lzh_insert_node(r);
-		}
-	} while (len > 0);
-	lzh_encode_end(outbuf,&outlen);
-/*
-	printf("input: %ld (%ld) bytes\n", inlen,textsize);
-	printf("output: %ld bytes\n", outlen);
-	printf("output/input: %.3f\n", (double)outlen / inlen);
-*/
-
-#ifdef LZH_DYNAMIC_BUF
-	FREE(lzh_text_buf);
-	FREE(lzh_prnt);
-	FREE(lzh_freq);
-	FREE(lzh_son);
-	FREE(lzh_lson);
-	FREE(lzh_rson);
-	FREE(lzh_dad);
-#endif
-
-	return(outlen);
-}
-
-/* Decoding/Uncompressing */
-/* Returns length of outbuf */
-long lzh_decode(uchar *inbuf, long inlen, uchar *outbuf)
-{
-	short int  i, j, k, r, c;
-	unsigned long int  count;
-	long incnt,textsize;
-
-#ifdef LZH_DYNAMIC_BUF
-
-	if((lzh_text_buf=(uchar *)MALLOC((LZH_N + LZH_F - 1)*2))==NULL)
-		return(-1);
-	if((lzh_freq=(unsigned short *)MALLOC((LZH_T + 1)*sizeof(unsigned short)))
-		==NULL) {
-		FREE(lzh_text_buf);
-		return(-1); }
-	if((lzh_prnt=(short *)MALLOC((LZH_T + LZH_N_CHAR)*sizeof(short)))==NULL) {
-		FREE(lzh_text_buf);
-		FREE(lzh_freq);
-		return(-1); }
-	if((lzh_son=(short *)MALLOC((LZH_T + 1) * sizeof(short)))==NULL) {
-		FREE(lzh_text_buf);
-		FREE(lzh_prnt);
-		FREE(lzh_freq);
-		return(-1); }
-
-#endif
-
-	incnt=0;
-	memcpy(&textsize,inbuf,sizeof(textsize));
-	incnt+=sizeof(textsize);
-	if (textsize == 0) {
-#ifdef LZH_DYNAMIC_BUF
-		FREE(lzh_text_buf);
-		FREE(lzh_prnt);
-		FREE(lzh_freq);
-		FREE(lzh_son);
-#endif
-		return(textsize); }
-	lzh_start_huff();
-	for (i = 0; i < LZH_N - LZH_F; i++)
-		*(lzh_text_buf+i) = ' ';
-	r = LZH_N - LZH_F;
-    for (count = 0; count < textsize; ) {
-		c = lzh_decode_char(inbuf,&incnt,inlen);
-		if (c < 256) {
-			outbuf[count]=c;
-#if 0
-			if(r>(LZH_N + LZH_F - 1) || r<0) {
-				printf("Overflow! (%d)\n",r);
-				getch();
-				exit(-1); }
-#endif
-			*(lzh_text_buf+r) = c;
-			r++;
-			r &= (LZH_N - 1);
-			count++;
-		} else {
-			i = (r - lzh_decode_position(inbuf,&incnt,inlen) - 1)
-				& (LZH_N - 1);
-			j = c - 255 + LZH_THRESHOLD;
-			for (k = 0; k < j && count<textsize; k++) {
-				c = lzh_text_buf[(i + k) & (LZH_N - 1)];
-				outbuf[count]=c;
-#if 0
-				if(r>(LZH_N + LZH_F - 1) || r<0) {
-					printf("Overflow! (%d)\n",r);
-					exit(-1); }
-#endif
-				*(lzh_text_buf+r) = c;
-				r++;
-				r &= (LZH_N - 1);
-				count++;
-			}
-		}
-	}
-/***
-	printf("%12ld\n", count);
-***/
-
-#ifdef LZH_DYNAMIC_BUF
-	FREE(lzh_text_buf);
-	FREE(lzh_prnt);
-	FREE(lzh_freq);
-	FREE(lzh_son);
-#endif
-
-return(count);
-}
-
-
diff --git a/src/sbbs2/fido/lzh.h b/src/sbbs2/fido/lzh.h
deleted file mode 100644
index 68a71dd90c338ec888128735e99829fefdb02856..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/lzh.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* LZH.H */
-
-long lzh_encode(uchar *inbuf, long inlen, uchar *outbuf);
-long lzh_decode(uchar *inbuf, long inlen, uchar *outbuf);
-
diff --git a/src/sbbs2/fido/makeall.bat b/src/sbbs2/fido/makeall.bat
deleted file mode 100755
index d8896214fe42c6dd9a3c39b166e1b0aa63b5aa28..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/makeall.bat
+++ /dev/null
@@ -1,7 +0,0 @@
-@echo off
-wmake
-if errorlevel 1 goto end
-wmake OS=DOSX
-if errorlevel 1 goto end
-wmake OS=OS2
-:end
diff --git a/src/sbbs2/fido/makefile b/src/sbbs2/fido/makefile
deleted file mode 100644
index 472e9e275db50858e572e2aca57851a93fd7b1ea..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/makefile
+++ /dev/null
@@ -1,78 +0,0 @@
-############################################
-# Makefile for Synchronet SBBSFIDO Utility #
-# For use with Watcom C/C++ 		   #
-############################################
-
-!ifndef OS
-OS	= DOS
-!endif
-
-!ifeq OS DOS
-CC	= *wcc
-!else
-CC	= *wcc386
-!endif
-
-LD	= *wlink
-INCLUDE = \watcom\h;..;..\smb
-!ifeq OS DOS
-CFLAGS	= -I$(INCLUDE) -fh=$*.pch -bt=$(OS) -fo=$(OS)\ -s -ml
-!else
-CFLAGS	= -I$(INCLUDE) -fh=$*.pch -bt=$(OS) -fo=$(OS)\ -s
-!endif
-
-!ifeq OS DOS
-SYSTEM  = DOS
-!endif
-!ifeq OS OS2
-SYSTEM  = OS2V2
-!endif
-!ifeq OS DOSX
-SYSTEM  = DOS4G
-!endif
-
-LFLAGS  = option stack=16k system $(SYSTEM)
-
-MAIN	= $(OS)\sbbsfido.exe
-OBJS	= $(OS)\sbbsfido.obj $(OS)\scfgvars.obj $(OS)\scfglib1.obj &
-	  $(OS)\smblib.obj $(OS)\smbvars.obj $(OS)\ars.obj $(OS)\lzh.obj
-HEADERS = ..\sbbs.h ..\sbbsdefs.h ..\scfgvars.c &
-          ..\smb\smbdefs.h ..\smb\smblib.h ..\smb\smbvars.c
-
-# Implicit C Compile Rule
-.c.obj:
-	@echo Compiling (I) $[@ to $^@ ...
-	$(CC) $(CFLAGS) $[@
-
-# Main EXE Link Rule
-$(MAIN): $(OBJS) 
-	@echo Linking $[@ ...
-        $(LD) $(LFLAGS) file { $(OBJS) }
-
-# Global Variables
-$(OS)\scfgvars.obj: ..\scfgvars.c ..\sbbsdefs.h
-	@echo Compiling $[@ to $^@ ...
-	$(CC) $(CFLAGS) $[@
-
-# Shared Functions
-$(OS)\scfglib1.obj: ..\scfglib1.c ..\sbbs.h ..\sbbsdefs.h ..\scfgvars.c &
-		    ..\scfglib.h
-	@echo Compiling $[@ to $^@ ...
-	$(CC) $(CFLAGS) $[@
-
-$(OS)\smblib.obj: ..\smb\smblib.c ..\smb\smblib.h ..\smb\smbdefs.h
-	@echo Compiling $[@ to $^@ ...
-	$(CC) $(CFLAGS) $[@
-
-$(OS)\smbvars.obj: ..\smb\smbvars.c ..\smb\smblib.h ..\smb\smbdefs.h
-	@echo Compiling $[@ to $^@ ...
-	$(CC) $(CFLAGS) $[@
-
-$(OS)\lzh.obj: ..\smb\lzh.c ..\smb\lzh.h
-	@echo Compiling $[@ to $^@ ...
-	$(CC) $(CFLAGS) $[@
-
-$(OS)\ars.obj: ..\ars.c ..\ars_defs.h 
-	@echo Compiling $[@ to $^@ ...
-	$(CC) $(CFLAGS) $[@
-
diff --git a/src/sbbs2/fido/makefile.bc b/src/sbbs2/fido/makefile.bc
deleted file mode 100644
index 27f1c3e38755980d4b591cd192ae7b7bfbfa25e8..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/makefile.bc
+++ /dev/null
@@ -1,88 +0,0 @@
-############################################
-# Makefile for Synchronet SBBSFIDO Utility #
-# For use with Borland C++ for DOS or OS/2 #
-############################################
-
-# Macros
-CC	= bcc
-LD	= tlink
-!ifdef __OS2__
-OS	= OS2
-INCLUDE = c:\bcos2\include;..;..\smb;..\rio
-LIB	= c:\bcos2\lib
-CFLAGS  = -d -C -I$(INCLUDE)
-LFLAGS  = -c
-!else
-OS      = DOS
-INCLUDE = \bc31\include;..;..\smb;..\rio
-LIB	= \bc31\lib
-MODEL	= l
-CFLAGS	= -d -N -C -m$(MODEL) -I$(INCLUDE)
-LFLAGS	= -n -c
-!endif
-MAIN	= $(OS)\sbbsfido.exe
-OBJS	= $(OS)\sbbsfido.obj $(OS)\scfgvars.obj $(OS)\scfglib1.obj\
-	  $(OS)\scfglib2.obj\
-	  $(OS)\smblib.obj $(OS)\smbvars.obj $(OS)\ars.obj $(OS)\lzh.obj
-HEADERS = ..\sbbs.h ..\sbbsdefs.h ..\scfgvars.c \
-          ..\smb\smbdefs.h ..\smb\smblib.h ..\smb\smbvars.c
-
-# Implicit C Compile Rule
-{.}.c.obj:
-	@echo Compiling (I) $< to $@ ...
-        $(CC) $(CFLAGS) -n$(OS) -c $<
-
-# Main EXE Link Rule
-$(MAIN): $(OBJS) 
-    	@echo Linking $< ...
-!ifdef __OS2__
-	$(LD) $(LFLAGS) @&&+
-$(LIB)\c02.obj $(OBJS)
-+, $*, $*, $(LIB)\os2.lib $(LIB)\c2.lib
-!else
-	$(LD) $(LFLAGS) @&&+
-$(LIB)\c0$(MODEL) $(OBJS)   
-+, $*, $*, $(LIB)\c$(MODEL).lib $(LIB)\math$(MODEL).lib $(LIB)\emu.lib
-!endif
-
-# Global Variables
-$(OS)\scfgvars.obj: ..\scfgvars.c ..\sbbsdefs.h
-	@echo Compiling ..\$&.c to $< ...
-	$(CC) $(CFLAGS) -c -n$(OS) ..\$&.c
-
-# Shared Functions
-$(OS)\scfglib1.obj: ..\sbbs.h ..\sbbsdefs.h ..\scfglib1.c ..\scfgvars.c
-        @echo Compiling ..\$&.c to $< ...
-        $(CC) $(CFLAGS) -c -n$(OS) @&&!
--DNO_FILE_CFG
--DNO_XTRN_CFG
--DNO_CMDS_CFG
--DNO_CHAT_CFG
-! ..\$&.c
-
-# Shared Functions
-$(OS)\scfglib2.obj: ..\sbbs.h ..\sbbsdefs.h ..\scfglib2.c ..\scfgvars.c
-        @echo Compiling ..\$&.c to $< ...
-        $(CC) $(CFLAGS) -c -n$(OS) @&&!
--DNO_FILE_CFG
--DNO_XTRN_CFG
--DNO_CMDS_CFG
--DNO_CHAT_CFG
-! ..\$&.c
-
-#$(OS)\smblib.obj: ..\smb\smblib.c ..\smb\smblib.h ..\smb\smbdefs.h
-#	@echo Compiling SMBLIB ...
-#	$(CC) $(CFLAGS) -n$(OS) -c ..\smb\smblib.c
-
-#$(OS)\smbvars.obj: ..\smb\smbvars.c ..\smb\smblib.h ..\smb\smbdefs.h
-#	@echo Compiling SMBVARS ...
-#	$(CC) $(CFLAGS) -n$(OS) -c ..\smb\smbvars.c
-
-#$(OS)\lzh.obj: ..\smb\lzh.c ..\smb\lzh.h
-#        @echo Compiling LZH ...
-#	$(CC) $(CFLAGS) -n$(OS) -c ..\smb\lzh.c
-
-$(OS)\ars.obj: ..\ars.c ..\ars_defs.h 
-        @echo Compiling ..\$&.c to $< ...
-	$(CC) $(CFLAGS) -n$(OS) -c ..\ars.c
-
diff --git a/src/sbbs2/fido/sbbsfido.c b/src/sbbs2/fido/sbbsfido.c
deleted file mode 100644
index 35ed292f76675b28ec535b04bd29480d8c292712..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/sbbsfido.c
+++ /dev/null
@@ -1,1909 +0,0 @@
-/* SBBSFIDO.C */
-
-/* Synchronet FidoNet EchoMail Scanning/Tossing and NetMail Tossing Utility */
-
-#define VER "2.24"
-
-#include "sbbs.h"
-#include "crc32.h"
-#include "lzh.h"
-#include "post.h"
-#include "scfglib.h"
-
-#define IMPORT_NETMAIL	(1L<<0)
-#define IMPORT_ECHOMAIL (1L<<1)
-#define EXPORT_ECHOMAIL (1L<<2)
-#define DELETE_NETMAIL	(1L<<3)
-#define DELETE_ECHOMAIL (1L<<4)
-#define IGNORE_POINT	(1L<<5)
-#define IGNORE_ZONE 	(1L<<6)
-#define IGNORE_MSGPTRS	(1L<<7)
-#define UPDATE_MSGPTRS	(1L<<8)
-#define LEAVE_MSGPTRS	(1L<<9)
-#define KILL_ECHOMAIL	(1L<<10)
-#define ASCII_ONLY		(1L<<11)
-#define LOGFILE 		(1L<<12)
-#define REPORT			(1L<<13)
-#define EXPORT_ALL		(1L<<14)
-#define PURGE_ECHOMAIL	(1L<<15)
-#define UNKNOWN_NETMAIL (1L<<16)
-#define IGNORE_ADDRESS	(1L<<17)
-#define IMPORT_LOCAL	(1L<<18)
-#define IMPORT_NEW_ONLY (1L<<19)
-#define DONT_SET_RECV	(1L<<20)
-#define IGNORE_RECV 	(1L<<21)
-#define CONVERT_TEAR	(1L<<22)
-#define IMPORT_PRIVATE	(1L<<23)
-#define LOCAL_NETMAIL	(1L<<24)
-#define NOTIFY_RECEIPT	(1L<<25)
-
-char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
-char *mon[]={"Jan","Feb","Mar","Apr","May","Jun"
-            ,"Jul","Aug","Sep","Oct","Nov","Dec"};
-
-long misc=(IMPORT_NETMAIL|IMPORT_ECHOMAIL|EXPORT_ECHOMAIL
-			|DELETE_NETMAIL|DELETE_ECHOMAIL|KILL_ECHOMAIL);
-char tmp[256];
-
-FILE *fidologfile=NULL;
-#ifdef __TURBOC__
-	unsigned _stklen=20000;
-#endif
-int startmsg=1;
-int nodefile;
-
-#ifdef __WATCOMC__
-	#define O_DENYNONE SH_DENYNO
-#endif
-
-long lputs(char FAR16 *str)
-{
-    char tmp[256];
-    int i,j,k;
-
-if(misc&LOGFILE && fidologfile!=NULL)
-    fputs(str,fidologfile);
-j=strlen(str);
-for(i=k=0;i<j;i++)      /* remove CRs */
-    if(str[i]==CR && str[i+1]==LF)
-        continue;
-    else
-        tmp[k++]=str[i];
-tmp[k]=0;
-return(fputs(tmp,stdout));
-}
-
-/******************************************/
-/* CRC-16 routines required for SMB index */
-/******************************************/
-
-/****************************************************************************/
-/* Updates 16-bit "rcrc" with character 'ch'                                */
-/****************************************************************************/
-void ucrc16(uchar ch, ushort *rcrc) {
-	ushort i, cy;
-    uchar nch=ch;
- 
-for (i=0; i<8; i++) {
-    cy=*rcrc & 0x8000;
-    *rcrc<<=1;
-    if (nch & 0x80) *rcrc |= 1;
-    nch<<=1;
-    if (cy) *rcrc ^= 0x1021; }
-}
-
-/****************************************************************************/
-/* Returns 16-crc of string (not counting terminating NULL) 				*/
-/****************************************************************************/
-ushort crc16(char *str)
-{
-	int 	i=0;
-	ushort	crc=0;
-
-ucrc16(0,&crc);
-while(str[i])
-	ucrc16(str[i++],&crc);
-ucrc16(0,&crc);
-ucrc16(0,&crc);
-return(crc);
-}
-
-/****************************************************************************/
-/* Returns 32-crc of string (not counting terminating NULL) 				*/
-/****************************************************************************/
-ulong crc32(char *str)
-{
-	int i=0;
-	ulong crc=0xffffffffUL;
-
-	while(str[i])
-		crc=ucrc32(str[i++],crc);
-	crc=~crc;
-	return(crc);
-}
-
-
-
-/****************************************************************************/
-/* Performs printf() through local assembly routines                        */
-/* Called from everywhere                                                   */
-/****************************************************************************/
-int lprintf(char *fmat, ...)
-{
-	va_list argptr;
-	char sbuf[256];
-	int chcount;
-
-va_start(argptr,fmat);
-chcount=vsprintf(sbuf,fmat,argptr);
-va_end(argptr);
-lputs(sbuf);
-return(chcount);
-}
-
-/****************************************************************************/
-/* Reads the data for node number 'number' into the structure 'node'        */
-/* from NODE.DAB															*/
-/* if lockit is non-zero, locks this node's record. putnodedat() unlocks it */
-/****************************************************************************/
-void getnodedat(uint number, node_t *node, char lockit)
-{
-	char str[256];
-	int count=0;
-
-number--;	/* make zero based */
-while(count<LOOP_NODEDAB) {
-	lseek(nodefile,(long)number*sizeof(node_t),SEEK_SET);
-	if(lockit
-		&& lock(nodefile,(long)number*sizeof(node_t),sizeof(node_t))==-1) {
-		count++;
-		continue; }
-	if(read(nodefile,node,sizeof(node_t))==sizeof(node_t))
-		break;
-	count++; }
-if(count==LOOP_NODEDAB)
-	lprintf("\7Error unlocking and reading NODE.DAB\r\n");
-}
-
-/****************************************************************************/
-/* Write the data from the structure 'node' into NODE.DAB  					*/
-/* getnodedat(num,&node,1); must have been called before calling this func  */
-/*          NOTE: ------^   the indicates the node record has been locked   */
-/****************************************************************************/
-void putnodedat(uint number, node_t node)
-{
-	char str[256];
-	int count;
-
-number--;	/* make zero based */
-lseek(nodefile,(long)number*sizeof(node_t),SEEK_SET);
-if(write(nodefile,&node,sizeof(node_t))!=sizeof(node_t)) {
-	unlock(nodefile,(long)number*sizeof(node_t),sizeof(node_t));
-	lprintf("\7Error writing NODE.DAB for node %u\r\n",number+1);
-	return; }
-unlock(nodefile,(long)number*sizeof(node_t),sizeof(node_t));
-}
-
-
-/****************************************************************************/
-/* Creates a short message for 'usernumber' than contains 'strin'			*/
-/****************************************************************************/
-void putsmsg(int usernumber, char *strin)
-{
-	char str[256];
-	int file,i;
-    node_t node;
-
-sprintf(str,"%sMSGS\\%4.4u.MSG",data_dir,usernumber);
-if((file=nopen(str,O_WRONLY|O_CREAT|O_APPEND))==-1) {
-	lprintf("\7Error opening/creating %s for creat/append access\r\n",str);
-	return; }
-i=strlen(strin);
-if(write(file,strin,i)!=i) {
-	close(file);
-	lprintf("\7Error writing %u bytes to %s\r\n",i,str);
-	return; }
-close(file);
-for(i=1;i<=sys_nodes;i++) {		/* flag node if user on that msg waiting */
-	getnodedat(i,&node,0);
-	if(node.useron==usernumber
-		&& (node.status==NODE_INUSE || node.status==NODE_QUIET)
-		&& !(node.misc&NODE_MSGW)) {
-		getnodedat(i,&node,1);
-		node.misc|=NODE_MSGW;
-        putnodedat(i,node); } }
-}
-
-
-/****************************************************************************/
-/* Converts an ASCII Hex string into an ulong                       */
-/****************************************************************************/
-ulong ahtoul(char *str)
-{
-	ulong l,val=0;
-
-while((l=(*str++)|0x20)!=0x20)
-	val=(l&0xf)+(l>>6&1)*9+val*16;
-return(val);
-}
-
-/****************************************************************************/
-/* Truncates white-space chars off end of 'str' and terminates at first tab */
-/****************************************************************************/
-void truncsp(char *str)
-{
-	char c;
-
-str[strcspn(str,"\t")]=0;
-c=strlen(str);
-while(c && str[c-1]<=SP) c--;
-str[c]=0;
-}
-
-/****************************************************************************/
-/* Puts a backslash on path strings 										*/
-/****************************************************************************/
-void backslash(char *str)
-{
-    int i;
-
-i=strlen(str);
-if(i && str[i-1]!='\\') {
-    str[i]='\\'; str[i+1]=0; }
-}
-
-void remove_re(char *str)
-{
-while(!strnicmp(str,"RE:",3)) {
-	strcpy(str,str+3);
-	while(str[0]==SP)
-		strcpy(str,str+1); }
-}
-
-/****************************************************************************/
-/* Network open function. Opens all files DENYALL and retries LOOP_NOPEN    */
-/* number of times if the attempted file is already open or denying access	*/
-/* for some other reason.	All files are opened in BINARY mode.			*/
-/****************************************************************************/
-int nopen(char *str, int access)
-{
-	char logstr[256];
-	int file,share,count=0;
-
-if(access&O_DENYNONE) {
-	share=SH_DENYNO;
-	access&=~O_DENYNONE; }
-else if(access==O_RDONLY) share=SH_DENYWR;
-else share=SH_DENYRW;
-while(((file=sopen(str,O_BINARY|access,share,S_IWRITE))==-1)
-	&& errno==EACCES && count++<LOOP_NOPEN);
-if(file==-1 && errno==EACCES)
-	lputs("\7\r\nNOPEN: ACCESS DENIED\r\n\7");
-return(file);
-}
-
-/****************************************************************************/
-/* This function performs an nopen, but returns a file stream with a buffer */
-/* allocated.																*/
-/****************************************************************************/
-FILE *fnopen(int *file, char *str, int access)
-{
-	char mode[128];
-	FILE *stream;
-
-if(((*file)=nopen(str,access))==-1)
-	return(NULL);
-
-if(access&O_APPEND) {
-	if(access&O_RDONLY)
-		strcpy(mode,"a+");
-	else
-		strcpy(mode,"a"); }
-else {
-	if(access&O_WRONLY)
-		strcpy(mode,"r+");
-	else
-		strcpy(mode,"r"); }
-stream=fdopen((*file),mode);
-if(stream==NULL) {
-	close(*file);
-	return(NULL); }
-setvbuf(stream,NULL,_IOFBF,16*1024);
-return(stream);
-}
-
-
-/****************************************************************************/
-/* Moves or copies a file from one dir to another                           */
-/* both 'src' and 'dest' must contain full path and filename                */
-/* returns 0 if successful, -1 if error                                     */
-/****************************************************************************/
-int mv(char *src, char *dest, char copy)
-{
-	char buf[4096],str[256];
-	int  ind,outd;
-	long length,chunk=4096,l;
-	ushort ftime,fdate;
-    FILE *inp,*outp;
-
-if(!strcmp(src,dest))	/* source and destination are the same! */
-	return(0);
-if(!fexist(src)) {
-	lprintf("\r\nMV ERROR: Source doesn't exist\r\n'%s'\r\n"
-		,src);
-	return(-1); }
-if(!copy && fexist(dest)) {
-	lprintf("\r\nMV ERROR: Destination already exists\r\n'%s'\r\n"
-		,dest);
-	return(-1); }
-if(!copy && ((src[1]!=':' && dest[1]!=':')
-	|| (src[1]==':' && dest[1]==':' && toupper(src[0])==toupper(dest[0])))) {
-	if(rename(src,dest)) {						/* same drive, so move */
-		lprintf("\r\nMV ERROR: Error renaming '%s'"
-				"\r\n                      to '%s'\r\n",src,dest);
-		return(-1); }
-	return(0); }
-if((ind=nopen(src,O_RDONLY))==-1) {
-	lprintf("\r\nMV ERROR: ERR_OPEN %s\r\n",src);
-	return(-1); }
-if((inp=fdopen(ind,"rb"))==NULL) {
-	close(ind);
-	lprintf("\r\nMV ERROR: ERR_FDOPEN %s\r\n",str);
-	return(-1); }
-setvbuf(inp,NULL,_IOFBF,8*1024);
-if((outd=nopen(dest,O_WRONLY|O_CREAT|O_TRUNC))==-1) {
-	fclose(inp);
-	lprintf("\r\nMV ERROR: ERR_OPEN %s\r\n",dest);
-	return(-1); }
-if((outp=fdopen(outd,"wb"))==NULL) {
-	close(outd);
-	fclose(inp);
-	lprintf("\r\nMV ERROR: ERR_FDOPEN %s\r\n",str);
-	return(-1); }
-setvbuf(outp,NULL,_IOFBF,8*1024);
-length=filelength(ind);
-l=0L;
-while(l<length) {
-	if(l+chunk>length)
-		chunk=length-l;
-	fread(buf,chunk,1,inp);
-	fwrite(buf,chunk,1,outp);
-	l+=chunk; }
-_dos_getftime(ind,&fdate,&ftime);
-_dos_setftime(outd,fdate,ftime);
-fclose(inp);
-fclose(outp);
-if(!copy && remove(src)) {
-	lprintf("MV ERROR: ERR_REMOVE %s\r\n",src);
-	return(-1); }
-return(0);
-}
-
-/****************************************************************************/
-/* Returns the total number of msgs in the sub-board and sets 'ptr' to the  */
-/* date of the last message in the sub (0) if no messages.					*/
-/****************************************************************************/
-ulong getlastmsg(uint subnum, ulong *ptr, time_t *t)
-{
-	char str[256];
-	int i;
-	smbstatus_t status;
-
-sprintf(smb_file,"%s%s",sub[subnum]->data_dir,sub[subnum]->code);
-if((i=smb_open(10))!=0) {
-	lprintf("ERR_OPEN %s %d\r\n",smb_file,i);
-	return(0); }
-
-if(!filelength(fileno(shd_fp))) {			/* Empty base */
-	if(ptr) (*ptr)=0;
-	smb_close();
-	return(0); }
-if((i=smb_locksmbhdr(10))!=0) {
-	smb_close();
-	lprintf("ERR_LOCK %s %d\r\n",smb_file,i);
-	return(0); }
-if((i=smb_getstatus(&status))!=0) {
-	smb_unlocksmbhdr();
-	smb_close();
-	lprintf("ERR_READ %s %d\r\n",smb_file,i);
-	return(0); }
-smb_unlocksmbhdr();
-smb_close();
-if(ptr) (*ptr)=status.last_msg;
-return(status.total_msgs);
-}
-
-
-ulong loadmsgs(post_t HUGE16 **post, ulong ptr)
-{
-	int i;
-	long l=0;
-	idxrec_t idx;
-
-
-if((i=smb_locksmbhdr(10))!=0) { 				/* Be sure noone deletes or */
-	lprintf("ERR_LOCK %s %d\r\n",smb_file,i);   /* adds while we're reading */
-	return(0L); }
-
-fseek(sid_fp,0L,SEEK_SET);
-while(!feof(sid_fp)) {
-    if(!fread(&idx,sizeof(idxrec_t),1,sid_fp))
-        break;
-
-	if(idx.number<=ptr || idx.attr&MSG_DELETE)
-		continue;
-
-	if(idx.attr&MSG_MODERATED && !(idx.attr&MSG_VALIDATED))
-		break;
-
-	if(((*post)=(post_t HUGE16 *)REALLOC((*post),sizeof(post_t)*(l+1)))
-        ==NULL) {
-		smb_unlocksmbhdr();
-		lprintf("ERR_ALLOC %s %lu\r\n",smb_file,sizeof(post_t *)*(l+1));
-		return(l); }
-	(*post)[l].offset=idx.offset;
-	(*post)[l].number=idx.number;
-	l++; }
-smb_unlocksmbhdr();
-return(l);
-}
-
-
-void allocfail(uint size)
-{
-lprintf("\7Error allocating %u bytes of memory.\r\n",size);
-bail(1);
-}
-
-void bail(int code)
-{
-exit(code);
-}
-
-/****************************************************************************/
-/* Returns the length of the file in 'filespec'                             */
-/****************************************************************************/
-long flength(char *filespec)
-{
-	struct find_t f;
-
-if(!findfirst(filespec,&f,0))
-	return(f.size);
-return(-1L);
-}
-
-/****************************************************************************/
-/* Checks the disk drive for the existence of a file. Returns 1 if it       */
-/* exists, 0 if it doesn't.                                                 */
-/* Called from upload                                                       */
-/****************************************************************************/
-char fexist(char *filespec)
-{
-	struct find_t f;
-
-if(!findfirst(filespec,&f,0))
-    return(1);
-return(0);
-}
-
-typedef struct {
-	ulong	alias,
-			real;
-			} username_t;
-
-/****************************************************************************/
-/* Note: Wrote another version of this function that read all userdata into */
-/****************************************************************************/
-/* Looks for a perfect match amoung all usernames (not deleted users)		*/
-/* Returns the number of the perfect matched username or 0 if no match		*/
-/* Called from functions waitforcall and newuser							*/
-/* memory then scanned it from memory... took longer - always.              */
-/****************************************************************************/
-ulong matchname(char *inname)
-{
-	static ulong total_users;
-	static username_t *username;
-	int userdat,file,i;
-	char str[256],c;
-	ulong l,crc;
-	FILE *namedat;
-
-if(!total_users) {		/* Load CRCs */
-	fprintf(stderr,"%-25s","Loading user names...");
-	sprintf(str,"%sUSER\\NAME.DAT",data_dir);
-	if((namedat=fnopen(&file,str,O_RDONLY))==NULL)
-		return(0);
-	sprintf(str,"%sUSER\\USER.DAT",data_dir);
-	if((userdat=nopen(str,O_RDONLY|O_DENYNONE))==-1) {
-		fclose(namedat);
-		return(0); }
-	while(!feof(namedat) && !eof(userdat)) {
-		if(!fread(str,LEN_ALIAS+2,1,namedat))
-			break;
-		if((username=(username_t *)REALLOC(username
-			,(total_users+1)*sizeof(username_t)))==NULL)
-			break;
-
-		for(c=0;c<LEN_ALIAS;c++)
-			if(str[c]==ETX) break;
-		str[c]=0;
-		strlwr(str);
-		username[total_users].alias=crc32(str);
-		i=0;
-		while(i<LOOP_NODEDAB
-			&& lock(userdat,(long)((long)(total_users)*U_LEN)+U_NAME
-				,LEN_NAME)==-1) {
-			i++; }
-		if(i>=LOOP_NODEDAB) 	   /* Couldn't lock USER.DAT record */
-			continue;
-		lseek(userdat,(long)((long)(total_users)*U_LEN)+U_NAME,SEEK_SET);
-		read(userdat,str,LEN_NAME);
-		unlock(userdat,(long)((long)(total_users)*U_LEN)+U_NAME,LEN_NAME);
-		for(c=0;c<LEN_NAME;c++)
-			if(str[c]==ETX || str[c]==CR) break;
-		str[c]=0;
-		strlwr(str);
-		username[total_users].real=crc32(str);
-		total_users++; }
-	fclose(namedat);
-	close(userdat);
-	fprintf(stderr,
-		"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
-		"%25s"
-		"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
-		,""); }
-
-strcpy(str,inname);
-strlwr(str);
-crc=crc32(str);
-for(l=0;l<total_users;l++)
-	if(crc==username[l].alias || crc==username[l].real)
-		return(l+1);
-return(0);
-}
-
-/****************************************************************************/
-/* Converts goofy FidoNet time format into Unix format						*/
-/****************************************************************************/
-time_t fmsgtime(char *str)
-{
-	char month[4];
-	struct tm tm;
-
-memset(&tm,0,sizeof(tm));
-if(isdigit(str[1])) {	/* Regular format: "01 Jan 86  02:34:56" */
-	tm.tm_mday=atoi(str);
-	sprintf(month,"%3.3s",str+3);
-	if(!stricmp(month,"jan"))
-		tm.tm_mon=0;
-	else if(!stricmp(month,"feb"))
-		tm.tm_mon=1;
-	else if(!stricmp(month,"mar"))
-		tm.tm_mon=2;
-	else if(!stricmp(month,"apr"))
-		tm.tm_mon=3;
-	else if(!stricmp(month,"may"))
-		tm.tm_mon=4;
-	else if(!stricmp(month,"jun"))
-		tm.tm_mon=5;
-	else if(!stricmp(month,"jul"))
-		tm.tm_mon=6;
-	else if(!stricmp(month,"aug"))
-		tm.tm_mon=7;
-	else if(!stricmp(month,"sep"))
-		tm.tm_mon=8;
-	else if(!stricmp(month,"oct"))
-		tm.tm_mon=9;
-	else if(!stricmp(month,"nov"))
-		tm.tm_mon=10;
-	else
-		tm.tm_mon=11;
-	tm.tm_year=atoi(str+7);
-	tm.tm_hour=atoi(str+11);
-	tm.tm_min=atoi(str+14);
-	tm.tm_sec=atoi(str+17); }
-
-else {					/* SEAdog  format: "Mon  1 Jan 86 02:34" */
-	tm.tm_mday=atoi(str+4);
-	sprintf(month,"%3.3s",str+7);
-	if(!stricmp(month,"jan"))
-		tm.tm_mon=0;
-	else if(!stricmp(month,"feb"))
-		tm.tm_mon=1;
-	else if(!stricmp(month,"mar"))
-		tm.tm_mon=2;
-	else if(!stricmp(month,"apr"))
-		tm.tm_mon=3;
-	else if(!stricmp(month,"may"))
-		tm.tm_mon=4;
-	else if(!stricmp(month,"jun"))
-		tm.tm_mon=5;
-	else if(!stricmp(month,"jul"))
-		tm.tm_mon=6;
-	else if(!stricmp(month,"aug"))
-		tm.tm_mon=7;
-	else if(!stricmp(month,"sep"))
-		tm.tm_mon=8;
-	else if(!stricmp(month,"oct"))
-		tm.tm_mon=9;
-	else if(!stricmp(month,"nov"))
-		tm.tm_mon=10;
-	else
-		tm.tm_mon=11;
-	tm.tm_year=atoi(str+11);
-	tm.tm_hour=atoi(str+14);
-	tm.tm_min=atoi(str+17);
-	tm.tm_sec=0; }
-
-if(tm.tm_year<70)
-	tm.tm_year+=100;
-
-return(mktime(&tm));
-}
-
-/****************************************************************************/
-/* Returns the FidoNet address kept in str as ASCII.                        */
-/****************************************************************************/
-faddr_t atofaddr(char *str)
-{
-    char *p;
-    faddr_t addr;
-
-addr.zone=addr.net=addr.node=addr.point=0;
-if((p=strchr(str,':'))!=NULL) {
-    addr.zone=atoi(str);
-    addr.net=atoi(p+1); }
-else {
-    if(total_faddrs)
-		addr.zone=faddr[0].zone;
-    else
-        addr.zone=1;
-    addr.net=atoi(str); }
-if(!addr.zone)              /* no such thing as zone 0 */
-    addr.zone=1;
-if((p=strchr(str,'/'))!=NULL)
-    addr.node=atoi(p+1);
-else {
-    if(total_faddrs)
-		addr.net=faddr[0].net;
-    else
-        addr.net=1;
-    addr.node=atoi(str); }
-if((p=strchr(str,'.'))!=NULL)
-    addr.point=atoi(p+1);
-return(addr);
-}
-
-/****************************************************************************/
-/* Returns an ASCII string for FidoNet address 'addr'                       */
-/****************************************************************************/
-char *faddrtoa(faddr_t addr)
-{
-    static char str[25];
-    char point[25];
-
-sprintf(str,"%u:%u/%u",addr.zone,addr.net,addr.node);
-if(addr.point) {
-    sprintf(point,".%u",addr.point);
-    strcat(str,point); }
-return(str);
-}
-
-#ifndef __OS2__
-/****************************************************************************/
-/* This function reads files that are potentially larger than 32k.  		*/
-/* Up to one megabyte of data can be read with each call.                   */
-/****************************************************************************/
-long lread(int file, char HUGE16 *buf,long bytes)
-{
-	long count;
-
-for(count=bytes;count>32767;count-=32767,buf+=32767)
-	if(read(file,(char *)buf,32767)!=32767)
-		return(-1L);
-if(read(file,(char *)buf,(int)count)!=count)
-	return(-1L);
-return(bytes);
-}
-#endif
-
-/****************************************************************************/
-/* Coverts a FidoNet message into a Synchronet message						*/
-/****************************************************************************/
-void fmsgtosmsg(int file, fmsghdr_t fmsghdr, smbstatus_t status, uint user
-	,uint subnum)
-{
-	uchar	ch,HUGE16 *fbuf,HUGE16 *sbody,HUGE16 *stail,HUGE16 *outbuf
-			,done,col,esc,cr,*p,str[128];
-	int 	i,chunk,lzh=0,storage;
-	ushort	xlat,net;
-	ulong	l,m,length,lzhlen,bodylen,taillen,crc;
-	faddr_t faddr,origaddr,destaddr;
-	smbmsg_t	msg;
-
-memset(&msg,0,sizeof(smbmsg_t));
-memcpy(msg.hdr.id,"SHD\x1a",4);
-msg.hdr.version=SMB_VERSION;
-if(fmsghdr.attr&FIDO_PRIVATE)
-	msg.idx.attr|=MSG_PRIVATE;
-msg.hdr.attr=msg.idx.attr;
-
-if(fmsghdr.attr&FIDO_FILE)
-	msg.hdr.auxattr|=MSG_FILEATTACH;
-
-msg.hdr.when_imported.time=time(NULL);
-msg.hdr.when_imported.zone=sys_timezone;
-msg.hdr.when_written.time=fmsgtime(fmsghdr.time);
-
-origaddr.zone=fmsghdr.origzone; 	/* only valid if NetMail */
-origaddr.net=fmsghdr.orignet;
-origaddr.node=fmsghdr.orignode;
-origaddr.point=fmsghdr.origpoint;
-
-destaddr.zone=fmsghdr.destzone; 	/* only valid if NetMail */
-destaddr.net=fmsghdr.destnet;
-destaddr.node=fmsghdr.destnode;
-destaddr.point=fmsghdr.destpoint;
-
-smb_hfield(&msg,SENDER,strlen(fmsghdr.from),fmsghdr.from);
-strlwr(fmsghdr.from);
-msg.idx.from=crc16(fmsghdr.from);
-
-smb_hfield(&msg,RECIPIENT,strlen(fmsghdr.to),fmsghdr.to);
-strlwr(fmsghdr.to);
-msg.idx.to=crc16(fmsghdr.to);
-
-if(user) {
-	sprintf(str,"%u",user);
-	smb_hfield(&msg,RECIPIENTEXT,strlen(str),str);
-	msg.idx.to=user;
-	msg.idx.from=0; }
-
-smb_hfield(&msg,SUBJECT,strlen(fmsghdr.subj),fmsghdr.subj);
-remove_re(fmsghdr.subj);
-strlwr(fmsghdr.subj);
-msg.idx.subj=crc16(fmsghdr.subj);
-
-length=filelength(file)-sizeof(fmsghdr_t);
-if((fbuf=(char *)LMALLOC(length+1))==NULL) {
-	printf("alloc error\r\n");
-	smb_freemsgmem(msg);
-	return; }
-if((sbody=(char *)LMALLOC((length+1)*2L))==NULL) {
-	printf("alloc error\n");
-	LFREE((char *)fbuf);
-	smb_freemsgmem(msg);
-	return; }
-if((stail=(char *)LMALLOC((length+1)*2L))==NULL) {
-	printf("alloc error\n");
-	LFREE((char *)fbuf);
-	LFREE((char *)sbody);
-	smb_freemsgmem(msg);
-	return; }
-lread(file,fbuf,length);
-
-for(col=l=esc=done=bodylen=taillen=0,cr=1;l<length;l++) {
-	ch=fbuf[l];
-	if(ch==1 && cr) {	/* kludge line */
-
-		if(!strncmp((char *)fbuf+l+1,"TOPT ",5))
-			destaddr.point=atoi((char *)fbuf+l+6);
-
-		else if(!strncmp((char *)fbuf+l+1,"FMPT ",5))
-			origaddr.point=atoi((char *)fbuf+l+6);
-
-		else if(!strncmp((char *)fbuf+l+1,"INTL ",5)) {
-			faddr=atofaddr((char *)fbuf+l+6);
-			destaddr.zone=faddr.zone;
-			destaddr.net=faddr.net;
-			destaddr.node=faddr.node;
-			l+=6;
-			while(l<length && fbuf[l]!=SP) l++;
-			faddr=atofaddr((char *)fbuf+l+1);
-			origaddr.zone=faddr.zone;
-			origaddr.net=faddr.net;
-			origaddr.node=faddr.node; }
-
-		else if(!strncmp((char *)fbuf+l+1,"MSGID:",6)) {
-			l+=7;
-			while(l<length && fbuf[l]<=SP) l++;
-			m=l;
-			while(m<length && fbuf[m]!=CR) m++;
-			while(m && fbuf[m-1]<=SP) m--;
-			if(m>l)
-				smb_hfield(&msg,FIDOMSGID,m-l,fbuf+l); }
-
-		else if(!strncmp((char *)fbuf+l+1,"REPLY:",6)) {
-			l+=7;
-			while(l<length && fbuf[l]<=SP) l++;
-			m=l;
-			while(m<length && fbuf[m]!=CR) m++;
-			while(m && fbuf[m-1]<=SP) m--;
-			if(m>l)
-				smb_hfield(&msg,FIDOREPLYID,m-l,fbuf+l); }
-
-		else if(!strncmp((char *)fbuf+l+1,"FLAGS:",6)) {
-			l+=7;
-			while(l<length && fbuf[l]<=SP) l++;
-			m=l;
-			while(m<length && fbuf[m]!=CR) m++;
-			while(m && fbuf[m-1]<=SP) m--;
-			if(m>l)
-				smb_hfield(&msg,FIDOFLAGS,m-l,fbuf+l); }
-
-		else if(!strncmp((char *)fbuf+l+1,"PATH:",5)) {
-			l+=6;
-			while(l<length && fbuf[l]<=SP) l++;
-			m=l;
-			while(m<length && fbuf[m]!=CR) m++;
-			while(m && fbuf[m-1]<=SP) m--;
-			if(m>l)
-				smb_hfield(&msg,FIDOPATH,m-l,fbuf+l); }
-
-		else if(!strncmp((char *)fbuf+l+1,"PID:",4)) {
-			l+=5;
-			while(l<length && fbuf[l]<=SP) l++;
-			m=l;
-			while(m<length && fbuf[m]!=CR) m++;
-			while(m && fbuf[m-1]<=SP) m--;
-			if(m>l)
-				smb_hfield(&msg,FIDOPID,m-l,fbuf+l); }
-
-		else {		/* Unknown kludge line */
-			while(l<length && fbuf[l]<=SP) l++;
-			m=l;
-			while(m<length && fbuf[m]!=CR) m++;
-			while(m && fbuf[m-1]<=SP) m--;
-			if(m>l)
-				smb_hfield(&msg,FIDOCTRL,m-l,fbuf+l); }
-
-		while(l<length && fbuf[l]!=CR) l++;
-		continue; }
-
-	if(ch!=LF && ch!=0x8d) {	/* ignore LF and soft CRs */
-		if(cr && (!strncmp((char *)fbuf+l,"--- ",4)
-			|| !strncmp((char *)fbuf+l,"---\r",4)))
-			done=1; 			/* tear line and down go into tail */
-		if(done && cr && !strncmp((char *)fbuf+l,"SEEN-BY:",8)) {
-			l+=8;
-			while(l<length && fbuf[l]<=SP) l++;
-			m=l;
-			while(m<length && fbuf[m]!=CR) m++;
-			while(m && fbuf[m-1]<=SP) m--;
-			if(m>l)
-				smb_hfield(&msg,FIDOSEENBY,m-l,fbuf+l);
-			while(l<length && fbuf[l]!=CR) l++;
-			continue; }
-		if(done)
-			stail[taillen++]=ch;
-		else
-			sbody[bodylen++]=ch;
-		col++;
-		if(ch==CR) {
-			cr=1;
-			col=0;
-			if(done)
-				stail[taillen++]=LF;
-			else
-				sbody[bodylen++]=LF; }
-		else {
-			cr=0;
-			if(col==1 && !strncmp((char *)fbuf+l," * Origin: ",11)) {
-				p=strchr((char *)fbuf+l+11,CR); 	 /* find carriage return */
-				while(p && *p!='(') p--;     /* rewind to '(' */
-				if(p)
-					origaddr=atofaddr(p+1); 	/* get orig address */
-				done=1; }
-			if(done)
-				continue;
-
-			if(ch==ESC) esc=1;		/* ANSI codes */
-			if(ch==SP && col>40 && !esc) {	/* word wrap */
-				for(m=l+1;m<length;m++) 	/* find next space */
-					if(fbuf[m]<=SP)
-						break;
-				if(m<length && m-l>80-col) {  /* if it's beyond the eol */
-					sbody[bodylen++]=CR;
-					sbody[bodylen++]=LF;
-					col=0; } }
-			} } }
-
-LFREE(fbuf);
-
-if(bodylen>=2 && sbody[bodylen-2]==CR && sbody[bodylen-1]==LF)
-	bodylen-=2; 						/* remove last CRLF if present */
-
-if(status.max_crcs) {
-	for(l=0,crc=0xffffffff;l<bodylen;l++)
-		crc=ucrc32(sbody[l],crc);
-	crc=~crc;
-
-	i=smb_addcrc(status.max_crcs,crc,10);
-	if(i) {
-		if(i==1)
-			lprintf("Duplicate message\r\n");
-		else
-			lprintf("smb_addcrc returned %d\r\n",i);
-		smb_freemsgmem(msg);
-		LFREE(sbody);
-		LFREE(stail);
-		return; } }
-
-while(taillen && stail[taillen-1]<=SP)	/* trim all garbage off the tail */
-	taillen--;
-
-net=NET_FIDO;	/* Record origin address */
-smb_hfield(&msg,SENDERNETTYPE,sizeof(ushort),&net);
-smb_hfield(&msg,SENDERNETADDR,sizeof(fidoaddr_t),&origaddr);
-
-if(subnum==INVALID_SUB) { /* No origin line means NetMail, so add dest addr */
-	smb_hfield(&msg,RECIPIENTNETTYPE,sizeof(ushort),&net);
-	smb_hfield(&msg,RECIPIENTNETADDR,sizeof(fidoaddr_t),&destaddr); }
-
-if(subnum!=INVALID_SUB && sub[subnum]->misc&SUB_LZH
-	&& bodylen+2+taillen+2>=SDT_BLOCK_LEN && bodylen) {
-	if((outbuf=(char *)LMALLOC(bodylen*2))==NULL) {
-		printf("alloc error for lzh: %lu\n",bodylen*2);
-		smb_freemsgmem(msg);
-		LFREE(sbody);
-		LFREE(stail);
-		return; }
-	lzhlen=lzh_encode((uchar *)sbody,bodylen,(uchar *)outbuf);
-	if(lzhlen>1 &&
-		smb_datblocks(lzhlen+4+taillen+2)<smb_datblocks(bodylen+2+taillen+2)) {
-		bodylen=lzhlen; 	/* Compressable */
-		l=bodylen+4;
-		LFREE(sbody);
-		lzh=1;
-		sbody=outbuf; }
-	else {					/* Uncompressable */
-		l=bodylen+2;
-		LFREE(outbuf); } }
-else
-	l=bodylen+2;
-
-if(taillen)
-	l+=(taillen+2);
-
-
-if(status.attr&SMB_HYPERALLOC) {
-	if((i=smb_locksmbhdr(10))!=0) {
-		printf("smb_locksmbhdr returned %d\n",i);
-		smb_freemsgmem(msg);
-		LFREE(sbody);
-		LFREE(stail);
-		return; }
-	msg.hdr.offset=smb_hallocdat();
-	storage=SMB_HYPERALLOC; }
-else {
-	if(smb_open_da(10)) {
-		smb_freemsgmem(msg);
-		printf("error opening %s.SDA\r\n",smb_file);
-		LFREE(sbody);
-		LFREE(stail);
-		return; }
-	if(subnum!=INVALID_SUB && sub[subnum]->misc&SUB_FAST) {
-		msg.hdr.offset=smb_fallocdat(l,1);
-		storage=SMB_FASTALLOC; }
-	else {
-		msg.hdr.offset=smb_allocdat(l,1);
-		storage=SMB_SELFPACK; }
-	fclose(sda_fp); }
-
-if(msg.hdr.offset && msg.hdr.offset<1L) {
-	smb_unlocksmbhdr();
-	smb_freemsgmem(msg);
-	LFREE(sbody);
-	LFREE(stail);
-	printf("error %ld allocating records\r\n",msg.hdr.offset);
-	return; }
-fseek(sdt_fp,msg.hdr.offset,SEEK_SET);
-if(lzh) {
-	xlat=XLAT_LZH;
-	fwrite(&xlat,2,1,sdt_fp); }
-xlat=XLAT_NONE;
-fwrite(&xlat,2,1,sdt_fp);
-chunk=30000;
-for(l=0;l<bodylen;l+=chunk) {
-	if(l+chunk>bodylen)
-		chunk=bodylen-l;
-	fwrite(sbody+l,1,chunk,sdt_fp); }
-if(taillen) {
-	fwrite(&xlat,2,1,sdt_fp);
-	fwrite(stail,1,taillen,sdt_fp); }
-fflush(sdt_fp);
-LFREE(sbody);
-LFREE(stail);
-
-if(status.attr&SMB_HYPERALLOC)
-	smb_unlocksmbhdr();
-
-if(lzh)
-	bodylen+=2;
-bodylen+=2;
-smb_dfield(&msg,TEXT_BODY,bodylen);
-if(taillen)
-	smb_dfield(&msg,TEXT_TAIL,taillen+2);
-
-smb_addmsghdr(&msg,&status,storage,10);
-smb_freemsgmem(msg);
-}
-
-/****************************************************************/
-/* Get zone and point from kludge lines in 'file' if they exist */
-/****************************************************************/
-void getzpt(int file, fmsghdr_t *hdr)
-{
-	char buf[0x1000];
-	int i,len,cr=0;
-	faddr_t faddr;
-
-len=read(file,buf,0x1000);
-for(i=0;i<len;i++) {
-	if((!i || cr) && buf[i]==1) {	/* kludge */
-		if(!strncmp(buf+i+1,"TOPT ",5))
-			hdr->destpoint=atoi(buf+i+6);
-		else if(!strncmp(buf+i+1,"FMPT ",5))
-			hdr->origpoint=atoi(buf+i+6);
-		else if(!strncmp(buf+i+1,"INTL ",5)) {
-			faddr=atofaddr(buf+i+6);
-			hdr->destzone=faddr.zone;
-			hdr->destnet=faddr.net;
-			hdr->destnode=faddr.node;
-			i+=6;
-			while(buf[i] && buf[i]!=SP) i++;
-			faddr=atofaddr(buf+i+1);
-			hdr->origzone=faddr.zone;
-			hdr->orignet=faddr.net;
-			hdr->orignode=faddr.node; }
-		while(i<len && buf[i]!=CR) i++;
-		cr=1;
-		continue; }
-	if(buf[i]==CR)
-		cr=1;
-	else
-		cr=0; }
-lseek(file,sizeof(fmsghdr_t),SEEK_SET);
-}
-
-/***********************************/
-/* Synchronet/FidoNet Message util */
-/***********************************/
-int main(int argc, char **argv)
-{
-	char	ch,str[512],fname[256],touser[512],subj[512],path[512],sub_code[9]
-			,*p,*tp,*sp,*buf,*outbuf,cr,tear,lzh;
-	ushort	xlat;
-	int 	i,j,k,n,x,last,file,fmsg,nextmsg,g;
-	ulong	files,msgfiles,echomail=0,netmail=0,exported=0,crc,
-			l,m,length,lastmsg,posts,msgs,exp;
-	time_t	ptr,now,start,lastimport;
-	read_cfg_text_t txt;
-	struct	find_t ff;
-	struct	tm tm,*tm_p;
-	fmsghdr_t hdr;
-	faddr_t addr,sys_faddr;
-	post_t	HUGE16 *post;
-	FILE	*stream,*fstream;
-	smbstatus_t status;
-	smbmsg_t msg;
-
-lprintf("\nSynchronet <=> FidoNet Utility  Version %s  "
-	"Developed by Rob Swindell\n",VER);
-
-putenv("TZ=UCT0");
-_fmode=O_BINARY;
-setvbuf(stdout,NULL,_IONBF,0);
-
-txt.openerr="\7\r\nError opening %s for read.\r\n";
-txt.reading="\r\nReading %s...";
-txt.readit="\rRead %s       ";
-txt.allocerr="\7\r\nError allocating %u bytes of memory\r\n";
-txt.error="\7\r\nERROR: Offset %lu in %s\r\n\r\n";
-
-node_dir[0]=sub_code[0]=0;
-for(i=1;i<argc;i++) {
-	if(argv[i][0]=='/') {
-		j=1;
-		while(argv[i][j]) {
-			switch(toupper(argv[i][j])) {
-				case 'A':
-                    misc|=ASCII_ONLY;
-                    break;
-				case 'B':
-					misc|=LOCAL_NETMAIL;
-					break;
-				case 'C':
-                    misc|=PURGE_ECHOMAIL;
-                    break;
-				case 'D':
-                    misc&=~DELETE_NETMAIL;
-                    break;
-				case 'E':
-                    misc&=~EXPORT_ECHOMAIL;
-                    break;
-				case 'F':
-                    misc|=IMPORT_LOCAL;
-                    break;
-				case 'G':
-                    misc|=IMPORT_NEW_ONLY;
-                    break;
-				case 'H':
-                    misc|=EXPORT_ALL;
-                    break;
-				case 'I':
-                    misc&=~IMPORT_ECHOMAIL;
-                    break;
-                case 'J':
-                    misc|=IGNORE_RECV;
-                    break;
-				case 'K':
-                    misc&=~KILL_ECHOMAIL;
-                    break;
-                case 'L':
-                    misc|=LOGFILE;
-                    break;
-				case 'M':
-                    misc|=IGNORE_MSGPTRS;
-                    break;
-				case 'N':
-					misc&=~IMPORT_NETMAIL;
-					break;
-				case 'O':
-                    misc|=IGNORE_ADDRESS;
-                    break;
-				case 'P':
-					misc|=IGNORE_POINT;
-					break;
-				case 'Q':
-					misc|=DONT_SET_RECV;
-					break;
-				case 'R':
-                    misc|=REPORT;
-                    break;
-				case 'S':
-                    misc|=IMPORT_PRIVATE;
-                    break;
-				case 'T':
-                    misc|=LEAVE_MSGPTRS;
-                    break;
-                case 'U':
-                    misc|=UPDATE_MSGPTRS;
-                    misc&=~EXPORT_ECHOMAIL;
-                    break;
-				case 'X':
-                    misc&=~DELETE_ECHOMAIL;
-                    break;
-                case 'Y':
-                    misc|=UNKNOWN_NETMAIL;
-                    break;
-				case 'Z':
-                    misc|=IGNORE_ZONE;
-                    break;
-
-				case '=':
-					misc|=CONVERT_TEAR;
-					break;
-				case '!':
-					misc|=NOTIFY_RECEIPT;
-					break;
-				case '2':
-					startmsg=2;
-					break;
-				default:
-					printf("\nusage: sbbsfido [sbbsnode] [/switches] "
-						"[sub_code]");
-					printf("\nwhere: sbbsnode is the path for your "
-						"NODE1 directory (example: c:\\sbbs\\node1)\n");
-					printf("       sub_code is the internal code for a "
-						"sub-board (default is ALL subs)\n");
-					printf("\nvalid switches:\n\n");
-					printf("n:do not import netmail               "
-						   "i:do not import echomail\n");
-					printf("p:ignore point in netmail address     "
-						   "e:do not export echomail\n");
-					printf("z:ignore zone in netmail address      "
-						   "h:export all echomail (hub rescan)\n");
-					printf("o:ignore entire netmail address       "
-						   "m:ignore message pointers (export all)\n");
-					printf("y:import netmail for unknown users    "
-						   "u:update message pointers (export none)\n");
-					printf("d:do not delete netmail after import  "
-						   "x:do not delete echomail after import\n");
-					printf("l:output to SBBSFIDO.LOG (verbose)    "
-						   "k:do not kill echomail after export\n");
-					printf("r:create report of import totals      "
-						   "t:do not update message pointers\n");
-					printf("a:export ASCII characters only        "
-						   "c:delete all messages (echomail purge)\n");
-					printf("j:ignore recieved bit on import       "
-						   "s:import private override (strip pvt)\n");
-					printf("q:do not set received bit on import   "
-                           "g:import new echomail only\n");
-					printf("b:import locally created netmail too  "
-                           "f:import locally created echomail too\n");
-					printf("=:change existing tear lines to ===   "
-                           "2:export/import/delete starting at 2.MSG\n");
-					printf("!:notify users of received echomail\n");
-					exit(0); }
-			j++; } }
-	else {
-		if(strchr(argv[i],'\\') || argv[i][1]==':')
-			sprintf(node_dir,"%.40s",argv[i]);
-		else
-			sprintf(sub_code,"%.8s",argv[i]); }  }
-
-if(!node_dir[0]) {
-	p=getenv("SBBSNODE");
-	if(p==NULL) {
-		printf("\7\nSBBSNODE environment variable not set.\n");
-		exit(1); }
-	strcpy(node_dir,p); }
-
-strupr(node_dir);
-
-if(node_dir[strlen(node_dir)-1]!='\\')
-	strcat(node_dir,"\\");
-
-read_node_cfg(txt);
-if(ctrl_dir[0]=='.') {   /* Relative path */
-	strcpy(str,ctrl_dir);
-	sprintf(ctrl_dir,"%s%s",node_dir,str);
-	if(_fullpath(str,ctrl_dir,40))
-		strcpy(ctrl_dir,str); }
-backslash(ctrl_dir);
-
-read_main_cfg(txt);
-if(data_dir[0]=='.') {   /* Relative path */
-	strcpy(str,data_dir);
-	sprintf(data_dir,"%s%s",node_dir,str);
-	if(_fullpath(str,data_dir,40))
-		strcpy(data_dir,str); }
-backslash(data_dir);
-if(text_dir[0]=='.') {   /* Relative path */
-	strcpy(str,text_dir);
-	sprintf(text_dir,"%s%s",node_dir,str);
-	if(_fullpath(str,text_dir,40))
-		strcpy(text_dir,str); }
-backslash(text_dir);
-read_msgs_cfg(txt);
-
-if(total_faddrs<1) {
-	sys_faddr.zone=sys_faddr.net=sys_faddr.node=1;
-	sys_faddr.point=0; }
-else
-	sys_faddr=faddr[0];
-
-
-if(misc&LOGFILE)
-	if((fidologfile=fnopen(&i,"SBBSFIDO.LOG"
-		,O_WRONLY|O_APPEND|O_CREAT))==NULL) {
-		lprintf("\7ERROR opening SBBSFIDO.LOG\r\n");
-		exit(1); }
-
-sprintf(str,"%s%s",ctrl_dir,"NODE.DAB");
-if((nodefile=sopen(str,O_BINARY|O_RDWR,SH_DENYNO))==-1) {
-	lprintf("\r\n\7Error opening %s\r\n",str);
-    exit(1); }
-
-if(misc&IMPORT_NETMAIL) {
-
-lputs("\r\n\r\nScanning for Inbound NetMail...\r\n");
-
-sprintf(smb_file,"%sMAIL",data_dir);
-if((i=smb_open(10))!=0) {
-	lprintf("Error %d opening %s\r\n",i,smb_file);
-	exit(1); }
-
-if(!filelength(fileno(shd_fp)))
-	if((i=smb_create(mail_maxcrcs,MAX_SYSMAIL,mail_maxage,SMB_EMAIL,10))!=0) {
-		lprintf("Error %d creating %s\r\n",i,smb_file);
-		exit(1); }
-
-if((i=smb_locksmbhdr(10))!=0) {
-	lprintf("Error %d locking %s\r\n",i,smb_file);
-	exit(1); }
-if((i=smb_getstatus(&status))!=0) {
-	lprintf("Error %d reading %s status header\r\n",i,smb_file);
-	exit(1); }
-smb_unlocksmbhdr();
-
-sprintf(str,"%s*.MSG",netmail_dir);
-
-for(last=findfirst(str,&ff,0);!last;last=findnext(&ff)) {
-	sprintf(path,"%s%s",netmail_dir,ff.name);
-	strupr(path);
-	lprintf("\r%s    ",path);
-	if((fmsg=nopen(path,O_RDWR))==-1) {
-		lprintf("\7ERROR opening");
-		continue; }
-	if(filelength(fmsg)<sizeof(fmsghdr_t)) {
-		lprintf("\7Invalid length of %u bytes\r\n",filelength(fmsg));
-		close(fmsg);
-		continue; }
-	if(read(fmsg,&hdr,sizeof(fmsghdr_t))!=sizeof(fmsghdr_t)) {
-		close(fmsg);
-		lprintf("\7ERROR reading %u bytes"
-			,sizeof(fmsghdr_t));
-		continue; }
-	if(hdr.attr&FIDO_ORPHAN) {
-		close(fmsg);
-		lprintf("Orphan (%s).\r\n",hdr.to);
-		continue; }
-	if(misc&IGNORE_ZONE)				/* default to system's zone */
-		hdr.destzone=hdr.origzone=sys_faddr.zone;
-	if(misc&IGNORE_POINT)				/* default to no point */
-		hdr.destpoint=hdr.origpoint=0;
-	getzpt(fmsg,&hdr);					/* use kludge if found */
-	for(i=0;i<total_faddrs;i++)
-		if(hdr.destzone==faddr[i].zone
-			&& hdr.destnet==faddr[i].net
-			&& hdr.destnode==faddr[i].node
-			&& hdr.destpoint==faddr[i].point)
-			break;
-	lprintf("%u:%u/%u.%u  "
-		,hdr.destzone,hdr.destnet,hdr.destnode,hdr.destpoint);
-	if(misc&IGNORE_ADDRESS || i<total_faddrs) {
-		if(!(misc&IGNORE_RECV) && hdr.attr&FIDO_RECV) {
-            close(fmsg);
-			lputs("Already received.\r\n");
-            continue; }
-		if(hdr.attr&FIDO_LOCAL && !(misc&LOCAL_NETMAIL)) {
-			close(fmsg);
-			lputs("Created locally.\r\n");
-			continue; }
-		i=atoi(hdr.to);
-		if(!stricmp(hdr.to,"SYSOP"))  /* NetMail to "sysop" goes to #1 */
-			i=1;
-		if(!i)
-			i=matchname(hdr.to);
-		if(!i) {
-			if(misc&UNKNOWN_NETMAIL)	/* receive unknown user mail to 1 */
-				i=1;
-			else {
-				lprintf("\7ERROR unknown user '%s'\r\n",hdr.to);
-				hdr.attr|=FIDO_ORPHAN;
-				lseek(fmsg,0L,SEEK_SET);
-				write(fmsg,&hdr,sizeof(fmsghdr_t));
-				close(fmsg);
-				continue; } }
-		lprintf("%s\r\n",hdr.to);
-
-		/*********************/
-		/* Importing NetMail */
-		/*********************/
-
-		fmsgtosmsg(fmsg,hdr,status,i,INVALID_SUB);
-
-		addr.zone=hdr.origzone;
-		addr.net=hdr.orignet;
-		addr.node=hdr.orignode;
-		addr.point=hdr.origpoint;
-		sprintf(str,"\7\1n\1hSBBSFIDO: \1m%.36s \1n\1msent you NetMail from "
-			"\1h%s\1n\r\n"
-			,hdr.from,faddrtoa(addr));
-		putsmsg(i,str);
-
-		if(hdr.attr&FIDO_FILE) {	/* File attachment */
-			strcpy(subj,hdr.subj);
-			tp=subj;
-			while(1) {
-				p=strchr(tp,SP);
-				if(p) *p=0;
-				sp=strrchr(tp,'/');              /* sp is slash pointer */
-				if(!sp) sp=strrchr(tp,'\\');
-				if(sp) tp=sp+1;
-				sprintf(str,"%s%s",fidofile_dir,tp);
-				sprintf(tmp,"%sFILE\\%04u.IN",data_dir,i);
-				mkdir(tmp);
-				strcat(tmp,"\\");
-				strcat(tmp,tp);
-				mv(str,tmp,0);
-				if(!p)
-					break;
-				tp=p+1; } }
-		netmail++;
-
-		/***************************/
-		/* Updating message header */
-		/***************************/
-		if(!(misc&DONT_SET_RECV)) {
-			hdr.attr|=FIDO_RECV;
-			lseek(fmsg,0L,SEEK_SET);
-			write(fmsg,&hdr,sizeof(fmsghdr_t)); }
-
-		/**************************************/
-		/* Delete source netmail if specified */
-		/**************************************/
-		close(fmsg);
-		if(misc&DELETE_NETMAIL)
-			remove(path); }
-	else
-		close(fmsg); }
-smb_close(); }
-
-
-if(misc&IMPORT_ECHOMAIL) {
-
-start=time(NULL);
-
-lputs("\r\n\r\nScanning for Inbound EchoMail...\r\n");
-
-sprintf(path,"%sSBBSFIDO.DAB",data_dir);
-if((file=nopen(path,O_RDWR|O_CREAT))==-1)
-	lastimport=0L;
-else {
-	read(file,&lastimport,4);
-	now=time(NULL);
-	lseek(file,0L,SEEK_SET);
-	write(file,&now,4);
-	close(file); }
-
-for(g=files=0;g<total_grps;g++)
-for(i=0;i<total_subs;i++)
-	if(sub[i]->misc&SUB_FIDO && sub[i]->grp==g) {
-		if(sub_code[0] && stricmp(sub_code,sub[i]->code))
-			continue;
-		if(!sub[i]->echopath[0])
-			sprintf(sub[i]->echopath,"%s%s\\",echomail_dir,sub[i]->code);
-		if(files) {
-			lputs("\r\n");
-			files=0; }
-		lprintf("\r\n%-15.15s %s\r\n"
-			,grp[sub[i]->grp]->sname,sub[i]->lname);
-
-		sprintf(path,"%s*.MSG",sub[i]->echopath);
-		l=findfirst(path,&ff,0);
-		if(startmsg==2 && !strcmp(ff.name,"1.MSG"))
-			l=findnext(&ff);
-		if(l)
-			continue;
-		lprintf("Counting %s",path);
-		msgfiles=0;
-		while(!l) {
-			memset(&tm,0,sizeof(tm));
-			tm.tm_mday=ff.wr_date&31;
-			tm.tm_mon=(ff.wr_date>>5)&15;
-			tm.tm_year=80+((ff.wr_date>>9)&127);
-			tm.tm_hour=(ff.wr_time>>11)&31;
-			tm.tm_min=(ff.wr_time>>5)&63;
-			tm.tm_sec=(ff.wr_time&0x1f)<<1;
-			if(isdigit(ff.name[0])
-				&& !(startmsg==2 && !strcmp(ff.name,"1.MSG"))
-				&& !(misc&IMPORT_NEW_ONLY && mktime(&tm)<=lastimport))
-				msgfiles++; 		/* msgfiles= messages to import */
-			l=findnext(&ff); }
-
-		lprintf("\r\n%u messages.\r\n",msgfiles);
-		if(!msgfiles)				/* no messages, so continue. */
-			continue;
-
-		sprintf(smb_file,"%s%s",sub[i]->data_dir,sub[i]->code);
-		if((j=smb_open(10))!=0) {
-			lprintf("Error %d opening %s\r\n",j,smb_file);
-			continue; }
-		if(!filelength(fileno(shd_fp)))
-			if((j=smb_create(sub[i]->maxcrcs,sub[i]->maxmsgs
-				,sub[i]->maxage
-				,sub[i]->misc&SUB_HYPER ? SMB_HYPERALLOC:0
-				,10))!=0) {
-				lprintf("Error %d creating %s\r\n",j,smb_file);
-				smb_close();
-				continue; }
-
-		if((j=smb_locksmbhdr(10))!=0) {
-			lprintf("Error %d locking SMB header\r\n",j);
-			smb_close();
-			continue; }
-		if((j=smb_getstatus(&status))!=0) {
-			lprintf("Error %d reading SMB header\r\n",j);
-			smb_close();
-			continue; }
-		smb_unlocksmbhdr();
-
-		for(l=startmsg;l<0x8000 && msgfiles;l++) {
-			sprintf(path,"%s%lu.MSG",sub[i]->echopath,l);
-			if(findfirst(path,&ff,0))	/* doesn't exist */
-				continue;				/* was break */
-			tm.tm_mday=ff.wr_date&31;
-			tm.tm_mon=(ff.wr_date>>5)&15;
-			tm.tm_year=80+((ff.wr_date>>9)&127);
-			tm.tm_hour=(ff.wr_time>>11)&31;
-			tm.tm_min=(ff.wr_time>>5)&63;
-			tm.tm_sec=(ff.wr_time&0x1f)<<1;
-			if(misc&IMPORT_NEW_ONLY && mktime(&tm)<=lastimport)
-				continue;
-			if(startmsg==2 && !strcmp(ff.name,"1.MSG"))
-				continue;
-			msgfiles--; 		/* so we only look for as many as are there */
-			strupr(path);
-			lprintf("\r%s    ",path);
-			files++;
-			if((fmsg=nopen(path,O_RDWR))==-1) {
-				lprintf("\7ERROR opening\r\n");
-				continue; }
-			if(filelength(fmsg)<sizeof(fmsghdr_t)) {
-				lprintf("\7Invalid length of %u bytes\r\n",filelength(fmsg));
-				close(fmsg);
-				continue; }
-			if(read(fmsg,&hdr,sizeof(fmsghdr_t))!=sizeof(fmsghdr_t)) {
-				close(fmsg);
-				lprintf("\7ERROR reading %u bytes\r\n"
-					,sizeof(fmsghdr_t));
-				continue; }
-			if(misc&IMPORT_LOCAL || !(hdr.attr&FIDO_LOCAL)) {
-
-				if(!(misc&IGNORE_RECV) && hdr.attr&FIDO_RECV) {
-					close(fmsg);
-					lputs("Already received.\r\n");
-					continue; }
-
-				if(hdr.attr&FIDO_SENT) {
-					close(fmsg);
-					lputs("Sent.");
-					if(hdr.attr&FIDO_KILLSENT)
-						if(!remove(path))
-							lputs(" Killed.");
-					lputs("\r\n");
-					continue; }
-
-				if(hdr.attr&FIDO_PRIVATE && !(sub[i]->misc&SUB_PRIV)) {
-					if(misc&IMPORT_PRIVATE)
-						hdr.attr&=~FIDO_PRIVATE;
-					else {
-						close(fmsg);
-						lputs("Private posts disallowed.\r\n");
-						continue; } }
-
-				if(!(hdr.attr&FIDO_PRIVATE) && sub[i]->misc&SUB_PONLY)
-					hdr.attr|=MSG_PRIVATE;
-
-				/**********************/
-				/* Importing EchoMail */
-				/**********************/
-
-				fmsgtosmsg(fmsg,hdr,status,0,i);
-
-				echomail++;
-
-				/* Updating message header */
-				if(!(misc&DONT_SET_RECV)) {
-					hdr.attr|=FIDO_RECV;
-					lseek(fmsg,0L,SEEK_SET);
-					write(fmsg,&hdr,sizeof(fmsghdr_t)); }
-
-				close(fmsg);
-				if(misc&NOTIFY_RECEIPT && (m=matchname(hdr.to))!=0) {
-					sprintf(str
-					,"\7\1n\1hSBBSFIDO: \1m%.36s \1n\1msent you EchoMail on "
-						"\1h%s \1n\1m%s\1n\r\n"
-						,hdr.from,grp[sub[i]->grp]->sname,sub[i]->sname);
-					putsmsg(m,str); }
-
-				/* Delete source EchoMail if specified */
-				if(misc&DELETE_ECHOMAIL)
-					remove(path); }
-			else
-				close(fmsg); }
-		smb_close();
-		}
-
-now=time(NULL);
-if(now-start)
-	lprintf("\r\nImported %lu EchoMail messages in %lu seconds "
-		"(%lu messages/second).\r\n"
-		,echomail,now-start,echomail/(now-start));
-}
-
-if(misc&EXPORT_ECHOMAIL) {
-
-start=time(NULL);
-
-lputs("\r\n\r\nScanning for Outbound EchoMail...\r\n");
-
-for(g=files=0;g<total_grps;g++)
-for(i=0;i<total_subs;i++)
-	if(sub[i]->misc&SUB_FIDO && sub[i]->grp==g) {
-		if(sub_code[0] && stricmp(sub_code,sub[i]->code))
-            continue;
-		if(!sub[i]->echopath[0])
-            sprintf(sub[i]->echopath,"%s%s\\",echomail_dir,sub[i]->code);
-		if(files) {
-			lputs("\r\n");
-			files=0; }
-		lprintf("\r\n%-15.15s %s\r\n"
-			,grp[sub[i]->grp]->sname,sub[i]->lname);
-		ptr=0;
-		if(!(misc&IGNORE_MSGPTRS)) {
-			sprintf(str,"%s%s.SFP",sub[i]->data_dir,sub[i]->code);
-			if((file=nopen(str,O_RDONLY))!=-1) {
-				read(file,&ptr,sizeof(time_t));
-				close(file); } }
-
-		msgs=getlastmsg(i,&lastmsg,0);
-		if(!msgs || (!(misc&IGNORE_MSGPTRS) && ptr>=lastmsg)) {
-			if(ptr>lastmsg && !(misc&LEAVE_MSGPTRS)) {	/* fix ptr */
-                sprintf(str,"%s%s.SFP",sub[i]->data_dir,sub[i]->code);
-				if((file=nopen(str,O_WRONLY|O_CREAT))==-1)
-					lprintf("\7ERROR opening/creating %s",str);
-				else {
-					write(file,&lastmsg,4);
-					close(file); } }
-			continue; }
-		nextmsg=startmsg;
-
-		sprintf(smb_file,"%s%s"
-			,sub[i]->data_dir,sub[i]->code);
-		if((j=smb_open(10))!=0) {
-			lprintf("Error %d opening %s\r\n",j,smb_file);
-			continue; }
-
-		post=NULL;
-		posts=loadmsgs(&post,ptr);
-
-		if(!posts)	{ /* no new messages */
-			smb_close();
-			if(post)
-				FREE(post);
-			continue; }
-
-		for(m=exp=0;m<posts;m++) {
-			printf("\rScanning: %lu of %lu     "
-				,m+1,posts);
-
-			msg.idx.offset=post[m].offset;
-			if((k=smb_lockmsghdr(msg,10))!=0) {
-				lprintf("ERR_LOCK %s %d\r\n",smb_file,k);
-				continue; }
-			k=smb_getmsghdr(&msg);
-			if(k || msg.hdr.number!=post[m].number) {
-				smb_unlockmsghdr(msg);
-				smb_freemsgmem(msg);
-
-				msg.hdr.number=post[m].number;
-				if((k=smb_getmsgidx(&msg))!=0) {
-					lprintf("ERR_READ %s %d\r\n",smb_file,k);
-					continue; }
-				if((k=smb_lockmsghdr(msg,10))!=0) {
-					lprintf("ERR_LOCK %s %d\r\n",smb_file,k);
-					continue; }
-				if((k=smb_getmsghdr(&msg))!=0) {
-					smb_unlockmsghdr(msg);
-					lprintf("ERR_READ %s %d\r\n",smb_file,k);
-					continue; } }
-
-			if((!(misc&EXPORT_ALL) && msg.from_net.type==NET_FIDO)
-				|| !strnicmp(msg.subj,"NE:",3)) {   /* no echo */
-				smb_unlockmsghdr(msg);
-				smb_freemsgmem(msg);
-				continue; }  /* From a Fido node, ignore it */
-
-			if(msg.from_net.type && msg.from_net.type!=NET_FIDO
-				&& !(sub[i]->misc&SUB_GATE)) {
-				smb_unlockmsghdr(msg);
-				smb_freemsgmem(msg);
-				continue; }
-
-			for(j=nextmsg;j;j++) {
-				sprintf(fname,"%s%u.MSG",sub[i]->echopath,j);
-				if(!fexist(fname))
-					break; }
-			if(!j) {
-				lputs("\7EchoMail dir full!");
-				smb_unlockmsghdr(msg);
-				smb_freemsgmem(msg);
-				continue; }
-			nextmsg=j+1;
-			strupr(fname);
-			if((fmsg=nopen(fname,O_WRONLY|O_CREAT))==-1) {
-				smb_unlockmsghdr(msg);
-				smb_freemsgmem(msg);
-				lprintf("\7ERROR creating %s\r\n",fname);
-				continue; }
-			if((fstream=fdopen(fmsg,"wb"))==NULL) {
-				close(fmsg);
-				smb_unlockmsghdr(msg);
-                smb_freemsgmem(msg);
-				lprintf("\7ERROR fdopen %s\r\n",fname);
-				continue; }
-			setvbuf(fstream,NULL,_IOFBF,2048);
-
-			files++;
-
-			memset(&hdr,0,sizeof(fmsghdr_t));	 /* Zero the header */
-			hdr.origzone=sub[i]->faddr.zone;
-			hdr.orignet=sub[i]->faddr.net;
-			hdr.orignode=sub[i]->faddr.node;
-			hdr.origpoint=sub[i]->faddr.point;
-
-			hdr.attr=FIDO_LOCAL;
-			if(misc&KILL_ECHOMAIL)
-				hdr.attr|=FIDO_KILLSENT;
-			if(msg.hdr.attr&MSG_PRIVATE)
-				hdr.attr|=FIDO_PRIVATE;
-
-			sprintf(hdr.from,"%.35s",msg.from);
-
-			tm_p=gmtime((time_t *)&msg.hdr.when_written.time);
-			sprintf(hdr.time,"%02u %3.3s %02u  %02u:%02u:%02u"
-				,tm_p->tm_mday,mon[tm_p->tm_mon],tm_p->tm_year%100
-				,tm_p->tm_hour,tm_p->tm_min,tm_p->tm_sec);
-
-			sprintf(hdr.to,"%.35s",msg.to);
-
-			sprintf(hdr.subj,"%.71s",msg.subj);
-
-			fwrite(&hdr,sizeof(fmsghdr_t),1,fstream);
-
-			for(j=0;j<msg.hdr.total_dfields;j++) {
-
-				if(msg.dfield[j].type!=TEXT_BODY
-					&& msg.dfield[j].type!=TEXT_TAIL)
-					continue;					/* skip non-text data fields */
-
-				if(msg.dfield[j].length<3)		/* need at least 3 bytes */
-					continue;
-
-				fseek(sdt_fp,msg.hdr.offset+msg.dfield[j].offset,SEEK_SET);
-
-				lzh=0;
-				fread(&xlat,2,1,sdt_fp);
-				if(xlat==XLAT_LZH) {
-					lzh=1;
-					fread(&xlat,2,1,sdt_fp); }
-				if(xlat!=XLAT_NONE) 	/* no other translations supported */
-					continue;
-
-				length=msg.dfield[j].length-2;
-				if(lzh)
-					length-=2;
-
-				if((buf=LMALLOC(length))==NULL) {
-					lprintf("Error allocating %lu bytes\r\n",length);
-					continue; }
-
-				fread(buf,length,1,sdt_fp);
-
-				if(lzh) {
-					l=*(long *)buf;
-					if((outbuf=LMALLOC(l))==NULL) {
-						lprintf("Error allocationg %lu for lzh\r\n",l);
-						LFREE(buf);
-						continue; }
-					length=lzh_decode(buf,length,outbuf);
-					LFREE(buf);
-					buf=outbuf; }
-
-				tear=0;
-				for(l=0,cr=1;l<length;l++) {
-					if(buf[l]==1) { /* Ctrl-A, so skip it and the next char */
-                        l++;
-						continue; }
-					if(buf[l]==LF || buf[l]==0)  /* Ignore line feeds */
-						continue;
-					if(cr) {
-						if(l+3<length && buf[l]=='-' && buf[l+1]=='-'
-							&& buf[l+2]=='-'
-							&& (buf[l+3]==SP || buf[l+3]==CR)) {
-							if(misc&CONVERT_TEAR)	/* Convert to === */
-								buf[l]=buf[l+1]=buf[l+2]='=';
-							else
-								tear=1; }
-						else if(l+10<length
-							&& !strncmp(buf+l," * Origin: ",11))
-							buf[l+1]='#'; } /* Convert * Origin into # Origin */
-
-					if(buf[l]==CR)
-						cr=1;
-					else
-						cr=0;
-					if(sub[i]->misc&SUB_ASCII || misc&ASCII_ONLY) {
-						if(buf[l]<SP && buf[l]!=CR) /* Ctrl ascii */
-							buf[l]='.';             /* converted to '.' */
-						if((uchar)buf[l]>0x7f)		/* extended ASCII */
-							buf[l]='*'; }           /* converted to '*' */
-					fputc(buf[l],fstream); }
-				fprintf(fstream,"\r\n");
-				LFREE(buf); }
-
-			if(!(sub[i]->misc&SUB_NOTAG)) {
-				if(!tear)	/* No previous tear line */
-					fprintf(fstream,"--- Synchronet+SBBSfido v%s\r\n"
-						,VER);	/* so add ours */
-				fprintf(fstream," * Origin: %s (%s)\r\n"
-					,sub[i]->origline[0] ? sub[i]->origline : origline
-					,faddrtoa(sub[i]->faddr)); }
-
-			fputc(0,fstream);	/* Null terminator */
-			fclose(fstream);
-			exported++;
-			exp++;
-			printf("Exported: %lu of %lu",exp,exported);
-			smb_unlockmsghdr(msg);
-			smb_freemsgmem(msg); }
-
-		smb_close();
-		FREE(post);
-
-		/***********************/
-		/* Update FIDO_PTR.DAB */
-		/***********************/
-		if(!(misc&LEAVE_MSGPTRS) && lastmsg>ptr) {
-			sprintf(str,"%s%s.SFP",sub[i]->data_dir,sub[i]->code);
-			if((file=nopen(str,O_WRONLY|O_CREAT))==-1)
-				lprintf("\7ERROR opening/creating %s",str);
-			else {
-				write(file,&lastmsg,4);
-				close(file); } } }
-
-now=time(NULL);
-if(now-start)
-	lprintf("\r\nExported %lu EchoMail messages in %lu seconds "
-		"(%lu messages/second).\r\n"
-		,exported,now-start,exported/(now-start));
-
-}
-
-if(misc&UPDATE_MSGPTRS) {
-
-lputs("\r\n\r\nUpdating Message Pointers to Last Posted Message...\r\n");
-
-for(g=0;g<total_grps;g++)
-for(i=0;i<total_subs;i++)
-	if(sub[i]->misc&SUB_FIDO && sub[i]->grp==g) {
-		lprintf("\r\n%-15.15s %s\r\n"
-			,grp[sub[i]->grp]->sname,sub[i]->lname);
-		getlastmsg(i,&l,0);
-		sprintf(str,"%s%s.SFP",sub[i]->data_dir,sub[i]->code);
-		if((file=nopen(str,O_WRONLY|O_CREAT))==-1)
-			lprintf("\7ERROR opening/creating %s",str);
-		else {
-			write(file,&l,sizeof(time_t));
-			close(file); } } }
-
-if(misc&PURGE_ECHOMAIL) {
-
-lputs("\r\n\r\nPurging EchoMail...\r\n");
-
-for(g=0;g<total_grps;g++)
-for(i=0;i<total_subs;i++)
-	if(sub[i]->misc&SUB_FIDO && sub[i]->grp==g) {
-		if(sub_code[0] && stricmp(sub_code,sub[i]->code))
-            continue;
-		if(!sub[i]->echopath[0])
-            sprintf(sub[i]->echopath,"%s%s\\",echomail_dir,sub[i]->code);
-		sprintf(str,"%s*.MSG",sub[i]->echopath);
-		last=findfirst(str,&ff,0);
-		while(!last) {
-			sprintf(str,"%s%s",sub[i]->echopath,ff.name);
-			if(startmsg!=2 || strcmp(ff.name,"1.MSG")) {
-				lprintf("\r\nDeleting %s",str);
-				remove(str); }
-			last=findnext(&ff); } } }
-
-
-if(misc&(IMPORT_NETMAIL|IMPORT_ECHOMAIL) && misc&REPORT) {
-	sprintf(str,"%sSBBSFIDO.MSG",text_dir);
-	if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1) {
-		lprintf("Error opening %s\r\n",str);
-		exit(1); }
-	sprintf(fname,"\1c\1h               "
-		"���������������������������������������������������\r\n");
-	sprintf(path,"\1c\1h               "
-		"���������������������������������������������������\r\n");
-	write(file,fname,strlen(fname));
-	sprintf(str,"               \1n\1k\0016"
-		" Last FidoNet Transfer on %.24s \1n\r\n",ctime(&start));
-	write(file,str,strlen(str));
-	write(file,path,strlen(path));
-	write(file,fname,strlen(fname));
-	sprintf(subj,"Imported %lu EchoMail and %lu NetMail Messages"
-		,echomail,netmail);
-	sprintf(str,"               \1n\1k\0016 %-50.50s\1n\r\n",subj);
-	write(file,str,strlen(str));
-	write(file,path,strlen(path));
-	close(file); }
-
-return(0);
-}
-
diff --git a/src/sbbs2/fido/smbdefs.h b/src/sbbs2/fido/smbdefs.h
deleted file mode 100644
index 71791e69524fa58b43bf4ecbe9f495c6d237407e..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/smbdefs.h
+++ /dev/null
@@ -1,449 +0,0 @@
-/* SMBDEFS.H */
-
-#ifndef _SMBDEFS_H
-#define _SMBDEFS_H
-
-/**********/
-/* Macros */
-/**********/
-
-#define SMB_VERSION 		0x0121		/* SMB format version */
-										/* High byte major, low byte minor */
-#define SMBLIB_VERSION		"1.21a"     /* SMB library version */
-
-										/* Control characters */
-#define TAB 				0x09		/* Horizontal tabulation	^I */
-#define LF					0x0a		/* Line feed				^J */
-#define FF					0x0c		/* Form feed				^L */
-#define CR					0x0d		/* Carriage return			^M */
-#define ESC 				0x1b		/* Escape					^[ */
-#define SP					0x20		/* Space					   */
-
-#define ulong				unsigned long
-#define ushort				unsigned short
-#define uchar				unsigned char
-#define uint				unsigned int
-
-/****************************************************************************/
-/* Memory allocation macros for various compilers and environments			*/
-/* MALLOC is used for allocations of 64k or less							*/
-/* FREE is used to free buffers allocated with MALLOC						*/
-/* LMALLOC is used for allocations of possibly larger than 64k				*/
-/* LFREE is used to free buffers allocated with LMALLOC 					*/
-/* REALLOC is used to re-size a previously MALLOCed or LMALLOCed buffer 	*/
-/****************************************************************************/
-#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
-#	define HUGE16 huge
-#	define FAR16 far
-#	if defined(__TURBOC__)
-#		define REALLOC(x,y) farrealloc(x,y)
-#		define LMALLOC(x) farmalloc(x)
-#		define MALLOC(x) farmalloc(x)
-#		define LFREE(x) farfree(x)
-#		define FREE(x) farfree(x)
-#	elif defined(__WATCOMC__)
-#		define REALLOC realloc
-#		define LMALLOC(x) halloc(x,1)  /* far heap, but slow */
-#		define MALLOC malloc		   /* far heap, but 64k max */
-#		define LFREE hfree
-#		define FREE free
-#	else	/* Other 16-bit Compiler */
-#		define REALLOC realloc
-#		define LMALLOC malloc
-#		define MALLOC malloc
-#		define LFREE free
-#		define FREE free
-#	endif
-#else		/* 32-bit Compiler or Small Memory Model */
-#	define HUGE16
-#	define FAR16
-#	define REALLOC realloc
-#	define LMALLOC malloc
-#	define MALLOC malloc
-#	define LFREE free
-#	define FREE free
-#endif
-
-
-#define SDT_BLOCK_LEN		256 		/* Size of data blocks */
-#define SHD_BLOCK_LEN		256 		/* Size of header blocks */
-
-#define SMB_SELFPACK		0			/* Self-packing storage allocation */
-#define SMB_FASTALLOC		1			/* Fast allocation */
-#define SMB_HYPERALLOC		2			/* No allocation */
-
-#define SMB_EMAIL			1			/* User numbers stored in Indexes */
-
-										/* Time zone macros for when_t.zone */
-#define DAYLIGHT			0x8000		/* Daylight savings is active */
-#define US_ZONE 			0x4000		/* U.S. time zone */
-#define WESTERN_ZONE		0x2000		/* Non-standard zone west of UT */
-#define EASTERN_ZONE		0x1000		/* Non-standard zone east of UT */
-
-										/* US Time Zones (standard) */
-#define AST 				0x40F0		// Atlantic 			(-04:00)
-#define EST 				0x412C		// Eastern				(-05:00)
-#define CST 				0x4168		// Central				(-06:00)
-#define MST 				0x41A4		// Mountain 			(-07:00)
-#define PST 				0x41E0		// Pacific				(-08:00)
-#define YST 				0x421C		// Yukon				(-09:00)
-#define HST 				0x4258		// Hawaii/Alaska		(-10:00)
-#define BST 				0x4294		// Bering				(-11:00)
-
-										/* US Time Zones (daylight) */
-#define ADT 				0xC0F0		// Atlantic 			(-03:00)
-#define EDT 				0xC12C		// Eastern				(-04:00)
-#define CDT 				0xC168		// Central				(-05:00)
-#define MDT 				0xC1A4		// Mountain 			(-06:00)
-#define PDT 				0xC1E0		// Pacific				(-07:00)
-#define YDT 				0xC21C		// Yukon				(-08:00)
-#define HDT 				0xC258		// Hawaii/Alaska		(-09:00)
-#define BDT 				0xC294		// Bering				(-10:00)
-
-										/* Non-standard Time Zones */
-#define MID 				0x2294		// Midway				(-11:00)
-#define VAN 				0x21E0		// Vancouver			(-08:00)
-#define EDM 				0x21A4		// Edmonton 			(-07:00)
-#define WIN 				0x2168		// Winnipeg 			(-06:00)
-#define BOG 				0x212C		// Bogota				(-05:00)
-#define CAR 				0x20F0		// Caracas				(-04:00)
-#define RIO 				0x20B4		// Rio de Janeiro		(-03:00)
-#define FER 				0x2078		// Fernando de Noronha	(-02:00)
-#define AZO 				0x203C		// Azores				(-01:00)
-#define LON 				0x1000		// London				(+00:00)
-#define BER 				0x103C		// Berlin				(+01:00)
-#define ATH 				0x1078		// Athens				(+02:00)
-#define MOS 				0x10B4		// Moscow				(+03:00)
-#define DUB 				0x10F0		// Dubai				(+04:00)
-#define KAB 				0x110E		// Kabul				(+04:30)
-#define KAR 				0x112C		// Karachi				(+05:00)
-#define BOM 				0x114A		// Bombay				(+05:30)
-#define KAT 				0x1159		// Kathmandu			(+05:45)
-#define DHA 				0x1168		// Dhaka				(+06:00)
-#define BAN 				0x11A4		// Bangkok				(+07:00)
-#define HON 				0x11E0		// Hong Kong			(+08:00)
-#define TOK 				0x121C		// Tokyo				(+09:00)
-#define SYD 				0x1258		// Sydney				(+10:00)
-#define NOU 				0x1294		// Noumea				(+11:00)
-#define WEL 				0x12D0		// Wellington			(+12:00)
-
-										/* Valid hfield_t.types */
-#define SENDER				0x00
-#define SENDERAGENT 		0x01
-#define SENDERNETTYPE		0x02
-#define SENDERNETADDR		0x03
-#define SENDEREXT			0x04
-#define SENDERPOS			0x05
-#define SENDERORG			0x06
-
-#define AUTHOR				0x10
-#define AUTHORAGENT 		0x11
-#define AUTHORNETTYPE		0x12
-#define AUTHORNETADDR		0x13
-#define AUTHOREXT			0x14
-#define AUTHORPOS			0x15
-#define AUTHORORG			0x16
-
-#define REPLYTO 			0x20
-#define REPLYTOAGENT		0x21
-#define REPLYTONETTYPE		0x22
-#define REPLYTONETADDR		0x23
-#define REPLYTOEXT			0x24
-#define REPLYTOPOS			0x25
-#define REPLYTOORG			0x26
-
-#define RECIPIENT			0x30
-#define RECIPIENTAGENT		0x31
-#define RECIPIENTNETTYPE	0x32
-#define RECIPIENTNETADDR	0x33
-#define RECIPIENTEXT		0x34
-#define RECIPIENTPOS		0x35
-#define RECIPIENTORG		0x36
-
-#define FORWARDTO			0x40
-#define FORWARDTOAGENT		0x41
-#define FORWARDTONETTYPE	0x42
-#define FORWARDTONETADDR	0x43
-#define FORWARDTOEXT		0x44
-#define FORWARDTOPOS		0x45
-#define FORWARDTOORG		0x46
-
-#define FORWARDED			0x48
-
-#define RECEIVEDBY			0x50
-#define RECEIVEDBYAGENT 	0x51
-#define RECEIVEDBYNETTYPE	0x52
-#define RECEIVEDBYNETADDR	0x53
-#define RECEIVEDBYEXT		0x54
-#define RECEIVEDBYPOS		0x55
-#define RECEIVEDBYORG		0x56
-
-#define RECEIVED			0x58
-
-#define SUBJECT 			0x60
-#define SUMMARY 			0x61
-#define COMMENT 			0x62
-#define CARBONCOPY			0x63
-#define GROUP				0x64
-#define EXPIRATION			0x65
-#define PRIORITY			0x66
-
-#define FILEATTACH			0x70
-#define DESTFILE			0x71
-#define FILEATTACHLIST		0x72
-#define DESTFILELIST		0x73
-#define FILEREQUEST 		0x74
-#define FILEPASSWORD		0x75
-#define FILEREQUESTLIST 	0x76
-#define FILEPASSWORDLIST	0x77
-
-#define IMAGEATTACH 		0x80
-#define ANIMATTACH			0x81
-#define FONTATTACH			0x82
-#define SOUNDATTACH 		0x83
-#define PRESENTATTACH		0x84
-#define VIDEOATTACH 		0x85
-#define APPDATAATTACH		0x86
-
-#define IMAGETRIGGER		0x90
-#define ANIMTRIGGER 		0x91
-#define FONTTRIGGER 		0x92
-#define SOUNDTRIGGER		0x93
-#define PRESENTTRIGGER		0x94
-#define VIDEOTRIGGER		0x95
-#define APPDATATRIGGER		0x96
-
-#define FIDOCTRL			0xa0
-#define FIDOAREA			0xa1
-#define FIDOSEENBY			0xa2
-#define FIDOPATH			0xa3
-#define FIDOMSGID			0xa4
-#define FIDOREPLYID 		0xa5
-#define FIDOPID 			0xa6
-#define FIDOFLAGS			0xa7
-
-#define RFC822HEADER		0xb0
-#define RFC822MSGID 		0xb1
-#define RFC822REPLYID		0xb2
-
-#define UNKNOWN 			0xf1
-#define UNKNOWNASCII		0xf2
-#define UNUSED				0xff
-
-										/* Valid dfield_t.types */
-#define TEXT_BODY			0x00
-#define TEXT_SOUL			0x01
-#define TEXT_TAIL			0x02
-#define TEXT_WING			0x03
-#define IMAGEEMBED			0x20
-#define ANIMEMBED			0x21
-#define FONTEMBED			0x22
-#define SOUNDEMBED			0x23
-#define PRESENTEMBED		0x24
-#define VIDEOEMBED			0x25
-#define APPDATAEMBED		0x26
-#define UNUSED				0xff
-
-
-										/* Message attributes */
-#define MSG_PRIVATE 		(1<<0)
-#define MSG_READ			(1<<1)
-#define MSG_PERMANENT		(1<<2)
-#define MSG_LOCKED			(1<<3)
-#define MSG_DELETE			(1<<4)
-#define MSG_ANONYMOUS		(1<<5)
-#define MSG_KILLREAD		(1<<6)
-#define MSG_MODERATED		(1<<7)
-#define MSG_VALIDATED		(1<<8)
-
-										/* Auxillary header attributes */
-#define MSG_FILEREQUEST 	(1<<0)		// File request
-#define MSG_FILEATTACH		(1<<1)		// File(s) attached to Msg
-#define MSG_TRUNCFILE		(1<<2)		// Truncate file(s) when sent
-#define MSG_KILLFILE		(1<<3)		// Delete file(s) when sent
-#define MSG_RECEIPTREQ		(1<<4)		// Return receipt requested
-#define MSG_CONFIRMREQ		(1<<5)		// Confirmation receipt requested
-#define MSG_NODISP			(1<<6)		// Msg may not be displayed to user
-
-										/* Message network attributes */
-#define MSG_LOCAL			(1<<0)		// Msg created locally
-#define MSG_INTRANSIT		(1<<1)		// Msg is in-transit
-#define MSG_SENT			(1<<2)		// Sent to remote
-#define MSG_KILLSENT		(1<<3)		// Kill when sent
-#define MSG_ARCHIVESENT 	(1<<4)		// Archive when sent
-#define MSG_HOLD			(1<<5)		// Hold for pick-up
-#define MSG_CRASH			(1<<6)		// Crash
-#define MSG_IMMEDIATE		(1<<7)		// Send Msg now, ignore restrictions
-#define MSG_DIRECT			(1<<8)		// Send directly to destination
-#define MSG_GATE			(1<<9)		// Send via gateway
-#define MSG_ORPHAN			(1<<10) 	// Unknown destination
-#define MSG_FPU 			(1<<11) 	// Force pickup
-#define MSG_TYPELOCAL		(1<<12) 	// Msg is for local use only
-#define MSG_TYPEECHO		(1<<13) 	// Msg is for conference distribution
-#define MSG_TYPENET 		(1<<14) 	// Msg is direct network mail
-
-
-enum {
-     NET_NONE
-    ,NET_UNKNOWN
-    ,NET_FIDO
-    ,NET_POSTLINK
-    ,NET_QWK
-	,NET_INTERNET
-	,NET_WWIV
-	,NET_MHS
-
-/* Add new ones here */
-
-    ,NET_TYPES
-    };
-
-enum {
-     AGENT_PERSON
-    ,AGENT_PROCESS
-
-/* Add new ones here */
-
-    ,AGENT_TYPES
-    };
-
-enum {
-     XLAT_NONE              // No translation/End of translation list
-    ,XLAT_ENCRYPT           // Encrypted data
-    ,XLAT_ESCAPED           // 7-bit ASCII escaping for ctrl and 8-bit data
-    ,XLAT_HUFFMAN           // Static and adaptive Huffman coding compression
-    ,XLAT_LZW               // Limpel/Ziv/Welch compression
-    ,XLAT_MLZ78             // Modified LZ78 compression
-    ,XLAT_RLE               // Run length encoding compression
-    ,XLAT_IMPLODE           // Implode compression (PkZIP)
-    ,XLAT_SHRINK            // Shrink compression (PkZIP)
-	,XLAT_LZH				// LHarc (LHA) Dynamic Huffman coding
-
-/* Add new ones here */
-
-    ,XLAT_TYPES
-    };
-
-
-/************/
-/* Typedefs */
-/************/
-
-typedef struct {
-
-	ulong	time;			// Local time (unix format)
-	short	zone;			// Time zone
-
-	} when_t;
-
-typedef struct {
-
-	ushort	to; 			// 16-bit CRC of recipient name (lower case)
-	ushort	from;			// 16-bit CRC of sender name (lower case)
-	ushort	subj;			// 16-bit CRC of subject (lower case, w/o RE:)
-	ushort	attr;			// attributes (read, permanent, etc.)
-	ulong	offset; 		// offset into header file
-	ulong	number; 		// number of message (1 based)
-	ulong	time;			// time/date message was imported/posted
-
-	} idxrec_t;
-
-typedef struct {
-
-    uchar   id[4];          // text or binary unique hdr ID
-    ushort  version;        // version number (initially 100h for 1.00)
-    ushort  length;         // length including this struct
-
-	} smbhdr_t;
-
-typedef struct {
-
-	ulong	last_msg;		// last message number
-	ulong	total_msgs; 	// total messages
-	ulong	header_offset;	// byte offset to first header record
-	ulong	max_crcs;		// Maximum number of CRCs to keep in history
-    ulong   max_msgs;       // Maximum number of message to keep in sub
-    ushort  max_age;        // Maximum age of message to keep in sub (in days)
-	ushort	attr;			// Attributes for this message base (SMB_HYPER,etc)
-
-	} smbstatus_t;
-
-typedef struct {
-
-	uchar	id[4];			// SHD<^Z>
-    ushort  type;           // Message type (normally 0)
-    ushort  version;        // Version of type (initially 100h for 1.00)
-    ushort  length;         // Total length of fixed record + all fields
-	ushort	attr;			// Attributes (bit field) (duped in SID)
-	ulong	auxattr;		// Auxillary attributes (bit field)
-    ulong   netattr;        // Network attributes
-	when_t	when_written;	// Time message was written (unix format)
-	when_t	when_imported;	// Time message was imported
-    ulong   number;         // Message number
-    ulong   thread_orig;    // Original message number in thread
-    ulong   thread_next;    // Next message in thread
-    ulong   thread_first;   // First reply to this message
-	uchar	reserved[16];	// Reserved for future use
-    ulong   offset;         // Offset for buffer into data file (0 or mod 256)
-	ushort	total_dfields;	// Total number of data fields
-
-	} msghdr_t;
-
-typedef struct {
-
-	ushort	type;			// Type of data field
-    ulong   offset;         // Offset into buffer 
-    ulong   length;         // Length of data field
-
-    } dfield_t;
-
-typedef struct {
-
-	ushort	type;
-	ushort	length; 		// Length of buffer
-
-	} hfield_t;
-
-typedef struct {
-
-	ushort	zone;
-	ushort	net;
-	ushort	node;
-	ushort	point;
-
-    } fidoaddr_t;
-
-typedef struct {
-
-    ushort  type;
-	void	*addr;
-
-	} net_t;
-
-typedef struct {
-
-	idxrec_t	idx;			// Index
-	msghdr_t	hdr;			// Header record (fixed portion)
-	uchar		*to,			// To name
-				*to_ext,		// To extension
-				*from,			// From name
-				*from_ext,		// From extension
-				*replyto,		// Reply-to name
-				*replyto_ext,	// Reply-to extension */
-				*subj;			// Subject
-	ushort		to_agent,		// Type of agent message is to
-				from_agent, 	// Type of agent message is from
-				replyto_agent;	// Type of agent replies should be sent to
-	net_t		to_net, 		// Destination network type and address
-                from_net,       // Origin network address
-                replyto_net;    // Network type and address for replies
-	ushort		total_hfields;	// Total number of header fields
-	hfield_t	*hfield;		// Header fields (fixed length portion)
-	void		**hfield_dat;	// Header fields (variable length portion)
-	dfield_t	*dfield;		// Data fields (fixed length portion)
-	ulong		offset; 		// Offset (number of records) into index
-	uchar		forwarded;		// Forwarded from agent to another
-
-	} smbmsg_t;
-
-#endif /* Don't add anything after this #endif statement */
diff --git a/src/sbbs2/fido/smblib.c b/src/sbbs2/fido/smblib.c
deleted file mode 100644
index e2d8a474b875feec0a6efaa1f49a01650ab396a9..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/smblib.c
+++ /dev/null
@@ -1,1121 +0,0 @@
-/* SMBLIB.C */
-
-#include "smblib.h"
-
-/****************************************************************************/
-/* Open a message base of name 'smb_file'                                   */
-/* If retry_time is 0, fast open method (no compatibility/validity check)	*/
-/* Opens files for READing messages or updating message indices only        */
-/****************************************************************************/
-int smb_open(int retry_time)
-{
-    int file;
-    char str[128];
-	smbhdr_t hdr;
-
-shd_fp=sdt_fp=sid_fp=NULL;
-sprintf(str,"%s.SHD",smb_file);
-if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYNO,S_IWRITE|S_IREAD))==-1
-	|| (shd_fp=fdopen(file,"r+b"))==NULL) {
-	if(file!=-1)
-		close(file);
-    return(2); }
-
-if(retry_time && filelength(file)>=sizeof(smbhdr_t)) {
-	setvbuf(shd_fp,shd_buf,_IONBF,SHD_BLOCK_LEN);
-    if(smb_locksmbhdr(retry_time)) {
-		smb_close();
-        return(-1); }
-	memset(&hdr,0,sizeof(smbhdr_t));
-    fread(&hdr,sizeof(smbhdr_t),1,shd_fp);
-    if(memcmp(hdr.id,"SMB\x1a",4)) {
-		smb_close();
-        return(-2); }
-    if(hdr.version<0x110) {         /* Compatibility check */
-		smb_close();
-        return(-3); }
-    smb_unlocksmbhdr();
-	rewind(shd_fp); }
-
-setvbuf(shd_fp,shd_buf,_IOFBF,SHD_BLOCK_LEN);
-
-sprintf(str,"%s.SDT",smb_file);
-if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYNO,S_IWRITE|S_IREAD))==-1
-	|| (sdt_fp=fdopen(file,"r+b"))==NULL) {
-	if(file!=-1)
-		close(file);
-	smb_close();
-	return(1); }
-setvbuf(sdt_fp,NULL,_IOFBF,2*1024);
-
-sprintf(str,"%s.SID",smb_file);
-if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYNO,S_IWRITE|S_IREAD))==-1
-	|| (sid_fp=fdopen(file,"r+b"))==NULL) {
-	if(file!=-1)
-		close(file);
-	smb_close();
-	return(3); }
-setvbuf(sid_fp,NULL,_IOFBF,2*1024);
-
-return(0);
-}
-
-/****************************************************************************/
-/* Closes the currently open message base									*/
-/****************************************************************************/
-void smb_close(void)
-{
-if(shd_fp!=NULL) {
-	smb_unlocksmbhdr(); 			/* In case it's been locked */
-	fclose(shd_fp); }
-if(sid_fp!=NULL)
-	fclose(sid_fp);
-if(sdt_fp!=NULL)
-	fclose(sdt_fp);
-sid_fp=shd_fp=sdt_fp=NULL;
-}
-
-/****************************************************************************/
-/* Opens the data block allocation table message base 'smb_file'            */
-/* Retrys for retry_time number of seconds									*/
-/* Return 0 on success, non-zero otherwise									*/
-/****************************************************************************/
-int smb_open_da(int retry_time)
-{
-    int file;
-    char str[128];
-	long start;
-
-start=time(NULL);
-sprintf(str,"%s.SDA",smb_file);
-while(1) {
-	if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYRW,S_IWRITE|S_IREAD))!=-1)
-		break;
-	if(errno!=EACCES)
-		return(-1);
-	if(time(NULL)-start>=retry_time)
-		return(-2); }
-if((sda_fp=fdopen(file,"r+b"))==NULL)
-	return(-3);
-setvbuf(sda_fp,NULL,_IOFBF,2*1024);
-return(0);
-}
-
-/****************************************************************************/
-/* Opens the header block allocation table for message base 'smb_file'      */
-/* Retrys for retry_time number of seconds									*/
-/* Return 0 on success, non-zero otherwise									*/
-/****************************************************************************/
-int smb_open_ha(int retry_time)
-{
-    int file;
-    char str[128];
-	long start;
-
-start=time(NULL);
-sprintf(str,"%s.SHA",smb_file);
-while(1) {
-	if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYRW,S_IWRITE|S_IREAD))!=-1)
-		break;
-	if(errno!=EACCES)
-		return(-1);
-	if(time(NULL)-start>=retry_time)
-		return(-2); }
-if((sha_fp=fdopen(file,"r+b"))==NULL)
-	return(-3);
-setvbuf(sha_fp,NULL,_IOFBF,2*1024);
-return(0);
-}
-
-/****************************************************************************/
-/* If the parameter 'push' is non-zero, this function stores the currently  */
-/* open message base to the "virtual" smb stack. Up to SMB_STACK_LEN        */
-/* message bases may be stored (defined in SMBDEFS.H).						*/
-/* The parameter 'op' is the operation to perform on the stack. Either      */
-/* SMB_STACK_PUSH, SMB_STACK_POP, or SMB_STACK_XCHNG						*/
-/* If the operation is SMB_STACK_POP, this function restores a message base */
-/* previously saved with a SMB_STACK_PUSH call to this same function.		*/
-/* If the operation is SMB_STACK_XCHNG, then the current message base is	*/
-/* exchanged with the message base on the top of the stack (most recently	*/
-/* pushed.																	*/
-/* If the current message base is not open, the SMB_STACK_PUSH and			*/
-/* SMB_STACK_XCHNG operations do nothing									*/
-/* Returns 0 on success, non-zero if stack full.                            */
-/* If operation is SMB_STACK_POP or SMB_STACK_XCHNG, it always returns 0.	*/
-/****************************************************************************/
-int smb_stack(int op)
-{
-	static char stack_file[SMB_STACK_LEN][128];
-	static FILE *stack_sdt[SMB_STACK_LEN],
-				*stack_shd[SMB_STACK_LEN],
-				*stack_sid[SMB_STACK_LEN],
-				*stack_sda[SMB_STACK_LEN],
-				*stack_sha[SMB_STACK_LEN];
-	static int	stack_idx;
-	char		tmp_file[128];
-	FILE		*tmp_sdt,
-				*tmp_shd,
-				*tmp_sid,
-				*tmp_sda,
-				*tmp_sha;
-
-if(op==SMB_STACK_PUSH) {
-	if(stack_idx>=SMB_STACK_LEN)
-		return(1);
-	if(shd_fp==NULL || sdt_fp==NULL || sid_fp==NULL) /* Msg base not open */
-		return(0);
-	memcpy(stack_file[stack_idx],smb_file,128);
-	stack_sdt[stack_idx]=sdt_fp;
-	stack_shd[stack_idx]=shd_fp;
-	stack_sid[stack_idx]=sid_fp;
-	stack_sda[stack_idx]=sda_fp;
-	stack_sha[stack_idx]=sha_fp;
-	stack_idx++;
-	return(0); }
-/* pop or xchng */
-if(!stack_idx)	/* Nothing on the stack, so do nothing */
-	return(0);
-if(op==SMB_STACK_XCHNG) {
-	if(!shd_fp)
-		return(0);
-	memcpy(tmp_file,smb_file,128);
-	tmp_sdt=sdt_fp;
-	tmp_shd=shd_fp;
-	tmp_sid=sid_fp;
-	tmp_sda=sda_fp;
-	tmp_sha=sha_fp; }
-
-stack_idx--;
-memcpy(smb_file,stack_file[stack_idx],128);
-sdt_fp=stack_sdt[stack_idx];
-shd_fp=stack_shd[stack_idx];
-sid_fp=stack_sid[stack_idx];
-sda_fp=stack_sda[stack_idx];
-sha_fp=stack_sha[stack_idx];
-if(op==SMB_STACK_XCHNG) {
-	stack_idx++;
-	memcpy(stack_file[stack_idx-1],tmp_file,128);
-	stack_sdt[stack_idx-1]=tmp_sdt;
-	stack_shd[stack_idx-1]=tmp_shd;
-	stack_sid[stack_idx-1]=tmp_sid;
-	stack_sda[stack_idx-1]=tmp_sda;
-	stack_sha[stack_idx-1]=tmp_sha; }
-return(0);
-}
-
-/****************************************************************************/
-/* Truncates header file													*/
-/* Retrys for retry_time number of seconds									*/
-/* Return 0 on success, non-zero otherwise									*/
-/****************************************************************************/
-int smb_trunchdr(int retry_time)
-{
-	long start;
-
-start=time(NULL);
-rewind(shd_fp);
-while(1) {
-	if(!chsize(fileno(shd_fp),0L))
-		break;
-	if(errno!=EACCES)
-		return(-1);
-	if(time(NULL)-start>=retry_time)		/* Time-out */
-		return(-2); }
-return(0);
-}
-
-/*********************************/
-/* Message Base Header Functions */
-/*********************************/
-
-/****************************************************************************/
-/* Attempts for retry_time number of seconds to lock the message base hdr	*/
-/****************************************************************************/
-int smb_locksmbhdr(int retry_time)
-{
-	ulong start;
-
-start=time(NULL);
-while(1) {
-	if(!lock(fileno(shd_fp),0L,sizeof(smbhdr_t)+sizeof(smbstatus_t)))
-		return(0);
-	if(time(NULL)-start>=retry_time)
-		break;							/* Incase we've already locked it */
-	unlock(fileno(shd_fp),0L,sizeof(smbhdr_t)+sizeof(smbstatus_t)); }
-return(-1);
-}
-
-/****************************************************************************/
-/* Read the SMB header from the header file and place into "status"         */
-/****************************************************************************/
-int smb_getstatus(smbstatus_t *status)
-{
-    char    str[128];
-	int 	i;
-
-setvbuf(shd_fp,shd_buf,_IONBF,SHD_BLOCK_LEN);
-clearerr(shd_fp);
-fseek(shd_fp,sizeof(smbhdr_t),SEEK_SET);
-i=fread(status,1,sizeof(smbstatus_t),shd_fp);
-setvbuf(shd_fp,shd_buf,_IOFBF,SHD_BLOCK_LEN);
-if(i==sizeof(smbstatus_t))
-	return(0);
-return(1);
-}
-
-/****************************************************************************/
-/* Writes message base header												*/
-/****************************************************************************/
-int smb_putstatus(smbstatus_t status)
-{
-	int i;
-
-clearerr(shd_fp);
-fseek(shd_fp,sizeof(smbhdr_t),SEEK_SET);
-i=fwrite(&status,1,sizeof(smbstatus_t),shd_fp);
-fflush(shd_fp);
-if(i==sizeof(smbstatus_t))
-	return(0);
-return(1);
-}
-
-/****************************************************************************/
-/* Unlocks previously locks message base header 							*/
-/****************************************************************************/
-int smb_unlocksmbhdr()
-{
-return(unlock(fileno(shd_fp),0L,sizeof(smbhdr_t)+sizeof(smbstatus_t)));
-}
-
-/********************************/
-/* Individual Message Functions */
-/********************************/
-
-/****************************************************************************/
-/* Attempts for retry_time number of seconds to lock the header for 'msg'   */
-/****************************************************************************/
-int smb_lockmsghdr(smbmsg_t msg, int retry_time)
-{
-    ulong start;
-
-start=time(NULL);
-while(1) {
-	if(!lock(fileno(shd_fp),msg.idx.offset,sizeof(msghdr_t)))
-        return(0);
-    if(time(NULL)-start>=retry_time)
-		break;
-	unlock(fileno(shd_fp),msg.idx.offset,sizeof(msghdr_t)); }
-return(-1);
-}
-
-/****************************************************************************/
-/* Fills msg->idx with message index based on msg->hdr.number				*/
-/* OR if msg->hdr.number is 0, based on msg->offset (record offset).		*/
-/* if msg.hdr.number does not equal 0, then msg->offset is filled too.		*/
-/* Either msg->hdr.number or msg->offset must be initialized before 		*/
-/* calling this function													*/
-/* Returns 1 if message number wasn't found, 0 if it was                    */
-/****************************************************************************/
-int smb_getmsgidx(smbmsg_t *msg)
-{
-	idxrec_t idx;
-	ulong	 l,length,total,bot,top;
-
-clearerr(sid_fp);
-if(!msg->hdr.number) {
-	fseek(sid_fp,msg->offset*sizeof(idxrec_t),SEEK_SET);
-	if(!fread(&msg->idx,sizeof(idxrec_t),1,sid_fp))
-		return(1);
-	return(0); }
-
-length=filelength(fileno(sid_fp));
-if(!length)
-	return(1);
-total=length/sizeof(idxrec_t);
-if(!total)
-	return(1);
-
-bot=0;
-top=total;
-l=total/2; /* Start at middle index */
-while(1) {
-	fseek(sid_fp,l*sizeof(idxrec_t),SEEK_SET);
-	if(!fread(&idx,sizeof(idxrec_t),1,sid_fp))
-		return(1);
-	if(bot==top-1 && idx.number!=msg->hdr.number)
-        return(1);
-	if(idx.number>msg->hdr.number) {
-		top=l;
-		l=bot+((top-bot)/2);
-		continue; }
-	if(idx.number<msg->hdr.number) {
-		bot=l;
-		l=top-((top-bot)/2);
-		continue; }
-	break; }
-msg->idx=idx;
-msg->offset=l;
-return(0);
-}
-
-/****************************************************************************/
-/* Reads the last index record in the open message base 					*/
-/****************************************************************************/
-int smb_getlastidx(idxrec_t *idx)
-{
-	long length;
-
-clearerr(sid_fp);
-length=filelength(fileno(sid_fp));
-if(length<sizeof(idxrec_t))
-	return(-1);
-fseek(sid_fp,length-sizeof(idxrec_t),SEEK_SET);
-if(!fread(idx,sizeof(idxrec_t),1,sid_fp))
-	return(-2);
-return(0);
-}
-
-/****************************************************************************/
-/* Figures out the total length of the header record for 'msg'              */
-/* Returns length															*/
-/****************************************************************************/
-uint smb_getmsghdrlen(smbmsg_t msg)
-{
-	int i;
-
-/* fixed portion */
-msg.hdr.length=sizeof(msghdr_t);
-/* data fields */
-msg.hdr.length+=msg.hdr.total_dfields*sizeof(dfield_t);
-/* header fields */
-for(i=0;i<msg.total_hfields;i++) {
-	msg.hdr.length+=sizeof(hfield_t);
-	msg.hdr.length+=msg.hfield[i].length; }
-return(msg.hdr.length);
-}
-
-/****************************************************************************/
-/* Figures out the total length of the data buffer for 'msg'                */
-/* Returns length															*/
-/****************************************************************************/
-ulong smb_getmsgdatlen(smbmsg_t msg)
-{
-	int i;
-	ulong length=0L;
-
-for(i=0;i<msg.hdr.total_dfields;i++)
-	length+=msg.dfield[i].length;
-return(length);
-}
-
-/****************************************************************************/
-/* Read header information into 'msg' structure                             */
-/* msg->idx.offset must be set before calling this function 				*/
-/* Must call smb_freemsgmem() to free memory allocated for var len strs 	*/
-/* Returns 0 on success, non-zero if error									*/
-/****************************************************************************/
-int smb_getmsghdr(smbmsg_t *msg)
-{
-	ushort	i;
-	ulong	l,offset;
-	idxrec_t idx;
-
-rewind(shd_fp);
-fseek(shd_fp,msg->idx.offset,SEEK_SET);
-idx=msg->idx;
-offset=msg->offset;
-memset(msg,0,sizeof(smbmsg_t));
-msg->idx=idx;
-msg->offset=offset;
-if(!fread(&msg->hdr,sizeof(msghdr_t),1,shd_fp))
-	return(-1);
-if(memcmp(msg->hdr.id,"SHD\x1a",4))
-	return(-2);
-if(msg->hdr.version<0x110)
-	return(-9);
-l=sizeof(msghdr_t);
-if(msg->hdr.total_dfields && (msg->dfield
-	=(dfield_t *)MALLOC(sizeof(dfield_t)*msg->hdr.total_dfields))==NULL) {
-	smb_freemsgmem(*msg);
-	return(-3); }
-i=0;
-while(i<msg->hdr.total_dfields && l<msg->hdr.length) {
-	if(!fread(&msg->dfield[i],sizeof(dfield_t),1,shd_fp)) {
-		smb_freemsgmem(*msg);
-		return(-4); }
-	i++;
-	l+=sizeof(dfield_t); }
-if(i<msg->hdr.total_dfields) {
-	smb_freemsgmem(*msg);
-	return(-8); }
-
-while(l<msg->hdr.length) {
-	i=msg->total_hfields;
-	if((msg->hfield_dat=(void **)REALLOC(msg->hfield_dat,sizeof(void *)*(i+1)))
-		==NULL) {
-		smb_freemsgmem(*msg);
-		return(-3); }
-	if((msg->hfield=(hfield_t *)REALLOC(msg->hfield
-		,sizeof(hfield_t)*(i+1)))==NULL) {
-		smb_freemsgmem(*msg);
-		return(-3); }
-	msg->total_hfields++;
-	if(!fread(&msg->hfield[i],sizeof(hfield_t),1,shd_fp)) {
-		smb_freemsgmem(*msg);
-		return(-5); }
-	l+=sizeof(hfield_t);
-	if((msg->hfield_dat[i]=(char *)MALLOC(msg->hfield[i].length+1))
-		==NULL) {			/* Allocate 1 extra for NULL terminator */
-		smb_freemsgmem(*msg);  /* or 0 length field */
-		return(-3); }
-	memset(msg->hfield_dat[i],0,msg->hfield[i].length+1);  /* init to NULL */
-	if(msg->hfield[i].length
-		&& !fread(msg->hfield_dat[i],msg->hfield[i].length,1,shd_fp)) {
-		smb_freemsgmem(*msg);
-		return(-6); }
-
-	switch(msg->hfield[i].type) {	/* convenience variables */
-		case SENDER:
-			if(!msg->from) {
-				msg->from=msg->hfield_dat[i];
-				break; }
-		case FORWARDED: 	/* fall through */
-			msg->forwarded=1;
-			break;
-		case SENDERAGENT:
-			if(!msg->forwarded)
-				msg->from_agent=*(ushort *)msg->hfield_dat[i];
-            break;
-		case SENDEREXT:
-			if(!msg->forwarded)
-				msg->from_ext=msg->hfield_dat[i];
-			break;
-		case SENDERNETTYPE:
-			if(!msg->forwarded)
-				msg->from_net.type=*(ushort *)msg->hfield_dat[i];
-            break;
-		case SENDERNETADDR:
-			if(!msg->forwarded)
-				msg->from_net.addr=msg->hfield_dat[i];
-            break;
-		case REPLYTO:
-			msg->replyto=msg->hfield_dat[i];
-            break;
-		case REPLYTOEXT:
-			msg->replyto_ext=msg->hfield_dat[i];
-			break;
-		case REPLYTOAGENT:
-			msg->replyto_agent=*(ushort *)msg->hfield_dat[i];
-            break;
-		case REPLYTONETTYPE:
-			msg->replyto_net.type=*(ushort *)msg->hfield_dat[i];
-            break;
-		case REPLYTONETADDR:
-			msg->replyto_net.addr=msg->hfield_dat[i];
-            break;
-		case RECIPIENT:
-			msg->to=msg->hfield_dat[i];
-            break;
-		case RECIPIENTEXT:
-			msg->to_ext=msg->hfield_dat[i];
-			break;
-		case RECIPIENTAGENT:
-			msg->to_agent=*(ushort *)msg->hfield_dat[i];
-            break;
-		case RECIPIENTNETTYPE:
-			msg->to_net.type=*(ushort *)msg->hfield_dat[i];
-            break;
-		case RECIPIENTNETADDR:
-			msg->to_net.addr=msg->hfield_dat[i];
-            break;
-		case SUBJECT:
-			msg->subj=msg->hfield_dat[i];
-			break; }
-	l+=msg->hfield[i].length; }
-
-if(!msg->from || !msg->to || !msg->subj) {
-	smb_freemsgmem(*msg);
-	return(-7); }
-return(0);
-}
-
-/****************************************************************************/
-/* Frees memory allocated for 'msg'                                         */
-/****************************************************************************/
-void smb_freemsgmem(smbmsg_t msg)
-{
-	ushort	i;
-
-if(msg.dfield)
-	FREE(msg.dfield);
-for(i=0;i<msg.total_hfields;i++)
-	if(msg.hfield_dat[i])
-		FREE(msg.hfield_dat[i]);
-if(msg.hfield)
-	FREE(msg.hfield);
-if(msg.hfield_dat)
-	FREE(msg.hfield_dat);
-}
-
-/****************************************************************************/
-/* Unlocks header for 'msg'                                                 */
-/****************************************************************************/
-int smb_unlockmsghdr(smbmsg_t msg)
-{
-return(unlock(fileno(shd_fp),msg.idx.offset,sizeof(msghdr_t)));
-}
-
-
-/****************************************************************************/
-/* Adds a header field to the 'msg' structure (in memory only)              */
-/****************************************************************************/
-int smb_hfield(smbmsg_t *msg, ushort type, ushort length, void *data)
-{
-	int i;
-
-i=msg->total_hfields;
-if((msg->hfield=(hfield_t *)REALLOC(msg->hfield,sizeof(hfield_t)*(i+1)))
-	==NULL)
-	return(1);
-if((msg->hfield_dat=(void **)REALLOC(msg->hfield_dat,sizeof(void *)*(i+1)))
-	==NULL)
-	return(2);
-msg->total_hfields++;
-msg->hfield[i].type=type;
-msg->hfield[i].length=length;
-if(length) {
-	if((msg->hfield_dat[i]=(void *)MALLOC(length))==NULL)
-		return(4);
-	memcpy(msg->hfield_dat[i],data,length); }
-else
-	msg->hfield_dat[i]=NULL;
-return(0);
-}
-
-/****************************************************************************/
-/* Adds a data field to the 'msg' structure (in memory only)                */
-/* Automatically figures out the offset into the data buffer from existing	*/
-/* dfield lengths															*/
-/****************************************************************************/
-int smb_dfield(smbmsg_t *msg, ushort type, ulong length)
-{
-	int i,j;
-
-i=msg->hdr.total_dfields;
-if((msg->dfield=(dfield_t *)REALLOC(msg->dfield,sizeof(dfield_t)*(i+1)))
-	==NULL)
-	return(1);
-msg->hdr.total_dfields++;
-msg->dfield[i].type=type;
-msg->dfield[i].length=length;
-for(j=msg->dfield[i].offset=0;j<i;j++)
-	msg->dfield[i].offset+=msg->dfield[j].length;
-return(0);
-}
-
-/****************************************************************************/
-/* Checks CRC history file for duplicate crc. If found, returns 1.			*/
-/* If no dupe, adds to CRC history and returns 0, or negative if error. 	*/
-/****************************************************************************/
-int smb_addcrc(ulong max_crcs, ulong crc, int retry_time)
-{
-	char	str[128];
-	int 	file;
-	long	length;
-	ulong	l,*buf;
-	time_t	start;
-
-if(!max_crcs)
-	return(0);
-start=time(NULL);
-sprintf(str,"%s.SCH",smb_file);
-while(1) {
-	if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYRW,S_IWRITE|S_IREAD))!=-1)
-		break;
-	if(errno!=EACCES)
-		return(-1);
-	if(time(NULL)-start>=retry_time)
-        return(-2); }
-length=filelength(file);
-if(length<0L) {
-	close(file);
-	return(-4); }
-if((buf=(ulong *)MALLOC(max_crcs*4))==NULL) {
-	close(file);
-	return(-3); }
-if(length>=max_crcs*4) {			/* Reached or exceeds max crcs */
-	read(file,buf,max_crcs*4);
-	for(l=0;l<max_crcs;l++)
-		if(crc==buf[l])
-			break;
-	if(l<max_crcs) {				/* Dupe CRC found */
-		close(file);
-		FREE(buf);
-		return(1); }
-	chsize(file,0L);				/* truncate it */
-	lseek(file,0L,SEEK_SET);
-	write(file,buf+4,(max_crcs-1)*4); }
-
-else if(length/4) { 						/* Less than max crcs */
-	read(file,buf,length);
-	for(l=0;l<length/4;l++)
-		if(crc==buf[l])
-			break;
-	if(l<length/4) {					/* Dupe CRC found */
-		close(file);
-		FREE(buf);
-		return(1); } }
-
-lseek(file,0L,SEEK_END);
-write(file,&crc,4); 			   /* Write to the end */
-FREE(buf);
-close(file);
-return(0);
-}
-
-
-/****************************************************************************/
-/* Creates a new message header record in the header file.					*/
-/* If storage is SMB_SELFPACK, self-packing conservative allocation is used */
-/* If storage is SMB_FASTALLOC, fast allocation is used 					*/
-/* If storage is SMB_HYPERALLOC, no allocation tables are used (fastest)	*/
-/****************************************************************************/
-int smb_addmsghdr(smbmsg_t *msg, smbstatus_t *status, int storage
-	,int retry_time)
-{
-	int i;
-	long l;
-
-if(smb_locksmbhdr(retry_time))
-    return(1);
-if(smb_getstatus(status))
-    return(2);
-
-if(storage!=SMB_HYPERALLOC && (i=smb_open_ha(retry_time))!=0)
-    return(i);
-
-msg->hdr.length=smb_getmsghdrlen(*msg);
-if(storage==SMB_HYPERALLOC)
-	l=smb_hallochdr(status->header_offset);
-else if(storage==SMB_FASTALLOC)
-    l=smb_fallochdr(msg->hdr.length);
-else
-    l=smb_allochdr(msg->hdr.length);
-if(l==-1L) {
-	smb_unlocksmbhdr();
-	fclose(sha_fp);
-	return(-1); }
-
-status->last_msg++;
-msg->idx.number=msg->hdr.number=status->last_msg;
-msg->idx.offset=status->header_offset+l;
-msg->idx.time=msg->hdr.when_imported.time;
-msg->idx.attr=msg->hdr.attr;
-msg->offset=status->total_msgs;
-status->total_msgs++;
-smb_putstatus(*status);
-
-if(storage!=SMB_HYPERALLOC)
-	fclose(sha_fp);
-i=smb_putmsg(*msg);
-smb_unlocksmbhdr();
-return(i);
-}
-
-/****************************************************************************/
-/* Writes both header and index information for msg 'msg'                   */
-/****************************************************************************/
-int smb_putmsg(smbmsg_t msg)
-{
-	int i;
-
-i=smb_putmsghdr(msg);
-if(i)
-	return(i);
-return(smb_putmsgidx(msg));
-}
-
-/****************************************************************************/
-/* Writes index information for 'msg'                                       */
-/* msg.idx																	*/
-/* and msg.offset must be set prior to calling to this function             */
-/* Returns 0 if everything ok                                               */
-/****************************************************************************/
-int smb_putmsgidx(smbmsg_t msg)
-{
-
-clearerr(sid_fp);
-fseek(sid_fp,msg.offset*sizeof(idxrec_t),SEEK_SET);
-if(!fwrite(&msg.idx,sizeof(idxrec_t),1,sid_fp))
-	return(1);
-fflush(sid_fp);
-return(0);
-}
-
-/****************************************************************************/
-/* Writes header information for 'msg'                                      */
-/* msg.hdr.length                                                           */
-/* msg.idx.offset                                                           */
-/* and msg.offset must be set prior to calling to this function             */
-/* Returns 0 if everything ok                                               */
-/****************************************************************************/
-int smb_putmsghdr(smbmsg_t msg)
-{
-	ushort	i;
-	ulong	l;
-
-clearerr(shd_fp);
-if(fseek(shd_fp,msg.idx.offset,SEEK_SET))
-	return(-1);
-
-/************************************************/
-/* Write the fixed portion of the header record */
-/************************************************/
-if(!fwrite(&msg.hdr,sizeof(msghdr_t),1,shd_fp))
-	return(-2);
-
-/************************************************/
-/* Write the data fields (each is fixed length) */
-/************************************************/
-for(i=0;i<msg.hdr.total_dfields;i++)
-	if(!fwrite(&msg.dfield[i],sizeof(dfield_t),1,shd_fp))
-		return(-3);
-
-/*******************************************/
-/* Write the variable length header fields */
-/*******************************************/
-for(i=0;i<msg.total_hfields;i++) {
-	if(!fwrite(&msg.hfield[i],sizeof(hfield_t),1,shd_fp))
-		return(-4);
-	if(msg.hfield[i].length 					/* more then 0 bytes long */
-		&& !fwrite(msg.hfield_dat[i],msg.hfield[i].length,1,shd_fp))
-		return(-5); }
-
-l=smb_getmsghdrlen(msg);
-while(l%SHD_BLOCK_LEN) {
-	if(fputc(0,shd_fp)==EOF)
-		return(-6); 			   /* pad block with NULL */
-	l++; }
-fflush(shd_fp);
-return(0);
-}
-
-/****************************************************************************/
-/* Creates a sub-board's initial header file                                */
-/* Truncates and deletes other associated SMB files 						*/
-/****************************************************************************/
-int smb_create(ulong max_crcs, ulong max_msgs, ushort max_age, ushort attr
-	,int retry_time)
-{
-    char        str[128];
-	smbhdr_t	hdr;
-	smbstatus_t status;
-
-if(filelength(fileno(shd_fp))>=sizeof(smbhdr_t)+sizeof(smbstatus_t)
-	&& smb_locksmbhdr(retry_time))	/* header exists, so lock it */
-	return(1);
-memset(&hdr,0,sizeof(smbhdr_t));
-memset(&status,0,sizeof(smbstatus_t));
-memcpy(hdr.id,"SMB\x1a",4);     /* <S> <M> <B> <^Z> */
-hdr.version=SMB_VERSION;
-hdr.length=sizeof(smbhdr_t)+sizeof(smbstatus_t);
-status.last_msg=status.total_msgs=0;
-status.header_offset=sizeof(smbhdr_t)+sizeof(smbstatus_t);
-status.max_crcs=max_crcs;
-status.max_msgs=max_msgs;
-status.max_age=max_age;
-status.attr=attr;
-rewind(shd_fp);
-fwrite(&hdr,1,sizeof(smbhdr_t),shd_fp);
-fwrite(&status,1,sizeof(smbstatus_t),shd_fp);
-rewind(shd_fp);
-chsize(fileno(shd_fp),sizeof(smbhdr_t)+sizeof(smbstatus_t));
-fflush(shd_fp);
-
-rewind(sdt_fp);
-chsize(fileno(sdt_fp),0L);
-rewind(sid_fp);
-chsize(fileno(sid_fp),0L);
-
-sprintf(str,"%s.SDA",smb_file);
-remove(str);						/* if it exists, delete it */
-sprintf(str,"%s.SHA",smb_file);
-remove(str);                        /* if it exists, delete it */
-sprintf(str,"%s.SCH",smb_file);
-remove(str);
-smb_unlocksmbhdr();
-return(0);
-}
-
-/****************************************************************************/
-/* Returns number of data blocks required to store "length" amount of data  */
-/****************************************************************************/
-ulong smb_datblocks(ulong length)
-{
-	ulong blocks;
-
-blocks=length/SDT_BLOCK_LEN;
-if(length%SDT_BLOCK_LEN)
-	blocks++;
-return(blocks);
-}
-
-/****************************************************************************/
-/* Returns number of header blocks required to store "length" size header   */
-/****************************************************************************/
-ulong smb_hdrblocks(ulong length)
-{
-	ulong blocks;
-
-blocks=length/SHD_BLOCK_LEN;
-if(length%SHD_BLOCK_LEN)
-	blocks++;
-return(blocks);
-}
-
-/****************************************************************************/
-/* Finds unused space in data file based on block allocation table and		*/
-/* marks space as used in allocation table.                                 */
-/* File must be opened read/write DENY ALL									*/
-/* Returns offset to beginning of data (in bytes, not blocks)				*/
-/* Assumes smb_open_da() has been called									*/
-/* fclose(sda_fp) should be called after									*/
-/* Returns negative on error												*/
-/****************************************************************************/
-long smb_allocdat(ulong length, ushort headers)
-{
-    ushort  i,j;
-	ulong	l,blocks,offset=0L;
-
-blocks=smb_datblocks(length);
-j=0;	/* j is consecutive unused block counter */
-fflush(sda_fp);
-rewind(sda_fp);
-while(!feof(sda_fp)) {
-	if(!fread(&i,2,1,sda_fp))
-        break;
-	offset+=SDT_BLOCK_LEN;
-    if(!i) j++;
-    else   j=0;
-	if(j==blocks) {
-		offset-=(blocks*SDT_BLOCK_LEN);
-        break; } }
-clearerr(sda_fp);
-fseek(sda_fp,(offset/SDT_BLOCK_LEN)*2L,SEEK_SET);
-for(l=0;l<blocks;l++)
-	if(!fwrite(&headers,2,1,sda_fp))
-		return(-1);
-fflush(sda_fp);
-return(offset);
-}
-
-/****************************************************************************/
-/* Allocates space for data, but doesn't search for unused blocks           */
-/* Returns negative on error												*/
-/****************************************************************************/
-long smb_fallocdat(ulong length, ushort headers)
-{
-	ulong	l,blocks,offset;
-
-fflush(sda_fp);
-clearerr(sda_fp);
-blocks=smb_datblocks(length);
-fseek(sda_fp,0L,SEEK_END);
-offset=(ftell(sda_fp)/2L)*SDT_BLOCK_LEN;
-for(l=0;l<blocks;l++)
-	if(!fwrite(&headers,2,1,sda_fp))
-        break;
-fflush(sda_fp);
-if(l<blocks)
-	return(-1L);
-return(offset);
-}
-
-/****************************************************************************/
-/* De-allocates space for data												*/
-/* Returns non-zero on error												*/
-/****************************************************************************/
-int smb_freemsgdat(ulong offset, ulong length, ushort headers)
-{
-	ushort	i;
-	ulong	l,blocks;
-
-blocks=smb_datblocks(length);
-
-clearerr(sda_fp);
-for(l=0;l<blocks;l++) {
-	if(fseek(sda_fp,((offset/SDT_BLOCK_LEN)+l)*2L,SEEK_SET))
-		return(1);
-	if(!fread(&i,2,1,sda_fp))
-		return(2);
-	if(headers>i)
-		i=0;			/* don't want to go negative */
-	else
-		i-=headers;
-	if(fseek(sda_fp,-2L,SEEK_CUR))
-		return(3);
-	if(!fwrite(&i,2,1,sda_fp))
-		return(4); }
-fflush(sda_fp);
-return(0);
-}
-
-/****************************************************************************/
-/* Adds to data allocation records for blocks starting at 'offset'          */
-/* Returns non-zero on error												*/
-/****************************************************************************/
-int smb_incdat(ulong offset, ulong length, ushort headers)
-{
-	ushort	i;
-	ulong	l,blocks;
-
-clearerr(sda_fp);
-blocks=smb_datblocks(length);
-for(l=0;l<blocks;l++) {
-	fseek(sda_fp,((offset/SDT_BLOCK_LEN)+l)*2L,SEEK_SET);
-	if(!fread(&i,2,1,sda_fp))
-		return(1);
-	i+=headers;
-	fseek(sda_fp,-2L,SEEK_CUR);
-	if(!fwrite(&i,2,1,sda_fp))
-		return(2); }
-fflush(sda_fp);
-return(0);
-}
-
-/****************************************************************************/
-/* De-allocates blocks for header record									*/
-/* Returns non-zero on error												*/
-/****************************************************************************/
-int smb_freemsghdr(ulong offset, ulong length)
-{
-	uchar	c=0;
-	ulong	l,blocks;
-
-clearerr(sha_fp);
-blocks=smb_hdrblocks(length);
-fseek(sha_fp,offset/SHD_BLOCK_LEN,SEEK_SET);
-for(l=0;l<blocks;l++)
-	if(!fwrite(&c,1,1,sha_fp))
-		return(1);
-fflush(sha_fp);
-return(0);
-}
-
-/****************************************************************************/
-/* Frees all allocated header and data blocks for 'msg'                     */
-/****************************************************************************/
-int smb_freemsg(smbmsg_t msg, smbstatus_t status)
-{
-	int 	i;
-	ushort	x;
-
-if(status.attr&SMB_HYPERALLOC)	/* Nothing to do */
-	return(0);
-
-for(x=0;x<msg.hdr.total_dfields;x++) {
-	if((i=smb_freemsgdat(msg.hdr.offset+msg.dfield[x].offset
-		,msg.dfield[x].length,1))!=0)
-		return(i); }
-return(smb_freemsghdr(msg.idx.offset-status.header_offset,msg.hdr.length));
-}
-
-/****************************************************************************/
-/* Finds unused space in header file based on block allocation table and	*/
-/* marks space as used in allocation table.                                 */
-/* File must be opened read/write DENY ALL									*/
-/* Returns offset to beginning of header (in bytes, not blocks) 			*/
-/* Assumes smb_open_ha() has been called									*/
-/* fclose(sha_fp) should be called after									*/
-/* Returns -1L on error 													*/
-/****************************************************************************/
-long smb_allochdr(ulong length)
-{
-	uchar	c;
-	ushort	i;
-	ulong	l,blocks,offset=0;
-
-blocks=smb_hdrblocks(length);
-i=0;	/* i is consecutive unused block counter */
-fflush(sha_fp);
-rewind(sha_fp);
-while(!feof(sha_fp)) {
-	if(!fread(&c,1,1,sha_fp))
-        break;
-	offset+=SHD_BLOCK_LEN;
-	if(!c) i++;
-	else   i=0;
-	if(i==blocks) {
-		offset-=(blocks*SHD_BLOCK_LEN);
-        break; } }
-clearerr(sha_fp);
-fseek(sha_fp,offset/SHD_BLOCK_LEN,SEEK_SET);
-c=1;
-for(l=0;l<blocks;l++)
-	if(!fwrite(&c,1,1,sha_fp))
-		return(-1L);
-fflush(sha_fp);
-return(offset);
-}
-
-/****************************************************************************/
-/* Allocates space for index, but doesn't search for unused blocks          */
-/* Returns -1L on error 													*/
-/****************************************************************************/
-long smb_fallochdr(ulong length)
-{
-	uchar	c=1;
-	ulong	l,blocks,offset;
-
-blocks=smb_hdrblocks(length);
-fflush(sha_fp);
-clearerr(sha_fp);
-fseek(sha_fp,0L,SEEK_END);
-offset=ftell(sha_fp)*SHD_BLOCK_LEN;
-for(l=0;l<blocks;l++)
-	if(!fwrite(&c,1,1,sha_fp))
-		return(-1L);
-fflush(sha_fp);
-return(offset);
-}
-
-/************************************************************************/
-/* Allocate header blocks using Hyper Allocation						*/
-/* this function should be most likely not be called from anywhere but	*/
-/* smb_addmsghdr()														*/
-/************************************************************************/
-long smb_hallochdr(ulong header_offset)
-{
-	long l;
-
-fflush(shd_fp);
-fseek(shd_fp,0L,SEEK_END);
-l=ftell(shd_fp);
-if(l<header_offset) 					/* Header file truncated?!? */
-	return(header_offset);
-while((l-header_offset)%SHD_BLOCK_LEN)	/* Make sure even block boundry */
-	l++;
-return(l-header_offset);
-}
-
-/************************************************************************/
-/* Allocate data blocks using Hyper Allocation							*/
-/* smb_locksmbhdr() should be called before this function and not		*/
-/* unlocked until all data fields for this message have been written	*/
-/* to the SDT file														*/
-/************************************************************************/
-long smb_hallocdat()
-{
-	long l;
-
-fflush(sdt_fp);
-fseek(sdt_fp,0L,SEEK_END);
-l=ftell(sdt_fp);
-if(l<=0)
-	return(l);
-while(l%SDT_BLOCK_LEN)					/* Make sure even block boundry */
-	l++;
-return(l);
-}
-
-/* End of SMBLIB.C */
diff --git a/src/sbbs2/fido/smblib.h b/src/sbbs2/fido/smblib.h
deleted file mode 100644
index b682f74f039574009cd3ef2e0a77204231e8e5b7..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/smblib.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* SMBLIB.H */
-
-#ifndef _SMBLIB_H
-#define _SMBLIB_H
-
-#if defined(__WATCOMC__) || defined(__TURBOC__)
-#	include <io.h>
-#	include <mem.h>
-#	include <share.h>
-#else
-#	include <memory.h>
-#endif
-
-#ifdef __WATCOMC__
-#	include <dos.h>
-#elif defined(__TURBOC__)
-#	include <dir.h>
-#endif
-
-#include <malloc.h>
-#include <time.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#define GLOBAL extern	/* turn smbvars.c files into header */
-
-#include "smbvars.c"
-
-#define SMB_STACK_LEN		4			/* Max msg bases in smb_stack() 	*/
-#define SMB_STACK_POP       0           /* Pop a msg base off of smb_stack() */
-#define SMB_STACK_PUSH      1           /* Push a msg base onto smb_stack() */
-#define SMB_STACK_XCHNG     2           /* Exchange msg base w/last pushed */
-
-int 	smb_open(int retry_time);
-void	smb_close(void);
-int 	smb_open_da(int retry_time);
-int 	smb_open_ha(int retry_time);
-int 	smb_create(ulong max_crcs, ulong max_msgs, ushort max_age, ushort attr
-				  ,int retry_time);
-int 	smb_stack(int op);
-int 	smb_trunchdr(int retry_time);
-int 	smb_locksmbhdr(int retry_time);
-int 	smb_getstatus(smbstatus_t *status);
-int 	smb_putstatus(smbstatus_t status);
-int 	smb_unlocksmbhdr(void);
-int 	smb_getmsgidx(smbmsg_t *msg);
-int 	smb_getlastidx(idxrec_t *idx);
-uint	smb_getmsghdrlen(smbmsg_t msg);
-ulong	smb_getmsgdatlen(smbmsg_t msg);
-int 	smb_lockmsghdr(smbmsg_t msg, int retry_time);
-int 	smb_getmsghdr(smbmsg_t *msg);
-int 	smb_unlockmsghdr(smbmsg_t msg);
-int 	smb_addcrc(ulong max_crcs, ulong crc, int retry_time);
-int 	smb_hfield(smbmsg_t *msg, ushort type, ushort length, void *data);
-int 	smb_dfield(smbmsg_t *msg, ushort type, ulong length);
-int 	smb_addmsghdr(smbmsg_t *msg, smbstatus_t *status, int storage
-				,int retry_time);
-int 	smb_putmsg(smbmsg_t msg);
-int 	smb_putmsgidx(smbmsg_t msg);
-int 	smb_putmsghdr(smbmsg_t msg);
-void	smb_freemsgmem(smbmsg_t msg);
-ulong	smb_hdrblocks(ulong length);
-ulong	smb_datblocks(ulong length);
-long	smb_allochdr(ulong length);
-long	smb_fallochdr(ulong length);
-long	smb_hallochdr(ulong header_offset);
-long	smb_allocdat(ulong length, ushort headers);
-long	smb_fallocdat(ulong length, ushort headers);
-long	smb_hallocdat(void);
-int 	smb_incdat(ulong offset, ulong length, ushort headers);
-int 	smb_freemsg(smbmsg_t msg, smbstatus_t status);
-int 	smb_freemsgdat(ulong offset, ulong length, ushort headers);
-int 	smb_freemsghdr(ulong offset, ulong length);
-
-#endif /* Don't add anything after this #endif statement */
diff --git a/src/sbbs2/fido/smbvars.c b/src/sbbs2/fido/smbvars.c
deleted file mode 100644
index 9b80d699e636c3dcc01d5f15c464c5b544bcf47a..0000000000000000000000000000000000000000
--- a/src/sbbs2/fido/smbvars.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* SMBVARS.C */
-
-/*************************************************************************/
-/* Global variables for SMBLIB. Same file used for both header and code. */
-/*************************************************************************/
-
-#ifndef GLOBAL
-#define GLOBAL
-#endif
-
-#include "smbdefs.h"
-#include <stdio.h>
-
-GLOBAL char 	smb_file[128];	/* path and filename for SMB file (no ext) */
-GLOBAL char 	shd_buf[SHD_BLOCK_LEN];
-GLOBAL FILE 	*sdt_fp;
-GLOBAL FILE 	*shd_fp;
-GLOBAL FILE 	*sid_fp;
-GLOBAL FILE 	*sda_fp;
-GLOBAL FILE 	*sha_fp;
-GLOBAL FILE 	*sch_fp;
-
diff --git a/src/sbbs2/filelist/filelist.c b/src/sbbs2/filelist/filelist.c
index 01eba9d9126840b15cb4fb91245e7c988bc639d3..5bd8b388d67efcb7c6aca256aa1f7863f7ecd297 100644
--- a/src/sbbs2/filelist/filelist.c
+++ b/src/sbbs2/filelist/filelist.c
@@ -8,7 +8,7 @@
 
 #include "sbbs.h"
 
-#define FILELIST_VER "2.12"
+#define FILELIST_VER "2.11"
 
 #define MAX_NOTS 25
 
@@ -263,7 +263,7 @@ if(!unix)
 else {
 	t=gmtime(&unix);
 	sprintf(str,"%02u/%02u/%02u",t->tm_mon+1,t->tm_mday
-		,t->tm_year%100); }
+		,t->tm_year); }
 return(str);
 }
 
diff --git a/src/sbbs2/getuser.c b/src/sbbs2/getuser.c
index 313dbce0b025213694dedf3254dc7ba49b2ef5c5..6ea445105adaa4d8b762145e158f7f2dc130d2f9 100644
--- a/src/sbbs2/getuser.c
+++ b/src/sbbs2/getuser.c
@@ -393,8 +393,6 @@ if(!atoi(birth) || !atoi(birth+3))	/* Invalid */
 	return(0);
 getdate(&date);
 age=(date.da_year-1900)-(((birth[6]&0xf)*10)+(birth[7]&0xf));
-if(age>90)
-	age-=90;
 if(sys_misc&SM_EURODATE) {		/* DD/MM/YY format */
 	if(atoi(birth)>31 || atoi(birth+3)>12)
 		return(0);
diff --git a/src/sbbs2/listfile.c b/src/sbbs2/listfile.c
index d0c4582032342bdcfaf06c2bd95ef387b0cec8eb..0ffdcbedc895eb58e7aa86cf74c0577c302ba726 100644
--- a/src/sbbs2/listfile.c
+++ b/src/sbbs2/listfile.c
@@ -693,7 +693,7 @@ int listfile(char *fname, char HUGE16 *buf, uint dirnum
 
 if(buf[F_MISC]!=ETX && (buf[F_MISC]-SP)&FM_EXTDESC && useron.misc&EXTDESC) {
 	getextdesc(dirnum,datoffset,ext);
-	if(useron.misc&BATCHFLAG && lncntr+cntlines(ext)>=rows-2 && letter!='A')
+	if(useron.misc&BATCHFLAG && lncntr+cntlines(ext)>=rows-2)
 		return(0); }
 attr(color[clr_filename]);
 bputs(fname);
diff --git a/src/sbbs2/logout.c b/src/sbbs2/logout.c
index e3c2ddf10b32d66a6f09228d2df786fc2dca30be..1dd1c85eb7dcea9a28393746d2aeb29bb46802d6 100644
--- a/src/sbbs2/logout.c
+++ b/src/sbbs2/logout.c
@@ -35,7 +35,6 @@ if(!useron.number) {				 /* Not logged in, so do nothing */
 strcpy(lastuseron,useron.alias);	/* for use with WFC status display */
 
 if(useron.rest&FLAG('G')) {        /* Reset guest's msg scan cfg */
-	putuserrec(useron.number,U_NAME,LEN_NAME,nulstr);
 	for(i=0;i<total_subs;i++) {
 		if(sub[i]->misc&SUB_NSDEF)
 			sub[i]->misc|=SUB_NSCAN;
@@ -53,9 +52,8 @@ if(batdn_total) {
 		for(i=0;i<batdn_total;i++)
 			fprintf(stream,"%s\r\n",batdn_name[i]);
 		fclose(stream); } }
-	
-if(sys_status&SS_USERON && thisnode.status!=NODE_QUIET 
-	&& !(useron.rest&FLAG('Q')))
+
+if(thisnode.status!=NODE_QUIET && !(useron.rest&FLAG('Q')))
 	for(i=1;i<=sys_nodes;i++)
 		if(i!=node_num) {
 			getnodedat(i,&node,0);
@@ -230,7 +228,7 @@ void logofflist()
 
 unixtodos(logontime,&date,&ontime);
 sprintf(str,"%sLOGS\\%2.2d%2.2d%2.2d.LOL",data_dir,date.da_mon,date.da_day
-    ,TM_YEAR(date.da_year-1900));
+    ,date.da_year-1900);
 if((file=nopen(str,O_WRONLY|O_CREAT|O_APPEND))==-1) {
     errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_CREAT|O_APPEND);
     return; }
diff --git a/src/sbbs2/mail.c b/src/sbbs2/mail.c
index 4a3adcbe41038b3e0908cceefda74a2470487c78..a06dd1cae77e27bac485ccf5fe8e8be2a84b709c 100644
--- a/src/sbbs2/mail.c
+++ b/src/sbbs2/mail.c
@@ -214,7 +214,7 @@ while(!feof(smb.sid_fp)) {
         ==NULL) {
 		smb_unlocksmbhdr(&smb);
 		errormsg(WHERE,ERR_ALLOC,smb.file,sizeof(mail_t)*(l+1));
-        return(0); }
+        return(i); }
 	(*mail)[l].offset=idx.offset;
 	(*mail)[l].number=idx.number;
 	(*mail)[l].to=idx.to;
@@ -518,7 +518,6 @@ while(online && !done) {
 			sprintf(str,"%sFILE\\%04u.IN",data_dir,usernumber);
 			rmdir(str); }
 		if(which==MAIL_YOUR && !(msg.hdr.attr&MSG_READ)) {
-			mail[curmsg].attr|=MSG_READ;
 			if(thisnode.status==NODE_INUSE)
 				telluser(msg);
 			if(msg.total_hfields)
diff --git a/src/sbbs2/main.c b/src/sbbs2/main.c
index ce05b9bf905c89562e383d490f757fe0d4dba252..eb8c318fd2bb4a01d6dac0b97dcbfb681de629a8 100644
--- a/src/sbbs2/main.c
+++ b/src/sbbs2/main.c
@@ -245,7 +245,7 @@ if(length) {
 	now=time(NULL);
 	unixtodos(now,&date,&curtime);
 	sprintf(str,"%sLOGS\\%2.2d%2.2d%2.2d.LOG",data_dir,date.da_mon,date.da_day
-		,TM_YEAR(date.da_year-1900));
+		,date.da_year-1900);
 	if((file=nopen(str,O_WRONLY|O_APPEND|O_CREAT))==-1) {
 		errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_APPEND|O_CREAT);
 		FREE((char *)buf);
diff --git a/src/sbbs2/main_ovl.c b/src/sbbs2/main_ovl.c
index 1338aacc0e56eb24968f612051e5358ce18b01a2..1e2ef5e0c982af6138146f93bc59a2e9b09beb7f 100644
--- a/src/sbbs2/main_ovl.c
+++ b/src/sbbs2/main_ovl.c
@@ -652,7 +652,7 @@ while(l>-1L && !msgabort()) {
     l-=4;
     unixtodos(timestamp-(24*60*60),&date,&curtime); /* 1 day less than stamp */
     bprintf(text[SlogFmt]
-        ,date.da_mon,date.da_day,TM_YEAR(date.da_year-1900),timeon,logons,posts,emails
+        ,date.da_mon,date.da_day,date.da_year-1900,timeon,logons,posts,emails
         ,fbacks,ulb/1024,uls,dlb/1024,dls); }
 FREE(buf);
 }
diff --git a/src/sbbs2/main_wfc.c b/src/sbbs2/main_wfc.c
index 9d459961b41b3a996ba0181b352e1da3428ccbba..d3f12fbc0049240e62b93c13c877b5085285df54 100644
--- a/src/sbbs2/main_wfc.c
+++ b/src/sbbs2/main_wfc.c
@@ -23,7 +23,6 @@ sys_status&=~(SS_USERON|SS_TMPSYSOP|SS_LCHAT|SS_ABORT
 keybufbot=keybuftop=lbuflen=slcnt=altul=timeleft_warn=0;
 logon_uls=logon_ulb=logon_dls=logon_dlb=0;
 logon_posts=logon_emails=logon_fbacks=0;
-posts_read=0;
 batdn_total=batup_total=0;
 usrgrps=usrlibs=0;
 curgrp=curlib=0;
@@ -222,6 +221,8 @@ for(i=0;i<total_events;i++) {
 						if(j==node_num)
 							continue;
 						getnodedat(j,&node,0);
+						if(node.status==NODE_EVENT_WAITING)  /* two nodes */
+							break;							 /* waiting ?!?! */
 						if(node.status!=NODE_OFFLINE
 							&& node.status!=NODE_EVENT_LIMBO)
 							break; }
@@ -1041,7 +1042,7 @@ while(!gotcaller) {
                 now=time(NULL);
                 unixtodos(now,&date,&curtime);
                 sprintf(str,"%sLOGS\\%2.2d%2.2d%2.2d.LOG"
-                    ,data_dir,date.da_mon,date.da_day,TM_YEAR(date.da_year-1900));
+                    ,data_dir,date.da_mon,date.da_day,date.da_year-1900);
 				external(cmdstr(node_viewer,str,nulstr,NULL),0);
                 return(0);
             case 'M':   /* Read all mail */
@@ -1122,7 +1123,7 @@ while(!gotcaller) {
                 now-=(ulong)60L*24L*60L;
                 unixtodos(now,&date,&curtime);
                 sprintf(str,"%sLOGS\\%2.2d%2.2d%2.2d.LOG"
-                    ,data_dir,date.da_mon,date.da_day,TM_YEAR(date.da_year-1900));
+                    ,data_dir,date.da_mon,date.da_day,date.da_year-1900);
 				external(cmdstr(node_viewer,str,nulstr,NULL),0);
                 return(0);
 			case 'Z':
@@ -1196,7 +1197,7 @@ while(!gotcaller) {
 				ans=1; }
 		if(mdm_misc&MDM_DUMB && DCDHIGH)
 			ans=1; }
-	if(ans && com_port) {
+	if(ans) {
         lputc(FF);
 		if(mdm_misc&MDM_CALLERID) {
 			lputs("Obtaining Caller-ID...");
@@ -1450,7 +1451,6 @@ if(online==ON_REMOTE) {
 #endif
 	strcat(str,decrypt(CopyrightNotice,0));
 	center(str);
-	mswait(500);
 	while(i++<30 && l<40) { 		/* wait up to 3 seconds for response */
 		if((c=(incom()&0x7f))=='R') {   /* break immediately if response */
 			str[l++]=c;
diff --git a/src/sbbs2/makefile b/src/sbbs2/makefile
index 68de54adfbe691c5d270d0cfcd6fe1620a3efb90..5978f4d9f460320865734f95fca0d903c9256db7 100644
--- a/src/sbbs2/makefile
+++ b/src/sbbs2/makefile
@@ -132,10 +132,9 @@ $(LIB)\c0X32.OBJ $(OBJS) $(OS)\ver.obj $(OVLOBJS)
 +, $*, $*, $(LIB)\import32.lib $(LIB)\cw32mt.lib
 !else
 	$(LD) $(LFLAGS) @&&+
-$(LIB)\c0$(MODEL) $(OBJS) $(OS)\ver.obj /o $(OVLOBJS), \
-$*, $*, ..\spawno\spawnl $(LIB)\overlay $(LIB)\c$(MODEL) \
+$(LIB)\c0$(MODEL) $(OBJS) $(OS)\ver.obj /o $(OVLOBJS)
++, $*, $*, ..\spawno\spawnl $(LIB)\overlay $(LIB)\c$(MODEL) \
 	$(LIB)\math$(MODEL) $(LIB)\emu
-+
 !endif
 
 $(OS)\smblib.obj: smb\smblib.c smb\smblib.h smb\smbdefs.h
diff --git a/src/sbbs2/msg1.c b/src/sbbs2/msg1.c
index e13d7a5065a4a84237dde8263a9007a8ea5d8350..0b7c260fed17941c7725494e0ac8ab73f23e6769 100644
--- a/src/sbbs2/msg1.c
+++ b/src/sbbs2/msg1.c
@@ -106,13 +106,6 @@ bprintf(text[MsgAttr]
 	,attr&MSG_PERMANENT ? "Permanent  " :nulstr
 	,attr&MSG_MODERATED ? "Moderated  " :nulstr
 	,attr&MSG_VALIDATED ? "Validated  " :nulstr
-	,attr&MSG_REPLIED	? "Replied  "	:nulstr
-	,nulstr
-	,nulstr
-	,nulstr
-	,nulstr
-	,nulstr
-	,nulstr
 	);
 }
 
diff --git a/src/sbbs2/msg2.c b/src/sbbs2/msg2.c
index b8468f8693ec5caefd87e8177d73e389951512e8..cea8cfa3492b6f75fa2ec74c65865e21255edc54 100644
--- a/src/sbbs2/msg2.c
+++ b/src/sbbs2/msg2.c
@@ -1126,7 +1126,7 @@ else {
 msg.hdr.offset=offset;
 
 memcpy(msg.hdr.id,"SHD\x1a",4);
-msg.hdr.version=smb_ver();
+msg.hdr.version=SMB_VERSION;
 
 smb_unlocksmbhdr(&smb);
 
diff --git a/src/sbbs2/msgtoqwk.c b/src/sbbs2/msgtoqwk.c
index 68ad8a92cbaca79c6f7a9d95a9a94765071d032d..35861e27a10dd1ee37fed3f1a0e5d78061ca5145 100644
--- a/src/sbbs2/msgtoqwk.c
+++ b/src/sbbs2/msgtoqwk.c
@@ -6,8 +6,6 @@
 #include "qwk.h"
 #include "etext.h"
 
-#define MAX_MSGNUM	0x7FFFFFUL	// only 7 (decimal) digits allowed for msg num 
-
 /****************************************************************************/
 /* Converts message 'msg' to QWK format, writing to file 'qwk_fp'.          */
 /* mode determines how to handle Ctrl-A codes								*/
@@ -256,7 +254,7 @@ while(size%128L) {				 /* Pad with spaces */
 unixtodos(msg.hdr.when_written.time,&date,&curtime);
 
 sprintf(tmp,"%02u-%02u-%02u%02u:%02u"
-    ,date.da_mon,date.da_day,TM_YEAR(date.da_year-1900)
+    ,date.da_mon,date.da_day,date.da_year-1900
     ,curtime.ti_hour,curtime.ti_min);
 
 if(msg.hdr.attr&MSG_PRIVATE) {
@@ -275,13 +273,13 @@ sprintf(str,"%c%-7lu%-13.13s%-25.25s"
 	"%-25.25s%-25.25s%12s%-8lu%-6lu\xe1%c%c%c%c%c"
     ,ch                     /* message status flag */
 	,mode&REP ? (ulong)conf /* conference or */
-		: msg.hdr.number&MAX_MSGNUM	/* message number */
+		: msg.hdr.number	/* message number */
 	,tmp					/* date and time */
 	,to 					/* To: */
 	,from					/* From: */
     ,msg.subj               /* Subject */
     ,nulstr                 /* Password */
-    ,msg.hdr.thread_orig&MAX_MSGNUM    /* Message Re: Number */
+    ,msg.hdr.thread_orig    /* Message Re: Number */
 	,(size/128L)+1			/* Number of 128byte blocks */
     ,(char)conf&0xff        /* Conference number lo byte */
 	,(ushort)conf>>8		/*					 hi byte */
diff --git a/src/sbbs2/netmail.c b/src/sbbs2/netmail.c
index d5d4670f3819e4a87e3f9f4d6d77baf15c3fcea5..edc577f0ce4c4ed25df52bd03183c581785c6f4e 100644
--- a/src/sbbs2/netmail.c
+++ b/src/sbbs2/netmail.c
@@ -170,7 +170,7 @@ fclose(instream);
 
 memset(&msg,0,sizeof(smbmsg_t));
 memcpy(msg.hdr.id,"SHD\x1a",4);
-msg.hdr.version=smb_ver();
+msg.hdr.version=SMB_VERSION;
 if(mode&WM_FILE)
 	msg.hdr.auxattr|=MSG_FILEATTACH;
 msg.hdr.when_written.time=msg.hdr.when_imported.time=time(NULL);
@@ -346,7 +346,7 @@ fclose(instream);
 
 memset(&msg,0,sizeof(smbmsg_t));
 memcpy(msg.hdr.id,"SHD\x1a",4);
-msg.hdr.version=smb_ver();
+msg.hdr.version=SMB_VERSION;
 if(mode&WM_FILE)
 	msg.hdr.auxattr|=MSG_FILEATTACH;
 msg.hdr.when_written.time=msg.hdr.when_imported.time=time(NULL);
diff --git a/src/sbbs2/postmsg.c b/src/sbbs2/postmsg.c
index 4034d0a1f090f64f27a8490170c53141132fd459..757f5b26db513b4e464a2c5ca08814056e060c83 100644
--- a/src/sbbs2/postmsg.c
+++ b/src/sbbs2/postmsg.c
@@ -215,7 +215,7 @@ crc=~crc;
 
 memset(&msg,0,sizeof(smbmsg_t));
 memcpy(msg.hdr.id,"SHD\x1a",4);
-msg.hdr.version=smb_ver();
+msg.hdr.version=SMB_VERSION;
 msg.hdr.attr=msg.idx.attr=msgattr;
 msg.hdr.when_written.time=msg.hdr.when_imported.time=time(NULL);
 msg.hdr.when_written.zone=msg.hdr.when_imported.zone=sys_timezone;
diff --git a/src/sbbs2/qwktomsg.c b/src/sbbs2/qwktomsg.c
index e3d43dd12b797b0688c869a7f4fd5ad6939abd71..1678f707cda25d9caa06fe404602072baae465ea 100644
--- a/src/sbbs2/qwktomsg.c
+++ b/src/sbbs2/qwktomsg.c
@@ -22,7 +22,7 @@ char qwktomsg(FILE *qwk_fp, uchar *hdrblk, char fromhub, uint subnum
 
 memset(&msg,0,sizeof(smbmsg_t));		/* Initialize message header */
 memcpy(msg.hdr.id,"SHD\x1a",4);
-msg.hdr.version=smb_ver();
+msg.hdr.version=SMB_VERSION;
 
 blocks=atol(hdrblk+116);
 if(blocks<2)
@@ -50,10 +50,7 @@ msg.hdr.attr=msg.idx.attr;
 
 date.da_mon=((hdrblk[8]&0xf)*10)+(hdrblk[9]&0xf);
 date.da_day=((hdrblk[11]&0xf)*10)+(hdrblk[12]&0xf);
-date.da_year=((hdrblk[14]&0xf)*10)+(hdrblk[15]&0xf);
-if(date.da_year<Y2K_2DIGIT_WINDOW)
-	date.da_year+=100;
-date.da_year+=1900;
+date.da_year=((hdrblk[14]&0xf)*10)+(hdrblk[15]&0xf)+1900;
 curtime.ti_hour=((hdrblk[16]&0xf)*10)+(hdrblk[17]&0xf);
 curtime.ti_min=((hdrblk[19]&0xf)*10)+(hdrblk[20]&0xf);
 curtime.ti_sec=0;
@@ -63,7 +60,6 @@ if(!(useron.rest&FLAG('Q')) && !fromhub)
 msg.hdr.when_imported.time=time(NULL);
 msg.hdr.when_imported.zone=sys_timezone;
 
-hdrblk[116]=0; /* don't bleed number-of-blocks and re-msg-num fields together */
 msg.hdr.thread_orig=atol(hdrblk+108);
 
 if((uint)subnum==INVALID_SUB) { 		/* E-mail */
diff --git a/src/sbbs2/sbbsdefs.h b/src/sbbs2/sbbsdefs.h
index 93304c26d15cce3b3e93b7ca4bfd011c7fac0904..68ad9ecddb214ddc1b238e3108c9b9b5f458ff91 100644
--- a/src/sbbs2/sbbsdefs.h
+++ b/src/sbbs2/sbbsdefs.h
@@ -18,15 +18,14 @@
 /*************/
 
 #define VERSION 	"2.30"  /* Version: Major.minor  */
-#define REVISION	'C'
-#define BETA		" beta"     /* Space if non-beta, " �eta" otherwise */
-
-#define Y2K_2DIGIT_WINDOW	70
+#define REVISION	'A'
+#define BETA		" "     /* Space if non-beta, " �eta" otherwise */
 
 /************/
 /* Maximums */
 /************/
 
+#define DEMO_NODES		  2
 #define MAX_NODES		250
 
 #ifdef __FLAT__
@@ -366,8 +365,8 @@ enum {								/* Values for xtrn_t.event			*/
 #define SEC_CID 	  10	/* Ten second pause for caller ID			*/
 #define SEC_RING	   6	/* Maximum seconds between rings			*/
 
-#define LOOP_NOPEN	  50	/* Retries before file access denied		*/
-#define LOOP_NODEDAB  50	/* Retries on NODE.DAB locking/unlocking	*/
+#define LOOP_NOPEN	 500	/* Retries before file access denied		*/
+#define LOOP_NODEDAB 500	/* Retries on NODE.DAB locking/unlocking	*/
 
 							/* String lengths							*/
 #define LEN_ALIAS		25	/* User alias								*/
@@ -710,7 +709,6 @@ enum {						/* Values of mode for userlist function     */
 #define ANSI_SAVE() 	bputs("\x1b[s")
 #define ANSI_RESTORE()	bputs("\x1b[u")
 #define GOTOXY(x,y)     bprintf("\x1b[%d;%dH",y,x)
-#define TM_YEAR(yy)		((yy)%100)
 
 extern	long crc32tbl[];
 #define ucrc32(ch,crc) (crc32tbl[(crc^ch)&0xff]^(crc>>8))
diff --git a/src/sbbs2/slog/slog.c b/src/sbbs2/slog/slog.c
index 4a8170fb2515e517aefd92fcd0536ab1b8c452df..25358c203e1533fc2c2755d2fb78695cc06433fa 100644
--- a/src/sbbs2/slog/slog.c
+++ b/src/sbbs2/slog/slog.c
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
 	 struct time curtime;
 
 
-printf("\nSynchronet System/Node Statistics Log Viewer v1.02\n\n");
+printf("\nSynchronet System/Node Statistics Log Viewer v1.01\n\n");
 
 for(i=1;i<argc;i++)
 	if(!stricmp(argv[i],"/P"))
@@ -126,7 +126,7 @@ while(l>-1L) {
     unixtodos(timestamp-(24*60*60),&date,&curtime); /* 1 day less than stamp */
 	printf("%2.2d/%2.2d/%2.2d T:%5lu   L:%3lu   P:%3lu   "
 		"E:%3lu   F:%3lu   U:%6luk %3lu  D:%6luk %3lu\n"
-		,date.da_mon,date.da_day,date.da_year%100,timeon,logons,posts,emails
+        ,date.da_mon,date.da_day,date.da_year-1900,timeon,logons,posts,emails
 		,fbacks,ulb/1024,uls,dlb/1024,dls);
 	lncntr++;
 	if(pause && lncntr>=20) {
diff --git a/src/sbbs2/smb/smbdefs.h b/src/sbbs2/smb/smbdefs.h
index 2e845c0fd25b1eb2ba7d70ddd3cb7b2ccd864f20..d46958e3527fed4f0ad3200d6b9100db70f1e31b 100644
--- a/src/sbbs2/smb/smbdefs.h
+++ b/src/sbbs2/smb/smbdefs.h
@@ -11,6 +11,10 @@
 /* Macros */
 /**********/
 
+#define SMB_VERSION 		0x0121		/* SMB format version */
+										/* High byte major, low byte minor */
+#define SMBLIB_VERSION		"2.01"      /* SMB library version */
+
 										/* Control characters */
 #define TAB 				0x09		/* Horizontal tabulation	^I */
 #define LF					0x0a		/* Line feed				^J */
@@ -257,7 +261,6 @@
 #define MSG_KILLREAD		(1<<6)
 #define MSG_MODERATED		(1<<7)
 #define MSG_VALIDATED		(1<<8)
-#define MSG_REPLIED			(1<<9)		// User replied to this message
 
 										/* Auxillary header attributes */
 #define MSG_FILEREQUEST 	(1<<0)		// File request
@@ -332,11 +335,6 @@ enum {
 /* Typedefs */
 /************/
 
-#ifdef _WIN32	/* necessary for compatibility with SBBS v2 */
-#pragma pack(push)
-#pragma pack(1)
-#endif
-
 typedef struct {			// Time with time-zone
 
 	ulong	time;			// Local time (unix format)
@@ -432,7 +430,7 @@ typedef struct {				// Message
 
 	idxrec_t	idx;			// Index
 	msghdr_t	hdr;			// Header record (fixed portion)
-	char		*to,			// To name
+	uchar		*to,			// To name
 				*to_ext,		// To extension
 				*from,			// From name
 				*from_ext,		// From extension
@@ -463,14 +461,11 @@ typedef struct {			// Message base
     FILE    *sid_fp;        // File pointer for index (.sid) file
     FILE    *sda_fp;        // File pointer for data allocation (.sda) file
     FILE    *sha_fp;        // File pointer for header allocation (.sha) file
-	ulong	retry_time; 	// Maximum number of seconds to retry opens/locks
+	long	retry_time; 	// Maximum number of seconds to retry opens/locks
 	smbstatus_t status; 	// Status header record
 	char	shd_buf[SHD_BLOCK_LEN]; 	// File I/O buffer for header file
 
     } smb_t;
 
-#ifdef _WIN32
-#pragma pack(pop)		/* original packing */
-#endif
 
 #endif /* Don't add anything after this #endif statement */
diff --git a/src/sbbs2/smb/smblib.c b/src/sbbs2/smb/smblib.c
index e414456e22729bbd1bc67b42d84276ea5259b392..75d658ff416155bbd2c7d5380e6e3492c0774f77 100644
--- a/src/sbbs2/smb/smblib.c
+++ b/src/sbbs2/smb/smblib.c
@@ -3,59 +3,16 @@
 /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
 
 #include "smblib.h"
-
-/* Use smb_ver() and smb_lib_ver() to obtain these values */
-#define SMBLIB_VERSION		"2.10"      /* SMB library version */
-#define SMB_VERSION 		0x0121		/* SMB format version */
-										/* High byte major, low byte minor */
-
-#ifdef _MSC_VER	  /* Microsoft C */
-#define sopen(f,o,s,p)	   _sopen(f,o,s,p)
-#define close(f)		   _close(f)
-#define SH_DENYNO		   _SH_DENYNO
-#define SH_DENYRW		   _SH_DENYRW
-
-#include <sys/locking.h>
-
-int lock(int file, long offset, int size) 
-{
-	int	i;
-	long	pos;
-   
-	pos=tell(file);
-	if(offset!=pos)
-		lseek(file, offset, SEEK_SET);
-	i=locking(file,LK_NBLCK,size);
-	if(offset!=pos)
-		lseek(file, pos, SEEK_SET);
-	return(i);
-}
-
-int unlock(int file, long offset, int size)
-{
-	int	i;
-	long	pos;
-   
-	pos=tell(file);
-	if(offset!=pos)
-		lseek(file, offset, SEEK_SET);
-	i=locking(file,LK_UNLCK,size);
-	if(offset!=pos)
-		lseek(file, pos, SEEK_SET);
-	return(i);
-}
-
-#endif /* _MSC_VER */
-
+#include "lzh.h"
 
 int SMBCALL smb_ver(void)
 {
-	return(SMB_VERSION);
+return(SMB_VERSION);
 }
 
 char * SMBCALL smb_lib_ver(void)
 {
-	return(SMBLIB_VERSION);
+return(SMBLIB_VERSION);
 }
 
 /****************************************************************************/
@@ -634,24 +591,15 @@ void SMBCALL smb_freemsgmem(smbmsg_t *msg)
 {
 	ushort	i;
 
-	if(msg->dfield) {
-		FREE(msg->dfield);
-		msg->dfield=NULL;
-	}
-	for(i=0;i<msg->total_hfields;i++)
-		if(msg->hfield_dat[i]) {
-			FREE(msg->hfield_dat[i]);
-			msg->hfield_dat[i]=NULL;
-		}
-	msg->total_hfields=0;
-	if(msg->hfield) {
-		FREE(msg->hfield);
-		msg->hfield=NULL;
-	}
-	if(msg->hfield_dat) {
-		FREE(msg->hfield_dat);
-		msg->hfield_dat=NULL;
-	}
+if(msg->dfield)
+	FREE(msg->dfield);
+for(i=0;i<msg->total_hfields;i++)
+	if(msg->hfield_dat[i])
+		FREE(msg->hfield_dat[i]);
+if(msg->hfield)
+	FREE(msg->hfield);
+if(msg->hfield_dat)
+	FREE(msg->hfield_dat);
 }
 
 /****************************************************************************/
@@ -1033,18 +981,11 @@ return(offset);
 int SMBCALL smb_freemsgdat(smb_t *smb, ulong offset, ulong length
 			, ushort headers)
 {
-	int		da_opened=0;
 	ushort	i;
 	ulong	l,blocks;
 
 blocks=smb_datblocks(length);
 
-if(smb->sda_fp==NULL) {
-	if((i=smb_open_da(smb))!=0)
-		return(i);
-	da_opened=1;
-}
-
 clearerr(smb->sda_fp);
 for(l=0;l<blocks;l++) {
 	if(fseek(smb->sda_fp,((offset/SDT_BLOCK_LEN)+l)*2L,SEEK_SET))
@@ -1060,8 +1001,6 @@ for(l=0;l<blocks;l++) {
 	if(!fwrite(&i,2,1,smb->sda_fp))
 		return(4); }
 fflush(smb->sda_fp);
-if(da_opened)
-	smb_close_da(smb);
 return(0);
 }
 
@@ -1192,7 +1131,7 @@ return(offset);
 /************************************************************************/
 long SMBCALL smb_hallochdr(smb_t *smb)
 {
-	ulong l;
+	long l;
 
 fflush(smb->shd_fp);
 fseek(smb->shd_fp,0L,SEEK_END);
@@ -1280,33 +1219,33 @@ void SMBCALL smb_clearerr(FILE *fp)
 clearerr(fp);
 }
 
-long SMBCALL smb_fread(void HUGE16 *buf, long bytes, FILE *fp)
+long SMBCALL smb_fread(char HUGE16 *buf, long bytes, FILE *fp)
 {
 #ifdef __FLAT__
 	return(fread(buf,1,bytes,fp));
 #else
 	long count;
 
-for(count=bytes;count>0x7fff;count-=0x7fff,(char*)buf+=0x7fff)
+for(count=bytes;count>0x7fff;count-=0x7fff,buf+=0x7fff)
 	if(fread((char *)buf,1,0x7fff,fp)!=0x7fff)
 		return(bytes-count);
-if(fread((char *)buf,1,(size_t)count,fp)!=(size_t)count)
+if(fread((char *)buf,1,(int)count,fp)!=count)
 	return(bytes-count);
 return(bytes);
 #endif
 }
 
-long SMBCALL smb_fwrite(void HUGE16 *buf, long bytes, FILE *fp)
+long SMBCALL smb_fwrite(char HUGE16 *buf, long bytes, FILE *fp)
 {
 #ifdef __FLAT__
 	return(fwrite(buf,1,bytes,fp));
 #else
 	long count;
 
-for(count=bytes;count>0x7fff;count-=0x7fff,(char*)buf+=0x7fff)
+for(count=bytes;count>0x7fff;count-=0x7fff,buf+=0x7fff)
 	if(fwrite((char *)buf,1,0x7fff,fp)!=0x7fff)
 		return(bytes-count);
-if(fwrite((char *)buf,1,(size_t)count,fp)!=(size_t)count)
+if(fwrite((char *)buf,1,(int)count,fp)!=count)
 	return(bytes-count);
 return(bytes);
 #endif
@@ -1318,8 +1257,8 @@ char HUGE16 * SMBCALL smb_getmsgtxt(smb_t *smb, smbmsg_t *msg, ulong mode)
 {
 	char	HUGE16 *buf=NULL,HUGE16 *lzhbuf,HUGE16 *p;
 	ushort	xlat;
-	int 	i,lzh;
-	long	l=0,lzhlen,length;
+	int 	i,j,lzh;
+	long	l=0,lzo,lzhlen,length;
 
 for(i=0;i<msg->hdr.total_dfields;i++) {
 	if(!(msg->dfield[i].type==TEXT_BODY
diff --git a/src/sbbs2/smb/smblib.h b/src/sbbs2/smb/smblib.h
index beab8210bbe223e01b9bc105cc53e67f3714cda2..4e7b595044ffcb76bbe3364f89a92bbff4e4f5f2 100644
--- a/src/sbbs2/smb/smblib.h
+++ b/src/sbbs2/smb/smblib.h
@@ -1,19 +1,14 @@
 /* SMBLIB.H */
 
-/* Developed 1990-2000 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
+/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
 
 #ifndef _SMBLIB_H
 #define _SMBLIB_H
 
-#include "lzh.h"
-
-#if defined(__WATCOMC__) || defined(__TURBOC__) || defined(_MSC_VER)
-#	include <io.h>
-#	include <share.h>
-#endif
-
 #if defined(__WATCOMC__) || defined(__TURBOC__)
+#	include <io.h>
 #	include <mem.h>
+#	include <share.h>
 #else
 #	include <memory.h>
 #endif
@@ -24,31 +19,12 @@
 #	include <dir.h>
 #endif
 
-#if defined(_WIN32)
-#	ifndef __FLAT__
-#	define __FLAT__
-#	endif
-#	define SMBCALL __stdcall	/* VB Compatible */
-#	if defined (EXPORT32)
-#		undef EXPORT32
-#	endif
-#	if defined(SMBDLL)
-#		define EXPORT32 __declspec( dllexport )
-#	else
-#		define EXPORT32 __declspec( dllimport )
-#	endif
+#if defined(__NT__)
+#	define SMBCALL _pascal _export
 #elif defined(__FLAT__)
-#	if defined(SMBDLL)
-#		define SMBCALL	_pascal
-#		define EXPORT32 _export
-#	else
-#		define SMBCALL
-#		define EXPORT32
-#	endif
-#
+#	define SMBCALL _export
 #else
 #	define SMBCALL
-#	define EXPORT32
 #endif
 
 #include <malloc.h>
@@ -70,74 +46,74 @@
 
 #define GETMSGTXT_TAILS 	1			/* Get message tail(s) too */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EXPORT32 int 	SMBCALL smb_ver(void);
-EXPORT32 char *	SMBCALL smb_lib_ver(void);
-EXPORT32 int 	SMBCALL smb_open(smb_t *smb);
-EXPORT32 void	SMBCALL smb_close(smb_t *smb);
-EXPORT32 int 	SMBCALL smb_open_da(smb_t *smb);
-EXPORT32 void	SMBCALL smb_close_da(smb_t *smb);
-EXPORT32 int 	SMBCALL smb_open_ha(smb_t *smb);
-EXPORT32 void	SMBCALL smb_close_ha(smb_t *smb);
-EXPORT32 int 	SMBCALL smb_create(smb_t *smb);
-EXPORT32 int 	SMBCALL smb_stack(smb_t *smb, int op);
-EXPORT32 int 	SMBCALL smb_trunchdr(smb_t *smb);
-EXPORT32 int 	SMBCALL smb_locksmbhdr(smb_t *smb);
-EXPORT32 int 	SMBCALL smb_getstatus(smb_t *smb);
-EXPORT32 int 	SMBCALL smb_putstatus(smb_t *smb);
-EXPORT32 int 	SMBCALL smb_unlocksmbhdr(smb_t *smb);
-EXPORT32 int 	SMBCALL smb_getmsgidx(smb_t *smb, smbmsg_t *msg);
-EXPORT32 int 	SMBCALL smb_getlastidx(smb_t *smb, idxrec_t *idx);
-EXPORT32 uint	SMBCALL smb_getmsghdrlen(smbmsg_t *msg);
-EXPORT32 ulong	SMBCALL smb_getmsgdatlen(smbmsg_t *msg);
-EXPORT32 int 	SMBCALL smb_lockmsghdr(smb_t *smb, smbmsg_t *msg);
-EXPORT32 int 	SMBCALL smb_getmsghdr(smb_t *smb, smbmsg_t *msg);
-EXPORT32 int 	SMBCALL smb_unlockmsghdr(smb_t *smb, smbmsg_t *msg);
-EXPORT32 int 	SMBCALL smb_addcrc(smb_t *smb, ulong crc);
-EXPORT32 int 	SMBCALL smb_hfield(smbmsg_t *msg, ushort type, ushort length, void *data);
-EXPORT32 int 	SMBCALL smb_dfield(smbmsg_t *msg, ushort type, ulong length);
-EXPORT32 int 	SMBCALL smb_addmsghdr(smb_t *smb, smbmsg_t *msg,int storage);
-EXPORT32 int 	SMBCALL smb_putmsg(smb_t *smb, smbmsg_t *msg);
-EXPORT32 int 	SMBCALL smb_putmsgidx(smb_t *smb, smbmsg_t *msg);
-EXPORT32 int 	SMBCALL smb_putmsghdr(smb_t *smb, smbmsg_t *msg);
-EXPORT32 void	SMBCALL smb_freemsgmem(smbmsg_t *msg);
-EXPORT32 ulong	SMBCALL smb_hdrblocks(ulong length);
-EXPORT32 ulong	SMBCALL smb_datblocks(ulong length);
-EXPORT32 long	SMBCALL smb_allochdr(smb_t *smb, ulong length);
-EXPORT32 long	SMBCALL smb_fallochdr(smb_t *smb, ulong length);
-EXPORT32 long	SMBCALL smb_hallochdr(smb_t *smb);
-EXPORT32 long	SMBCALL smb_allocdat(smb_t *smb, ulong length, ushort headers);
-EXPORT32 long	SMBCALL smb_fallocdat(smb_t *smb, ulong length, ushort headers);
-EXPORT32 long	SMBCALL smb_hallocdat(smb_t *smb);
-EXPORT32 int 	SMBCALL smb_incdat(smb_t *smb, ulong offset, ulong length, ushort headers);
-EXPORT32 int 	SMBCALL smb_freemsg(smb_t *smb, smbmsg_t *msg);
-EXPORT32 int 	SMBCALL smb_freemsgdat(smb_t *smb, ulong offset, ulong length, ushort headers);
-EXPORT32 int 	SMBCALL smb_freemsghdr(smb_t *smb, ulong offset, ulong length);
-EXPORT32 void	SMBCALL smb_freemsgtxt(char HUGE16 *buf);
-EXPORT32 char HUGE16 * SMBCALL smb_getmsgtxt(smb_t *smb, smbmsg_t *msg, ulong mode);
+int 	SMBCALL smb_ver(void);
+char *	SMBCALL smb_lib_ver(void);
+int 	SMBCALL smb_open(smb_t *smb);
+void	SMBCALL smb_close(smb_t *smb);
+int 	SMBCALL smb_open_da(smb_t *smb);
+void	SMBCALL smb_close_da(smb_t *smb);
+int 	SMBCALL smb_open_ha(smb_t *smb);
+void	SMBCALL smb_close_ha(smb_t *smb);
+int 	SMBCALL smb_create(smb_t *smb);
+int 	SMBCALL smb_stack(smb_t *smb, int op);
+int 	SMBCALL smb_trunchdr(smb_t *smb);
+int 	SMBCALL smb_locksmbhdr(smb_t *smb);
+int 	SMBCALL smb_getstatus(smb_t *smb);
+int 	SMBCALL smb_putstatus(smb_t *smb);
+int 	SMBCALL smb_unlocksmbhdr(smb_t *smb);
+int 	SMBCALL smb_getmsgidx(smb_t *smb, smbmsg_t *msg);
+int 	SMBCALL smb_getlastidx(smb_t *smb, idxrec_t *idx);
+uint	SMBCALL smb_getmsghdrlen(smbmsg_t *msg);
+ulong	SMBCALL smb_getmsgdatlen(smbmsg_t *msg);
+int 	SMBCALL smb_lockmsghdr(smb_t *smb, smbmsg_t *msg);
+int 	SMBCALL smb_getmsghdr(smb_t *smb, smbmsg_t *msg);
+int 	SMBCALL smb_unlockmsghdr(smb_t *smb, smbmsg_t *msg);
+int 	SMBCALL smb_addcrc(smb_t *smb, ulong crc);
+int 	SMBCALL smb_hfield(smbmsg_t *msg, ushort type, ushort length
+				,void *data);
+int 	SMBCALL smb_dfield(smbmsg_t *msg, ushort type, ulong length);
+int 	SMBCALL smb_addmsghdr(smb_t *smb, smbmsg_t *msg,int storage);
+int 	SMBCALL smb_putmsg(smb_t *smb, smbmsg_t *msg);
+int 	SMBCALL smb_putmsgidx(smb_t *smb, smbmsg_t *msg);
+int 	SMBCALL smb_putmsghdr(smb_t *smb, smbmsg_t *msg);
+void	SMBCALL smb_freemsgmem(smbmsg_t *msg);
+ulong	SMBCALL smb_hdrblocks(ulong length);
+ulong	SMBCALL smb_datblocks(ulong length);
+long	SMBCALL smb_allochdr(smb_t *smb, ulong length);
+long	SMBCALL smb_fallochdr(smb_t *smb, ulong length);
+long	SMBCALL smb_hallochdr(smb_t *smb);
+long	SMBCALL smb_allocdat(smb_t *smb, ulong length, ushort headers);
+long	SMBCALL smb_fallocdat(smb_t *smb, ulong length, ushort headers);
+long	SMBCALL smb_hallocdat(smb_t *smb);
+int 	SMBCALL smb_incdat(smb_t *smb, ulong offset, ulong length
+				,ushort headers);
+int 	SMBCALL smb_freemsg(smb_t *smb, smbmsg_t *msg);
+int 	SMBCALL smb_freemsgdat(smb_t *smb, ulong offset, ulong length
+				,ushort headers);
+int 	SMBCALL smb_freemsghdr(smb_t *smb, ulong offset, ulong length);
+char HUGE16 * SMBCALL smb_getmsgtxt(smb_t *smb, smbmsg_t *msg, ulong mode);
+void	SMBCALL smb_freemsgtxt(char HUGE16 *buf);
 
 /* FILE pointer I/O functions */
 
-EXPORT32 int 	SMBCALL smb_feof(FILE *fp);
-EXPORT32 int 	SMBCALL smb_ferror(FILE *fp);
-EXPORT32 int 	SMBCALL smb_fflush(FILE *fp);
-EXPORT32 int 	SMBCALL smb_fgetc(FILE *fp);
-EXPORT32 int 	SMBCALL smb_fputc(int ch, FILE *fp);
-EXPORT32 int 	SMBCALL smb_fseek(FILE *fp, long offset, int whence);
-EXPORT32 long	SMBCALL smb_ftell(FILE *fp);
-EXPORT32 long	SMBCALL smb_fread(void HUGE16 *buf, long bytes, FILE *fp);
-EXPORT32 long	SMBCALL smb_fwrite(void HUGE16 *buf, long bytes, FILE *fp);
-EXPORT32 long	SMBCALL smb_fgetlength(FILE *fp);
-EXPORT32 int 	SMBCALL smb_fsetlength(FILE *fp, long length);
-EXPORT32 void	SMBCALL smb_rewind(FILE *fp);
-EXPORT32 void	SMBCALL smb_clearerr(FILE *fp);
-
-#ifdef __cplusplus
-}
-#endif
+int 	SMBCALL smb_feof(FILE *fp);
+int 	SMBCALL smb_ferror(FILE *fp);
+int 	SMBCALL smb_fflush(FILE *fp);
+int 	SMBCALL smb_fgetc(FILE *fp);
+int 	SMBCALL smb_fputc(int ch, FILE *fp);
+int 	SMBCALL smb_fseek(FILE *fp, long offset, int whence);
+long	SMBCALL smb_ftell(FILE *fp);
+long	SMBCALL smb_fread(char HUGE16 *buf, long bytes, FILE *fp);
+long	SMBCALL smb_fwrite(char HUGE16 *buf, long bytes, FILE *fp);
+long	SMBCALL smb_fgetlength(FILE *fp);
+int 	SMBCALL smb_fsetlength(FILE *fp, long length);
+void	SMBCALL smb_rewind(FILE *fp);
+void	SMBCALL smb_clearerr(FILE *fp);
+
+/* LZH functions */
+
+long	SMBCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf);
+long	SMBCALL lzh_decode(uchar *inbuf, long inlen, uchar *outbuf);
 
 #ifdef __WATCOMC__	/* Use MSC standard (prepended underscore) */
 #pragma aux smb_ver 			"_*"
diff --git a/src/sbbs2/smb/smbutil/wildargv.c b/src/sbbs2/smb/smbutil/wildargv.c
new file mode 100644
index 0000000000000000000000000000000000000000..c5382ad2bb6996a256dc2f2ecfc11fecab219527
--- /dev/null
+++ b/src/sbbs2/smb/smbutil/wildargv.c
@@ -0,0 +1,158 @@
+/*
+ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ *%	  Copyright (C) 1989, by WATCOM Systems Inc. All rights     %
+ *%	  reserved. No part of this software may be reproduced	    %
+ *%	  in any form or by any means - graphic, electronic or	    %
+ *%	  mechanical, including photocopying, recording, taping     %
+ *%	  or information storage and retrieval systems - except     %
+ *%	  with the written permission of WATCOM Systems Inc.	    %
+ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+  WILDARGV - split DOS command line into individual arguments expanding
+	     those that contain ? or *.
+  This module is a substitute for the "initargv" module contained in the
+  library.
+
+  Modified:	By:		Reason:
+  ---------	---		-------
+  23-aug-89	John Dahms	was ignoring files with Archive or
+				read only attributes turned on. (Bug fix)
+  15-sep-91	F.W.Crigger	Use _LpCmdLine, _LpPgmName, _argc, _argv,
+  				___Argc, ___Argv
+  13-jul-92	John Dahms	add (void near *) cast in _allocate
+  02-nov-93	A.F.Scian	fixed so that it compiles as C++
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <io.h>
+#include <direct.h>
+#include <malloc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern	void	_Not_Enough_Memory();
+extern	char	*_LpCmdLine;
+extern	char	*_LpPgmName;
+extern	int	_argc;			/* argument count  */
+extern	char  **_argv;			/* argument vector */
+extern	int	___Argc;		/* argument count */
+extern	char  **___Argv;		/* argument vector */
+
+#ifdef __cplusplus
+};
+#endif
+
+
+static void *_allocate( unsigned amount )
+    {
+	void *p;
+
+#if defined(__386__)
+	p = malloc( amount );
+#else
+	p = _nmalloc( amount );
+    #if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
+	if( (void near *) p == NULL )  p = malloc( amount );
+    #endif
+#endif
+	if( p == NULL )  _Not_Enough_Memory();
+	return( p );
+    }
+
+
+static int _make_argv( char *p, char ***argv )
+    {
+	int		argc;
+	char		*start;
+	char		*new_arg;
+	char		wildcard;
+	char		lastchar;
+	DIR *		dir;
+	struct dirent * dirent;
+	char		drive[_MAX_DRIVE];
+	char		directory[_MAX_DIR];
+	char		name[_MAX_FNAME];
+	char		extin[_MAX_EXT];
+	char		pathin[_MAX_PATH];
+
+	argc = 1;
+	for(;;) {
+	    while( *p == ' ' ) ++p;	/* skip over blanks */
+	    if( *p == '\0' ) break;
+	    /* we are at the start of a parm */
+	    wildcard = 0;
+	    if( *p == '\"' ) {
+		p++;
+		new_arg = start = p;
+		for(;;) {
+		    /* end of parm: NULLCHAR or quote */
+		    if( *p == '\"' ) break;
+		    if( *p == '\0' ) break;
+		    if( *p == '\\' ) {
+			if( p[1] == '\"'  ||  p[1] == '\\' )  ++p;
+		    }
+		    *new_arg++ = *p++;
+		}
+	    } else {
+		new_arg = start = p;
+		for(;;) {
+		    /* end of parm: NULLCHAR or blank */
+		    if( *p == '\0' ) break;
+		    if( *p == ' ' ) break;
+		    if(( *p == '\\' )&&( p[1] == '\"' )) {
+			++p;
+		    } else if( *p == '?'  ||  *p == '*' ) {
+			wildcard = 1;
+		    }
+		    *new_arg++ = *p++;
+		}
+	    }
+	    *argv = (char **) realloc( *argv, (argc+2) * sizeof( char * ) );
+	    if( *argv == NULL )  _Not_Enough_Memory();
+	    (*argv)[ argc ] = start;
+	    ++argc;
+	    lastchar = *p;
+	    *new_arg = '\0';
+	    ++p;
+	    if( wildcard ) {
+		/* expand file names */
+		dir = opendir( start );
+		if( dir != NULL ) {
+		    --argc;
+		    _splitpath( start, drive, directory, name, extin );
+		    for(;;) {
+			dirent = readdir( dir );
+			if( dirent == NULL ) break;
+			if( dirent->d_attr &
+			  (_A_HIDDEN+_A_SYSTEM+_A_VOLID+_A_SUBDIR) ) continue;
+			_splitpath( dirent->d_name, NULL, NULL, name, extin );
+			_makepath( pathin, drive, directory, name, extin );
+			*argv = (char **) realloc( *argv, (argc+2) * sizeof( char * ) );
+			if( *argv == NULL )  _Not_Enough_Memory();
+			new_arg = (char *) _allocate( strlen( pathin ) + 1 );
+			strcpy( new_arg, pathin );
+			(*argv)[argc++] = new_arg;
+		    }
+		    closedir( dir );
+		}
+	    }
+	    if( lastchar == '\0' ) break;
+	}
+	return( argc );
+    }
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void __Init_Argv()
+    {
+	_argv = (char **) _allocate( 2 * sizeof( char * ) );
+	_argv[0] = _LpPgmName;	/* fill in program name */
+	_argc = _make_argv( _LpCmdLine, &_argv );
+	_argv[_argc] = NULL;
+	___Argc = _argc;
+	___Argv = _argv;
+    }
diff --git a/src/sbbs2/smm/smb2smm.c b/src/sbbs2/smm/smb2smm.c
index de596dd12851e1c9ddebfb7716bd1f899a76d774..c2cc14965d206c87f9c0b7e06184c8f18d1b6645 100644
--- a/src/sbbs2/smm/smb2smm.c
+++ b/src/sbbs2/smm/smb2smm.c
@@ -125,7 +125,7 @@ time_t dstrtounix(char *str)
 if(!strncmp(str,"00/00/00",8))
 	return(0);
 curtime.ti_hour=curtime.ti_min=curtime.ti_sec=0;
-if(str[6]<'7')
+if(str[6]<7)
 	date.da_year=2000+((str[6]&0xf)*10)+(str[7]&0xf);
 else
 	date.da_year=1900+((str[6]&0xf)*10)+(str[7]&0xf);
@@ -161,8 +161,6 @@ if(birth[0]<=SP)
 	return(0);
 getdate(&date);
 age=(date.da_year-1900)-(((birth[6]&0xf)*10)+(birth[7]&0xf));
-if(age>90)
-	age-=90;
 if(atoi(birth)>12 || atoi(birth+3)>31)
 	return(0);
 if(((birth[0]&0xf)*10)+(birth[1]&0xf)>date.da_mon ||
diff --git a/src/sbbs2/smm/smm.c b/src/sbbs2/smm/smm.c
index d71d05826691f6b6268664d0f8c18317f4a9c590..fbd3667c5e7d40bba58531211db4db64ce273a80 100644
--- a/src/sbbs2/smm/smm.c
+++ b/src/sbbs2/smm/smm.c
@@ -589,8 +589,6 @@ if(birth[0]<=SP)
 	return(0);
 getdate(&date);
 age=(date.da_year-1900)-(((birth[6]&0xf)*10)+(birth[7]&0xf));
-if(age>90)
-	age-=90;
 if(atoi(birth)>12 || atoi(birth+3)>31)
 	return(0);
 if(((birth[0]&0xf)*10)+(birth[1]&0xf)>date.da_mon ||
diff --git a/src/sbbs2/smm/smmutil.c b/src/sbbs2/smm/smmutil.c
index d2c5eaa695b4c8b5de4b7b04710093a81a21a5fe..85ddcf7b532e5f32202f59fbca8baf073673083c 100644
--- a/src/sbbs2/smm/smmutil.c
+++ b/src/sbbs2/smm/smmutil.c
@@ -45,8 +45,6 @@ if(birth[0]<=SP)
 	return(0);
 getdate(&date);
 age=(date.da_year-1900)-(((birth[6]&0xf)*10)+(birth[7]&0xf));
-if(age>90)
-	age-=90;
 if(atoi(birth)>12 || atoi(birth+3)>31)
 	return(0);
 if(((birth[0]&0xf)*10)+(birth[1]&0xf)>date.da_mon ||
@@ -77,7 +75,7 @@ now=time(NULL);
 gm=localtime(&now);
 fseek(log,0L,SEEK_END);
 fprintf(log,"%02u/%02u/%02u %02u:%02u:%02u %s\r\n"
-    ,gm->tm_mon+1,gm->tm_mday,TM_YEAR(gm->tm_year),gm->tm_hour,gm->tm_min,gm->tm_sec
+    ,gm->tm_mon+1,gm->tm_mday,gm->tm_year,gm->tm_hour,gm->tm_min,gm->tm_sec
     ,buf);
 fflush(log);
 }
diff --git a/src/sbbs2/uti/uti.c b/src/sbbs2/uti/uti.c
index fb290e0a3313ec0656cda46b083c3de32912d501..4564ff09260f4bba3877aac197152e2f1752d6c2 100644
--- a/src/sbbs2/uti/uti.c
+++ b/src/sbbs2/uti/uti.c
@@ -219,8 +219,8 @@ if(!code) {
 	gotoxy(txtinfo.curx,txtinfo.cury); }
 t=time(NULL);
 unixtodos(t,&date,&curtime);
-sprintf(str,"%02u/%02u/%u %02u:%02u:%02u    Exiting (%d)\r\n\r\n"
-	,date.da_mon,date.da_day,date.da_year
+sprintf(str,"%02u/%02u/%02u %02u:%02u:%02u    Exiting (%d)\r\n\r\n"
+	,date.da_mon,date.da_day,date.da_year-1900
 	,curtime.ti_hour,curtime.ti_min,curtime.ti_sec
 	,code);
 write(logfile,str,strlen(str));
@@ -282,7 +282,7 @@ if((logfile=nopen(str,O_WRONLY|O_CREAT|O_APPEND))==-1) {
 t=time(NULL);
 tm=gmtime(&t);
 sprintf(str,"%02u/%02u/%02u %02u:%02u:%02u    %-8s %s \""
-	,tm->tm_mon+1,tm->tm_mday,TM_YEAR(tm->tm_year)
+	,tm->tm_mon+1,tm->tm_mday,tm->tm_year
 	,tm->tm_hour,tm->tm_min,tm->tm_sec
 	,name,VER);
 printf("\n\n");
diff --git a/src/sbbs2/uti/utiexprt.c b/src/sbbs2/uti/utiexprt.c
index a5a44daf2b38c22dceac8f15cad9da31b3c8caf3..0a338d9713945848a42d760671f1fc9b5dc03cdc 100644
--- a/src/sbbs2/uti/utiexprt.c
+++ b/src/sbbs2/uti/utiexprt.c
@@ -135,7 +135,7 @@ for(l=0;l<posts;l++) {
 		"%s\r\n%c\r\n%c\r\nTEXT:\r\n"
 		,msg.hdr.number
 		,msg.hdr.thread_orig
-		,date.da_mon,date.da_day,TM_YEAR(date.da_year-1900)
+		,date.da_mon,date.da_day,date.da_year-1900
 		,curtime.ti_hour,curtime.ti_min
 		,msg.hdr.attr&MSG_PRIVATE ? "PRIVATE" : "PUBLIC"
 		,msg.hdr.attr&MSG_READ ? 'Y':'N'
diff --git a/src/sbbs2/uti/utiimprt.c b/src/sbbs2/uti/utiimprt.c
index acfac0697e964cdb5202401fe9172d69a296378b..29390c804a5e4d48fb8eba370c5184d9dadd59d4 100644
--- a/src/sbbs2/uti/utiimprt.c
+++ b/src/sbbs2/uti/utiimprt.c
@@ -71,10 +71,7 @@ printf("\rdstrtounix           ");
 #endif
 
 curtime.ti_hour=curtime.ti_min=curtime.ti_sec=0;
-date.da_year=((str[6]&0xf)*10)+(str[7]&0xf);
-if(date.da_year<Y2K_2DIGIT_WINDOW)
-	date.da_year+=100;
-date.da_year+=1900;
+date.da_year=1900+((str[6]&0xf)*10)+(str[7]&0xf);
 date.da_mon=((str[0]&0xf)*10)+(str[1]&0xf);
 date.da_day=((str[3]&0xf)*10)+(str[4]&0xf);
 return(dostounix(&date,&curtime));
diff --git a/src/sbbs2/ver.c b/src/sbbs2/ver.c
index caac3f66c7d47b8ea712c53adc6b973ae523c2c3..abe8251204a9f6a6f3ef0d69f217a120c575d195 100644
--- a/src/sbbs2/ver.c
+++ b/src/sbbs2/ver.c
@@ -47,7 +47,7 @@ sprintf(str,"Revision %c%s %s %.5s  "
 #else
 	,rioctl(GVERS)
 #endif
-	,smb_lib_ver()
+	,SMBLIB_VERSION
 	,__BORLANDC__>>8
 	,__BORLANDC__&0xff);
 center(str);
diff --git a/src/sbbs2/xtrn_ovl.c b/src/sbbs2/xtrn_ovl.c
index 3066305eb9778d1bb7a4bdfbbd4cba62889715ce..056716fb5b1f72fdbe9463fcf65c69c5601d65e0 100644
--- a/src/sbbs2/xtrn_ovl.c
+++ b/src/sbbs2/xtrn_ovl.c
@@ -82,12 +82,11 @@ time_t juliantounix(ulong j)
 /****************************************************************************/
 void xtrndat(char *name, char *dropdir, uchar type, ulong tleft)
 {
-	char	str[1024],tmp2[128],c,*p;
-	int		i,file;
-	long	l;
-	ushort	w;
-	FILE *	stream;
-	struct	time lastcall;
+	char str[1024],tmp2[128],c,*p;
+	int i,file;
+	long l;
+	FILE *stream;
+	struct time lastcall;
 	stats_t stats;
 
 if(type==XTRN_SBBS) {	/* SBBS XTRN.DAT file */
@@ -316,7 +315,7 @@ else if(type==XTRN_GAP) {	/* Gap DOOR.SYS File */
 		,useron.min 						/* 42: Time credits in minutes */
 		,date.da_mon						/* 43: File new-scan date */
 		,date.da_day
-		,TM_YEAR(date.da_year-1900));
+		,date.da_year-1900);
 	write(file,str,strlen(str));
 
 	unixtodos(logontime,&date,&curtime);
@@ -386,8 +385,7 @@ else if(type==XTRN_RBBS || type==XTRN_RBBS1) {
 	if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1) {
 		errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_CREAT|O_TRUNC);
         return; }
-	w=dte_rate;
-	write(file,&w,sizeof(short));	  /* BaudRate */
+	write(file,&(uint)dte_rate,sizeof(int));	  /* BaudRate */
 	/* SysInfo */
 	getstats(0,&stats);
 	write(file,&stats.logons,sizeof(long)); /* CallCount */
@@ -396,8 +394,8 @@ else if(type==XTRN_RBBS || type==XTRN_RBBS1) {
 	write(file,nulstr,92);					/* ExtraSpace */
 	/* TimeLogInfo */
 	write(file,nulstr,9);					/* StartDate */
-	write(file,nulstr,24*sizeof(short));		/* BusyPerHour */
-	write(file,nulstr,7*sizeof(short));		/* BusyPerDay */
+	write(file,nulstr,24*sizeof(int));		/* BusyPerHour */
+	write(file,nulstr,7*sizeof(int));		/* BusyPerDay */
 	/* UserInfo */
 	str2pas(name,str);				/* Name */
 	write(file,str,36);
@@ -424,28 +422,27 @@ else if(type==XTRN_RBBS || type==XTRN_RBBS1) {
 	write(file,&c,1);						/* Attrib */
 	write(file,&useron.flags1,4);			/* Flags */
 	i=0;
-	w=0;
-	write(file,&w,sizeof(short)); 			/* Credit */
-	write(file,&w,sizeof(short)); 			/* Pending */
-	write(file,&useron.posts,sizeof(short));	/* TimesPosted */
-	write(file,&w,sizeof(short)); 			/* HighMsgRead */
-	w=useron.level;
-	write(file,&w,sizeof(short)); 			/* SecLvl */
-	w=0;
-	write(file,&w,sizeof(short)); 			/* Times */
-	write(file,&useron.uls,sizeof(short));	/* Ups */
-	write(file,&useron.dls,sizeof(short));	/* Downs */
-	w=useron.ulb/1024UL;
-	write(file,&w,sizeof(short)); 			/* UpK */
-	w=useron.dlb/1024UL;
-	write(file,&w,sizeof(short)); 			/* DownK */
-	w=logon_dlb/1024UL;
-	write(file,&w,sizeof(short)); 			/* TodayK */
-	w=0;
-	write(file,&w,sizeof(short)); 			/* Elapsed */
-	write(file,&w,sizeof(short)); 			/* Len */
-	write(file,&w,sizeof(short)); 			/* CombinedPtr */
-	write(file,&w,sizeof(short)); 			/* AliasPtr */
+	write(file,&i,sizeof(int)); 			/* Credit */
+	write(file,&i,sizeof(int)); 			/* Pending */
+	write(file,&useron.posts,sizeof(int));	/* TimesPosted */
+	write(file,&i,sizeof(int)); 			/* HighMsgRead */
+	i=useron.level;
+	write(file,&i,sizeof(int)); 			/* SecLvl */
+	i=0;
+	write(file,&i,sizeof(int)); 			/* Times */
+	write(file,&useron.uls,sizeof(int));	/* Ups */
+	write(file,&useron.dls,sizeof(int));	/* Downs */
+	i=useron.ulb/1024UL;
+	write(file,&i,sizeof(int)); 			/* UpK */
+	i=useron.dlb/1024UL;
+	write(file,&i,sizeof(int)); 			/* DownK */
+	i=logon_dlb/1024UL;
+	write(file,&i,sizeof(int)); 			/* TodayK */
+	i=0;
+	write(file,&i,sizeof(int)); 			/* Elapsed */
+	write(file,&i,sizeof(int)); 			/* Len */
+	write(file,&i,sizeof(int)); 			/* CombinedPtr */
+	write(file,&i,sizeof(int)); 			/* AliasPtr */
 	l=0;
 	write(file,&l,sizeof(long));			/* Birthday (as a long?) */
 	/* EventInfo */
@@ -477,10 +474,10 @@ else if(type==XTRN_RBBS || type==XTRN_RBBS1) {
 	unixtodstr(logontime,tmp);
 	str2pas(tmp,str);
 	write(file,str,9);						/* LoginDate */
-	write(file,&level_timepercall[useron.level],sizeof(short));  /* TmLimit */
+	write(file,&level_timepercall[useron.level],sizeof(int));  /* TmLimit */
 	write(file,&logontime,sizeof(long));	/* LoginSec */
 	write(file,&useron.cdt,sizeof(long));	/* Credit */
-	write(file,&useron.number,sizeof(short)); /* UserRecNum */
+	write(file,&useron.number,sizeof(int)); /* UserRecNum */
 	write(file,&i,2);						/* ReadThru */
 	write(file,&i,2);						/* PageTimes */
 	write(file,&i,2);						/* DownLimit */
@@ -560,7 +557,7 @@ else if(type==XTRN_WILDCAT) { /* WildCat CALLINFO.BBS File */
 		,curtime.ti_hour,curtime.ti_min 	/* Current time HH:MM */
 		,curtime.ti_hour,curtime.ti_min 	/* Current time and date HH:MM */
 		,date.da_mon,date.da_day			/* MM/DD/YY */
-		,TM_YEAR(date.da_year-1900)
+		,date.da_year-1900
 		,nulstr);							/* Conferences with access */
 	write(file,str,strlen(str));
 
@@ -583,7 +580,7 @@ else if(type==XTRN_WILDCAT) { /* WildCat CALLINFO.BBS File */
 			? "EXPERT":"NOVICE"
 		,"All"                              /* Transfer Protocol */
 		,date.da_mon,date.da_day			/* File new-scan date */
-		,TM_YEAR(date.da_year-1900)			/* in MM/DD/YY */
+		,date.da_year-1900					/* in MM/DD/YY */
 		,useron.logons						/* Total logons */
 		,rows								/* Screen length */
 		,0									/* Highest message read */
@@ -603,7 +600,7 @@ else if(type==XTRN_WILDCAT) { /* WildCat CALLINFO.BBS File */
 
 	sprintf(str,"%02d/%02d/%02d %02d:%02d\r\n%u\r\n%u\r\n"
 		,date.da_mon,date.da_day			/* Current date MM/DD/YY */
-		,TM_YEAR(date.da_year-1900)
+		,date.da_year-1900
 		,curtime.ti_hour,curtime.ti_min 	/* Current time HH:MM */
 		,node_num							/* Node number */
 		,0);								/* Door number */
@@ -1434,9 +1431,6 @@ if(xtrn[xtrnnum]->misc&MODUSERDAT) {	/* Modify user data */
 	moduserdat(xtrnnum);
 	statusline(); }
 
-getnodedat(node_num,&thisnode,1);
-thisnode.aux=0; /* aux is 0, only if at menu */
-putnodedat(node_num,thisnode);
 }
 
 /****************************************************************************/