Initial revision
authorRyan C. Gordon <icculus@icculus.org>
Sat, 18 Nov 2000 00:33:00 +0000
changeset 1 132a7d1e2daa
parent 0 673f825bd2eb
child 2 3a81231e7b41
Initial revision
CHANGELOG
Makefile
a.bat
amake.bat
archive1.pas
archive2.pas
archive3.pas
ascii.inc
asyint.map
bb.pas
bbs.pas
bbs.~pa
boarde.msg
boarder.msg
brec17a2.pas
c.bat
c.~ba
cbbs.pas
cc.bat
change.me
coconfig.pas
common.pas
common1.pas
common2.pas
common3.pas
conv17a.pas
conv17a9.pas
conv18a.pas
cuser.pas
cx.pas
doors.pas
edit2.txt
editpro.txt
execbat.pas
execswap.pas
fastchr.asm
file0.pas
file1.pas
file10.pas
file11.pas
file12.pas
file13.pas
file14.pas
file2.pas
file3.pas
file4.pas
file5.pas
file6.pas
file7.pas
file8.pas
file9.pas
file_id.diz
findit.pas
func.pas
fvtype.pas
gloasync.inc
globtype.inc
go.bat
go.~ba
ifl.inc
ifl.pas
init.pas
init16d3.pas
init16e1.pas
initp.pas
ints.inc
lamer.pas
lcbbs.pas
logon1.pas
logon2.pas
logon2.~pa
mabs.pas
mail0.pas
mail1.pas
mail2.pas
mail3.pas
mail4.pas
mail5.pas
mail6.pas
mail9.pas
makeinit.bat
makemabs.bat
makestd.bat
maketerm.bat
makezip.bat
mdek.pas
menus.pas
menus2.pas
menus3.pas
menus4.pas
miniterm.pas
misc1.pas
misc2.pas
misc3.pas
misc4.pas
miscx.pas
mmodem.pas
msgpack.pas
mtest.pas
myio.pas
newcom.pas
newusers.pas
oblit.pas
pib1.pas
pib2.pas
pibo.pas
protocol.dat
quote.txt
rcc17a.pas
rcc18a.pas
rec17a.pas
rec18a.pas
rec19.pas
rec20.pas
rec25.pas
recc.pas
reccold.pas
sepmsgs.pas
sources
spdate.pas
strct24d.pas
stubs.pas
sysop1.pas
sysop10.pas
sysop11.pas
sysop2.pas
sysop21.pas
sysop2a.pas
sysop2b.pas
sysop2c.pas
sysop2d.pas
sysop2e.pas
sysop2f.pas
sysop2fa.pas
sysop2g.pas
sysop2h.pas
sysop2i.pas
sysop2s.pas
sysop2z.pas
sysop3.pas
sysop4.pas
sysop5.pas
sysop6.pas
sysop7.pas
sysop7m.pas
sysop8.pas
sysop9.pas
t2t.pas
ta2z.pas
tackroom.bbs
tagr24b.pas
tagr24d.pas
tagrec24.pas
test.pas
thedraw.pck
timejunk.pas
tmpcom.pas
tmpcommm.pas
tmu.pas
tosysop.ltr
tpage.pas
tpansi.pas
upacs.pas
wcat20.pas
wfcmenu.pas
white.txt
windows.pas
yellow.txt
zzalpha.bat
zzbeta.bat
zzstand.bat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CHANGELOG	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,22 @@
+
+
+2000-11-17  Ryan C. Gordon   <icculus@lokigames.com>
+
+    * Initial work.
+
+    * Wrote Makefile.
+
+    * filenames -> lowercase, dos2unix'd them.
+
+    * Stubbed offending DOSisms, like direct video writes and serial port i/o.
+
+    * Commented out "uses overlay" commands.
+
+    * Renamed newcommm.pas to newcom.pas ...
+
+    * Fixed some other syntax stuff that doesn't fly under Free Pascal.
+
+
+// end of CHANGELOG ...
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,112 @@
+#---------------------------------------------------------------------------
+# Makefile by Ryan C. Gordon (icculus@lokigames.com)
+#---------------------------------------------------------------------------
+
+# should be 386, mmx, 686, or other.
+#
+#  386 and 486 chips use "386"
+#  Pentiums, Celerons, PentiumMMX should use "mmx"
+#  PentiumPro, PII, PIII, K6, Cyrix686/MII, Athlon, etc. should use "686"
+#  PowerPC and other non-x86 chips should use "other"
+cpu=686
+
+# Are you debugging?  Specify "true". Release binaries?  "false".
+debug=true
+
+# want to see more verbose compiles? Set this to "true".
+verbose=true
+
+# You probably don't need to touch this one. This is the location of
+#  your copy of PPC386, if it's not in the path.
+#  Get this from http://www.freepascal.org/ ...
+PPC386=ppc386
+
+#---------------------------------------------------------------------------
+# don't touch anything below this line.
+
+# This is the name of the produced binary. "bbs" should suffice.
+MAINEXE=bbs
+
+ifeq ($(strip $(verbose)),true)
+    PPC386FLAGS += -vwnh
+endif
+
+ifeq ($(strip $(debug)),true)
+    BUILDDIR := $(cpu)/Debug
+    PPC386FLAGS += -g    # include debug symbols.
+    PPC386FLAGS += -gc   # generate checks for pointers.
+    PPC386FLAGS += -Ct   # generate stack-checking code.
+    PPC386FLAGS += -Cr   # generate range-checking code.
+    PPC386FLAGS += -Co   # generate overflow-checking code.
+    PPC386FLAGS += -Ci   # generate I/O-checking code.
+else
+    BUILDDIR := $(cpu)/Release
+    PPC386FLAGS += -Xs   # strip the binary.
+    PPC386FLAGS += -O2   # Level 2 optimizations.
+    PPC386FLAGS += -OG   # Optimize for speed, not size.
+
+    ifeq ($(strip $(cpu)),386)
+        PPC386FLAGS += -OP1
+    else
+        ifeq ($(strip $(cpu)),mmx)
+            PPC386FLAGS += -OP2
+        else
+            ifeq ($(strip $(cpu)),686)
+                PPC386FLAGS += -OP3
+            endif
+        endif
+    endif
+endif
+
+# Borland TP7.0 compatibility flag.
+PPC386FLAGS += -So
+
+# Support C-style macros.
+#PPC386FLAGS += -Sm
+
+# Assembly statements are Intel-like (instead of AT&T-like).
+PPC386FLAGS += -Rintel
+
+# Dynamic linkage.
+PPC386FLAGS += -XD
+
+# Output target Linux.  !!! FIXME: Want win32 compiles?
+PPC386FLAGS += -TLINUX
+
+# Smartlink the binary, removing unused code.
+PPC386FLAGS += -CX
+
+# Pipe output to assembler, rather than to temp file. This is a little faster.
+PPC386FLAGS += -P
+
+# Write bins to this directory...
+PPC386FLAGS += -FE$(BUILDDIR)
+
+#---------------------------------------------------------------------------
+# Build rules...don't touch this, either.
+
+include sources
+
+OBJSx := $(SRCS:.pas=.o)
+OBJS := $(foreach feh,$(OBJSx),$(BUILDDIR)/$(feh))
+
+$(BUILDDIR)/%.o : %.pas
+	$(PPC386) $(PPC386FLAGS) $<
+
+all: $(MAINEXE)
+
+$(MAINEXE) : $(BUILDDIR) $(OBJS) bbs.pas
+	$(PPC386) $(PPC386FLAGS) bbs.pas
+
+$(BUILDDIR): $(cpu)
+	mkdir $(BUILDDIR)
+
+$(cpu):
+	mkdir $(cpu)
+
+clean:
+	rm -rf $(BUILDDIR)
+	rm -rf core
+
+# end of Makefile ...
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/a.bat	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,3 @@
+@echo off
+echo 
+tasm %1 %2 %3 %4 %5 %6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/amake.bat	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,4 @@
+@echo off
+copy mabs.pas mabs%1.pas
+call c mabs%1 /DAS%1
+del mabs%1.pas
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/archive1.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,555 @@
+{$A+,B+,D-,E+,F+,I+,L-,N-,O+,R-,S+,V-}
+unit archive1;
+
+interface
+
+uses
+  crt, dos,
+
+  {rcg11172000 no overlay under Linux.}
+  {overlay,}
+
+  myio,
+  execbat,
+  common;
+
+procedure purgedir(s:astr);                {* erase all non-dir files in dir *}
+function arcmci(src,fn,ifn:astr):astr;
+procedure arcdecomp(var ok:boolean; atype:integer; fn,fspec:astr);
+procedure arccomp(var ok:boolean; atype:integer; fn,fspec:astr);
+procedure arccomment(var ok:boolean; atype,cnum:integer; fn:astr);
+procedure arcintegritytest(var ok:boolean; atype:integer; fn:astr);
+procedure conva(var ok:boolean; otype,ntype:integer; tdir,ofn,nfn:astr);
+function arctype(s:astr):integer;
+procedure listarctypes;
+procedure invarc;
+procedure extracttotemp;
+procedure userarchive;
+
+implementation
+
+uses file0, file1, file2, file4, file7, file9, file11;
+
+const
+  maxdoschrline=127;
+
+procedure purgedir(s:astr);                {* erase all non-dir files in dir *}
+var odir,odir2:astr;
+    dirinfo:searchrec;
+    f:file;
+    att:word;
+begin
+  s:=fexpand(s);
+  while copy(s,length(s),1)='\' do s:=copy(s,1,length(s)-1);
+  getdir(0,odir); getdir(exdrv(s),odir2);
+  chdir(s);
+  findfirst('*.*',AnyFile-Directory,dirinfo);
+  while (doserror=0) do begin
+    assign(f,fexpand(dirinfo.name));
+    setfattr(f,$00);           {* remove possible read-only, etc, attributes *}
+    {$I-} erase(f); {$I+}      {* erase the $*@( file !!     *}
+    findnext(dirinfo);         {* move on to the next one... *}
+  end;
+  chdir(odir2); chdir(odir);
+end;
+
+function arcmci(src,fn,ifn:astr):astr;
+begin
+  src:=substall(src,'@F',fn);
+  src:=substall(src,'@I',ifn);
+  arcmci:=src;
+end;
+
+procedure arcdecomp(var ok:boolean; atype:integer; fn,fspec:astr);
+begin
+  purgedir(systat.temppath+'1\');
+
+  shel1;
+  execbatch(ok,TRUE,'tgtemp1.bat','tgtest1.$$$',systat.temppath+'1\',
+            arcmci(systat.filearcinfo[atype].unarcline,fn,fspec),
+            systat.filearcinfo[atype].succlevel);
+  shel2;
+
+  if (not ok) then
+    sysoplog('Archive "'+fn+'": Errors during de-compression');
+end;
+
+procedure arccomp(var ok:boolean; atype:integer; fn,fspec:astr);
+{* ok: result
+ * atype: archive method
+ * fn   : archive filename
+ *}
+begin
+  shel1;
+  execbatch(ok,TRUE,'tgtemp1.bat','tgtest1.$$$',systat.temppath+'1\',
+            arcmci(systat.filearcinfo[atype].arcline,fn,fspec),
+            systat.filearcinfo[atype].succlevel);
+  shel2;
+
+  if (not ok) then
+    sysoplog('Archive "'+fn+'": Errors during compression');
+
+  purgedir(systat.temppath+'1\');
+end;
+
+procedure arccomment(var ok:boolean; atype,cnum:integer; fn:astr);
+var ff:text;
+    tfn:astr;
+    b:boolean;
+begin
+  if (cnum<>0) and (systat.filearccomment[cnum]<>'') then begin
+    tfn:=fexpand('tgtemp2.$$$');
+    assign(ff,tfn); rewrite(ff);
+    writeln(ff,systat.filearccomment[cnum]); close(ff);
+
+    shel1;
+    b:=systat.swapshell; systat.swapshell:=FALSE;
+    execbatch(ok,FALSE,'tgtemp1.bat','tgtest1.$$$',systat.temppath+'1\',
+              arcmci(systat.filearcinfo[atype].cmtline,fn,'')+' <'+tfn,
+              systat.filearcinfo[atype].succlevel);
+    systat.swapshell:=b;
+    shel2;
+
+    erase(ff);
+  end;
+end;
+
+procedure arcintegritytest(var ok:boolean; atype:integer; fn:astr);
+begin
+  if (systat.filearcinfo[atype].testline<>'') then begin
+    shel1;
+    execbatch(ok,TRUE,'tgtemp1.bat','tgtest1.$$$',systat.temppath+'1\',
+              arcmci(systat.filearcinfo[atype].testline,fn,''),
+              systat.filearcinfo[atype].succlevel);
+    shel2;
+  end;
+end;
+
+procedure conva(var ok:boolean; otype,ntype:integer; tdir,ofn,nfn:astr);
+var f:file;
+    nofn,ps,ns,es:astr;
+    eq:boolean;
+begin
+  star('Converting archive - stage one.');
+  eq:=(otype=ntype);
+  if (eq) then begin
+    fsplit(ofn,ps,ns,es);
+    nofn:=ps+ns+'.#$%';
+  end;
+  arcdecomp(ok,otype,ofn,'*.*');
+  if (not ok) then star('Errors in decompression!')
+  else begin
+    star('Converting archive - stage two.');
+    if (eq) then begin assign(f,ofn); rename(f,nofn); end;
+    arccomp(ok,ntype,nfn,'*.*');
+    if (not ok) then begin
+      star('Errors in compression!');
+      if (eq) then begin assign(f,nofn); rename(f,ofn); end;
+    end;
+    if (not exist(sqoutsp(nfn))) then ok:=FALSE;
+  end;
+end;
+
+function arctype(s:astr):integer;
+var atype:integer;
+begin
+  s:=align(stripname(s)); s:=copy(s,length(s)-2,3);
+  atype:=1;
+  while (systat.filearcinfo[atype].ext<>'') and
+        (systat.filearcinfo[atype].ext<>s) and
+        (atype<maxarcs+1) do
+    inc(atype);
+  if (atype=maxarcs+1) or (systat.filearcinfo[atype].ext='') or
+     (not systat.filearcinfo[atype].active) then atype:=0;
+  arctype:=atype;
+end;
+
+procedure listarctypes;
+var i,j:integer;
+begin
+  i:=1; j:=0;
+  while (systat.filearcinfo[i].ext<>'') and (i<maxarcs) do begin
+    if (systat.filearcinfo[i].active) then begin
+      inc(j);
+      if (j=1) then prompt('Available archive formats: ') else prompt(',');
+      prompt(systat.filearcinfo[i].ext);
+    end;
+    inc(i);
+  end;
+  if (j=0) then prompt('No archive formats available.');
+  nl;
+end;
+
+procedure invarc;
+begin
+  print('Unsupported archive format.');
+  nl;
+  listarctypes;
+  nl;
+end;
+
+procedure extracttotemp;
+var fi:file of byte;
+    f:ulfrec;
+    s,fn,ps,ns,es:astr;
+    numfiles,tsiz,lng:longint;
+    pl,rn,atype:integer;
+    c:char;
+    abort,next,done,ok,toextract,tocopy,didsomething,nospace:boolean;
+begin
+  didsomething:=FALSE;
+  nl;
+  print('Extract to temporary directory -');
+  nl;
+  prompt('Already in TEMP: ');
+  numfiles:=0; tsiz:=0;
+  findfirst(systat.temppath+'3\*.*',anyfile-dos.directory,dirinfo);
+  found:=(doserror=0);
+  while (found) do begin
+    inc(tsiz,dirinfo.size);
+    inc(numfiles);
+    findnext(dirinfo);
+    found:=(doserror=0);
+  end;
+  if (numfiles=0) then print('Nothing.')
+    else print(cstrl(numfiles)+' files totalling '+cstrl(tsiz)+' bytes.');
+
+  if (not fso) then begin
+    print('The limit is '+cstrl(systat.maxintemp)+'k bytes.');
+    lng:=systat.maxintemp; lng:=lng*1024;
+    if (tsiz>lng) then begin
+      nl;
+      print('You have exceeded this limit.');
+      nl;
+      print('Please remove some files from the TEMP directory using');
+      print('the user-archive command to free up some space.');
+      exit;
+    end;
+  end;
+
+  nl;
+  prt('Filename: ');
+  if (fso) then input(s,69) else input(s,12);
+  if (hangup) then exit;
+  if (s<>'') then begin
+    if ((isul(s)) and (not fso)) then begin
+      nl;
+      print('Invalid filename.');
+    end else begin
+      if (pos('.',s)=0) then s:=s+'*.*';
+
+      ok:=TRUE; abort:=FALSE; next:=FALSE;
+      if (not isul(s)) then begin
+        recno(s,pl,rn); { loads memuboard ... }
+        ok:=(rn<>0);
+        if (ok) then begin
+          seek(ulff,rn); read(ulff,f);
+          fn:=fexpand(memuboard.dlpath+sqoutsp(f.filename));
+          ok:=(okdl(f));
+        end else
+          print('File not found: "'+s+'"');
+      end else begin
+        fn:=fexpand(s);
+        ok:=(exist(fn));
+        if (ok) then begin
+          assign(fi,fn);
+          {$I-} reset(fi); {$I+}
+          if (ioresult<>0) then print('Error accessing file.')
+          else begin
+            with f do begin
+              filename:=align(stripname(fn));
+              description:='Unlisted file.';
+              filepoints:=0;
+              nacc:=0;
+              ft:=255;
+              blocks:=trunc((filesize(fi)+127.0)/128.0);
+              owner:=usernum;
+              stowner:=caps(thisuser.name);
+              vpointer:=-1;
+              filestat:=[];
+            end;
+            f.date:=date;
+            f.daten:=daynum(date);
+          end;
+        end else
+          print('File not found: "'+fn+'"');
+      end;
+      fsplit(fn,ps,ns,es);
+
+      if (ok) then begin
+        toextract:=TRUE; tocopy:=FALSE;
+        atype:=arctype(fn);
+        if (atype=0) then begin
+          nl;
+          print('Unsupported archive format.');
+          listarctypes;
+          toextract:=FALSE;
+        end;
+        nl;
+        print('You can (C)opy this file into the TEMP directory,');
+        if (toextract) then begin
+          print('or (E)xtract files FROM it into the TEMP directory.');
+          nl; prt('Which? (CE,Q=Quit) : '); onek(c,'QCE');
+        end else begin
+          print('but you can''t extract files from it.');
+          nl; prt('Which? (C,Q=Quit) : '); onek(c,'QC');
+        end;
+        nl;
+        if (hangup) then exit;
+        case c of
+          'C':tocopy:=TRUE;
+          'E':toextract:=TRUE;
+        else  begin
+                tocopy:=FALSE;
+                toextract:=FALSE;
+              end;
+        end;
+        if (tocopy) then toextract:=FALSE;
+        if (toextract) then begin
+          nl; fileinfo(f,FALSE,abort,next); nl;
+          done:=FALSE;
+          repeat
+            prt('Extract files (<CR>=All,V=View,Q=Quit) : '); input(s,12);
+            if (hangup) then exit;
+            abort:=FALSE; next:=FALSE;
+            if (s='') then s:='*.*';
+            if (s='V') then begin
+              abort:=FALSE; next:=FALSE;
+              if (isul(fn)) then lfi(fn,abort,next) else lfin(rn,abort,next);
+            end
+            else
+            if (s='Q') then done:=TRUE
+            else begin
+              if (isul(s)) then print('Illegal filespec.')
+              else begin
+                ok:=TRUE;
+                s:=sqoutsp(s);
+                shel1;
+                execbatch(ok,TRUE,'tgtemp1.bat','tgtest1.$$$',systat.temppath+'3\',
+                          arcmci(systat.filearcinfo[atype].unarcline,fn,s),
+                          systat.filearcinfo[atype].succlevel);
+                shel2;
+
+                if (not ok) then begin
+                  sysoplog('Archive "'+fn+'": Errors during user decompression');
+                  star('Errors in decompression!');
+                  nl;
+                end else
+                  sysoplog('User decompressed "'+s+'" into TEMP from "'+fn+'"');
+                if (ok) then didsomething:=TRUE;
+              end;
+            end;
+          until (done) or (hangup);
+        end;
+        if (tocopy) then begin
+          s:=systat.temppath+'3\'+ns+es; (*sqoutsp(f.filename);*)
+          sprompt(#3#5+'Progress: ');
+          copyfile(ok,nospace,TRUE,fn,s);
+          if (ok) then
+            sprint(#3#5+' - Copy successful.')
+          else
+            if (nospace) then
+              sprint(#3#7+'Copy unsuccessful - insufficient space!')
+            else
+              sprint(#3#7+'Copy unsuccessful!');
+          sysoplog('User copied "'+fn+'" into TEMP directory.');
+          if (ok) then didsomething:=TRUE;
+        end;
+        if (didsomething) then begin
+          nl;
+          print('Use the user archive menu command to access');
+          print('files in the TEMP directory.');
+        end;
+      end;
+    end;
+  end;
+end;
+
+procedure userarchive;
+var fi:file of byte;
+    f:ulfrec;
+    su:ulrec;
+    s,s1,fn,savpath:astr;
+    pl,atype,gotpts,oldnumbatchfiles:integer;
+    c:char;
+    abort,next,done,ok,savefileptratio:boolean;
+
+  function okname(s:astr):boolean;
+  begin
+    okname:=TRUE;
+    okname:=not iswildcard(s);
+    if (isul(s)) then okname:=FALSE;
+  end;
+
+begin
+  nl;
+  done:=FALSE;
+  repeat
+    prt('Temp archive menu (?=help) : ');
+    onek(c,'QADLRVT?');
+    case c of
+      'Q':done:=TRUE;
+      '?':begin
+            nl;
+            listarctypes;
+            nl;
+            lcmds(30,3,'Add to archive','');
+            lcmds(30,3,'Download files','');
+            lcmds(30,3,'List files in directory','');
+            lcmds(30,3,'Remove files','');
+            lcmds(30,3,'Text view file','');
+            lcmds(30,3,'View archive','');
+            lcmds(30,3,'Quit','');
+            nl;
+          end;
+      'A':begin
+            nl; prt('Archive name: '); input(fn,12);
+            if (hangup) then exit;
+            fn:=systat.temppath+'3\'+fn;
+            loaduboard(fileboard);
+            if (pos('.',fn)=0) and (memuboard.arctype<>0) then
+              fn:=fn+'.'+systat.filearcinfo[memuboard.arctype].ext;
+            atype:=arctype(fn);
+            if (atype=0) then begin
+              nl;
+              print('Archive format not supported.');
+              listarctypes;
+              nl;
+            end else begin
+              prt('File mask: '); input(s,12);
+              if (hangup) then exit;
+              if (isul(s)) then print('Illegal file mask.')
+              else
+              if (s<>'') then begin
+                nl;
+                ok:=TRUE;
+                shel1;
+                execbatch(ok,TRUE,'tgtemp1.bat','tgtest1.$$$',systat.temppath+'3\',
+                          arcmci(systat.filearcinfo[atype].arcline,fn,s),
+                          systat.filearcinfo[atype].succlevel);
+                shel2;
+                if (not ok) then begin
+                  sysoplog('Archive "'+fn+'": Errors during user compression');
+                  star('Errors in compression!');
+                  nl;
+                end else
+                  sysoplog('User compressed "'+s+'" into "'+fn+'"');
+              end;
+            end;
+          end;
+      'D':begin
+            nl; prt('Filename: '); input(s,12);
+            if (hangup) then exit;
+            if (not okname(s)) then print('Illegal filename.')
+            else begin
+              s:=systat.temppath+'3\'+s;
+              assign(fi,s);
+              {$I-} reset(fi); {$I+}
+              if (ioresult=0) then begin
+                f.blocks:=trunc((filesize(fi)+127.0)/128.0);
+                close(fi);
+                if (f.blocks<>0) then begin
+                  savefileptratio:=systat.fileptratio;
+                  if ((not systat.uldlratio) and
+                      (not systat.fileptratio)) then
+                    systat.fileptratio:=TRUE;
+
+                  doffstuff(f,stripname(s),gotpts);
+
+                  systat.fileptratio:=savefileptratio;
+
+                  with f do begin
+                    description:='Temporary file';
+                    ft:=255;
+                    vpointer:=-1;
+                    filestat:=[];
+                  end;
+
+                  fiscan(pl); { loads in memuboard }
+                  su:=memuboard;
+                  with memuboard do begin
+                    dlpath:=systat.temppath+'3\';
+                    ulpath:=systat.temppath+'3\';
+                    name:='Temporary directory';
+                    fbstat:=[];
+                  end;
+
+                  oldnumbatchfiles:=numbatchfiles;
+                  dlx(f,-1,abort);
+
+                  memuboard:=su;
+                  close(ulff);
+
+                  if (numbatchfiles<>oldnumbatchfiles) then begin
+                    nl;
+                    sprint(#3#5+'REMEMBER: If you delete this file from the temporary directory,');
+                    sprint(#3#5+'you will not be able to download it in your batch queue.');
+                  end;
+                end;
+              end;
+              nl;
+            end;
+          end;
+      'L':begin
+            nl;
+            dir(systat.temppath+'3\','*.*',TRUE);
+            nl;
+          end;
+      'R':begin
+            nl; prt('File mask: '); input(s,12);
+            if (hangup) then exit;
+            if (isul(s)) then print('Illegal filename.')
+            else begin
+              s:=systat.temppath+'3\'+s;
+              ffile(s);
+              if (not found) then
+                print('File not found.')
+              else
+                repeat
+                  if not ((dirinfo.attr and VolumeID=VolumeID) or
+                          (dirinfo.attr and Directory=Directory)) then begin
+                    s:=dirinfo.name;
+                    assign(fi,systat.temppath+'3\'+s);
+                    {$I-} erase(fi); {$I+}
+                    if (ioresult<>0) then begin
+                      sysoplog('Error removing from temp. dir: "'+s+'"');
+                      print('Error erasing "'+s+'"');
+                    end else
+                      sysoplog('User removed from temp. dir: "'+s+'"');
+                  end;
+                  nfile;
+                until (not found);
+            end;
+            nl;
+          end;
+      'T':begin
+            nl; prt('Filename: '); input(s,12);
+            if (hangup) then exit;
+            if (not okname(s)) then print('Illegal filename.')
+            else begin
+              s1:=systat.temppath+'3\'+s;
+              if (not exist(s1)) then
+                print('File not found.')
+              else begin
+                sysoplog('User ASCII viewed in temp. dir: "'+s+'"');
+                nl;
+                sendascii(s1);
+              end;
+            end;
+          end;
+      'V':begin
+            nl; prt('File mask: '); input(fn,12);
+            if (hangup) then exit;
+            abort:=FALSE; next:=FALSE;
+            ffile(systat.temppath+'3\'+fn);
+            repeat
+              lfi(systat.temppath+'3\'+dirinfo.name,abort,next);
+              nfile;
+            until (not found) or (abort) or (hangup);
+          end;
+    end;  
+  until ((done) or (hangup));
+  lastcommandovr:=TRUE;
+end;
+
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/archive2.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,684 @@
+{$A+,B+,D-,E+,F+,I+,L-,N-,O+,R-,S+,V-}
+unit archive2;
+
+interface
+
+uses
+  crt, dos,
+
+  {rcg11172000 no overlay under Linux.}
+  {overlay,}
+
+  myio,
+  archive1, file0, file1, file4, file9, file11,
+  execbat,
+  common;
+
+procedure doarccommand(cc:char);
+
+implementation
+
+const
+  maxdoschrline=127;
+
+procedure doarccommand(cc:char);
+const maxfiles=100;
+var fl:array[1..maxfiles] of astr;
+    fn,s,s1,s2,os1:astr;
+    atype,numfl,rn,pl,savflistopt:integer;
+    i,j,x:integer;
+    c:char;
+    abort,next,done,ok,ok1:boolean;
+    fnx:boolean;    {* whether fn points to file out of Telegard .DIR list *}
+    fil1,fil2:boolean;    {* whether listed/unlisted files in list *}
+    wenttosysop,delbad,savpause:boolean;
+    f,f1:ulfrec;
+    rfpts:real;
+    fi:file of byte;
+    v:verbrec;
+    dstr,nstr,estr:astr;
+    bb:byte;
+    c_files,c_oldsiz,c_newsiz,oldsiz,newsiz:longint;
+
+  function stripname(i:astr):astr;
+  var i1:astr; n:integer;
+
+    function nextn:integer;
+    var n:integer;
+    begin
+      n:=pos(':',i1);
+      if (n=0) then n:=pos('\',i1);
+      if (n=0) then n:=pos('/',i1);
+      nextn:=n;
+    end;
+
+  begin
+    i1:=i;
+    while nextn<>0 do i1:=copy(i1,nextn+1,80);
+    stripname:=i1;
+  end;
+
+  procedure addfl(fn:astr; b:boolean);
+  var pl,rn,oldnumfl:integer;
+      f:ulfrec;
+      s,dstr,nstr,estr:astr;
+      dirinfo:searchrec;
+  begin
+    if (not b) then begin
+      oldnumfl:=numfl;
+      recno(fn,pl,rn);
+      if (fn<>'') and (pos('.',fn)<>0) and (rn<>0) then
+        while (fn<>'') and (rn<>0) and (numfl<maxfiles) do begin
+          seek(ulff,rn); read(ulff,f);
+          inc(numfl);
+          fl[numfl]:=f.filename;
+          nrecno(fn,pl,rn);
+        end;
+      if (numfl=oldnumfl) then print('No matching files.');
+      if (numfl>=maxfiles) then print('File records filled.');
+    end else begin
+      oldnumfl:=numfl;
+      fsplit(fn,dstr,nstr,estr); s:=dstr;
+      while (copy(s,length(s),1)='\') do s:=copy(s,1,length(s)-1);
+      {$I-} chdir(s); {$I+}
+      if ioresult<>0 then print('Path not found.')
+      else begin
+        findfirst(fn,AnyFile-Directory-VolumeID,dirinfo);
+        while (doserror=0) and (numfl<maxfiles) do begin
+          inc(numfl);
+          fl[numfl]:=fexpand(dstr+dirinfo.name);
+          findnext(dirinfo);
+        end;
+        if (numfl>=maxfiles) then print('File records filled.');
+        if (numfl=oldnumfl) then print('No matching files.');
+      end;
+      chdir(start_dir);
+    end;
+  end;
+
+  procedure testfiles(b:integer; fn:astr; delbad:boolean; var abort,next:boolean);
+  var fi:file of byte;
+      f:ulfrec;
+      oldboard,pl,rn,atype:integer;
+      ok:boolean;
+  begin
+    oldboard:=fileboard;
+    if (fileboard<>b) then changefileboard(b);
+    if (fileboard=b) then begin
+      recno(fn,pl,rn); { loads in memuboard }
+      abort:=FALSE; next:=FALSE;
+      while (fn<>'') and (rn<>0) and (not abort) and (not hangup) do begin
+        seek(ulff,rn); read(ulff,f);
+        fn:=memuboard.dlpath+f.filename;
+        atype:=arctype(fn);
+        if (atype<>0) then begin
+          pbn(abort,next); nl;
+          star('Testing "'+sqoutsp(fn)+'"');
+          ok:=TRUE;
+          if (not exist(fn)) then begin
+            star('File "'+sqoutsp(fn)+'" doesn''t exist.');
+            ok:=FALSE;
+          end else begin
+            arcintegritytest(ok,atype,sqoutsp(fn));
+            if (not ok) then begin
+              star('File "'+sqoutsp(fn)+'" didn''t pass integrity test.');
+              if (delbad) then begin
+                deleteff(rn,pl,TRUE);
+                assign(fi,fn);
+                {$I-} erase(fi); {$I+}
+                if (ioresult<>0) then star('Error erasing "'+sqoutsp(fn)+'"!');
+              end;
+            end;
+          end;
+        end;
+        nrecno(fn,pl,rn);
+        wkey(abort,next);
+      end;
+      close(ulff);
+    end;
+    fileboard:=oldboard;
+  end;
+
+  procedure cmtfiles(b:integer; fn:astr; var abort,next:boolean);
+  var fi:file of byte;
+      f:ulfrec;
+      oldboard,pl,rn,atype:integer;
+      ok:boolean;
+  begin
+    oldboard:=fileboard;
+    if (fileboard<>b) then changefileboard(b);
+    if (fileboard=b) then begin
+      recno(fn,pl,rn); { loads in memuboard }
+      abort:=FALSE; next:=FALSE;
+      while (fn<>'') and (rn<>0) and (not abort) and (not hangup) do begin
+        seek(ulff,rn); read(ulff,f);
+        fn:=memuboard.dlpath+f.filename;
+        atype:=arctype(fn);
+        if (atype<>0) then begin
+          pbn(abort,next); nl;
+          star('Commenting "'+sqoutsp(fn)+'"');
+          ok:=TRUE;
+          if (not exist(fn)) then begin
+            star('File "'+sqoutsp(fn)+'" doesn''t exist.');
+            ok:=FALSE;
+          end
+          else arccomment(ok,atype,memuboard.cmttype,sqoutsp(fn));
+        end;
+        nrecno(fn,pl,rn);
+        wkey(abort,next);
+      end;
+      close(ulff);
+    end;
+    fileboard:=oldboard;
+  end;
+
+  procedure cvtfiles(b:integer; fn:astr; toa:integer;
+                     var c_files,c_oldsiz,c_newsiz:longint;
+                     var abort,next:boolean);
+  var fi:file of byte;
+      f:ulfrec;
+      s:astr;
+      oldboard,pl,rn,atype:integer;
+      ok:boolean;
+  begin
+    oldboard:=fileboard;
+    if (fileboard<>b) then changefileboard(b);
+    if (fileboard=b) then begin
+      recno(fn,pl,rn); { loads in memuboard }
+      abort:=FALSE; next:=FALSE;
+      while (fn<>'') and (rn<>0) and (not abort) and (not hangup) do begin
+        seek(ulff,rn); read(ulff,f);
+        fn:=memuboard.dlpath+f.filename;
+        atype:=arctype(fn);
+        if (atype<>0) and (atype<>toa) then begin
+          pbn(abort,next); nl;
+          star('Converting "'+sqoutsp(fn)+'"');
+          ok:=FALSE;
+          if (not exist(fn)) then
+            star('File "'+sqoutsp(fn)+'" doesn''t exist.')
+          else begin
+            ok:=TRUE;
+            s:=copy(fn,1,pos('.',fn))+systat.filearcinfo[toa].ext;
+            conva(ok,atype,bb,systat.temppath+'1\',sqoutsp(fn),sqoutsp(s));
+            if (ok) then begin
+              assign(fi,sqoutsp(fn));
+              {$I-} reset(fi); {$I+}
+              ok:=(ioresult=0);
+              if (ok) then begin
+                oldsiz:=trunc(filesize(fi));
+                close(fi);
+              end else
+                star('Unable to access "'+sqoutsp(fn)+'"');
+              if (ok) then
+                if (not exist(sqoutsp(s))) then begin
+                  star('Unable to access "'+sqoutsp(s)+'"');
+                  sysoplog('Unable to access "'+sqoutsp(s)+'"');
+                  ok:=FALSE;
+                end;
+            end;
+            if (ok) then begin
+              f.filename:=align(stripname(sqoutsp(s)));
+              seek(ulff,rn); write(ulff,f);
+              {$I-} erase(fi); {$I+}
+              if (ioresult<>0) then begin
+                star('Unable to erase "'+sqoutsp(fn)+'"');
+                sysoplog('Unable to erase "'+sqoutsp(fn)+'"');
+              end;
+
+              assign(fi,sqoutsp(s));
+              {$I-} reset(fi); {$I+}
+              ok:=(ioresult=0);
+              if (not ok) then begin
+                star('Unable to access "'+sqoutsp(s)+'"');
+                sysoplog('Unable to access "'+sqoutsp(s)+'"');
+              end else begin
+                newsiz:=trunc(filesize(fi));
+                f.blocks:=trunc((filesize(fi)+127.0)/128.0);
+                close(fi);
+                seek(ulff,rn); write(ulff,f);
+              end;
+
+              if (ok) then begin
+                inc(c_oldsiz,oldsiz);
+                inc(c_newsiz,newsiz);
+                inc(c_files);
+                star('Old total space took up  : '+cstrl(oldsiz)+' bytes');
+                star('New total space taken up : '+cstrl(newsiz)+' bytes');
+                if (oldsiz-newsiz>0) then
+                  star('Space saved              : '+cstrl(oldsiz-newsiz)+' bytes')
+                else
+                  star('Space wasted             : '+cstrl(newsiz-oldsiz)+' bytes');
+              end;
+            end else begin
+              sysoplog('Unable to convert "'+sqoutsp(fn)+'"');
+              star('Unable to convert "'+sqoutsp(fn)+'"');
+            end;
+          end;
+        end;
+        nrecno(fn,pl,rn);
+        wkey(abort,next);
+      end;
+      close(ulff);
+    end;
+    fileboard:=oldboard;
+  end;
+
+begin
+  savpause:=(pause in thisuser.ac);
+  if (savpause) then thisuser.ac:=thisuser.ac-[pause];
+  savflistopt:=thisuser.flistopt; thisuser.flistopt:=0;
+  numfl:=0;
+  fiscan(pl); { loads in memuboard }
+  case cc of
+    'A':begin
+          nl;
+          print('Add file(s) to archive (up to '+cstr(maxfiles)+') -');
+          nl;
+          print('Archive filename: ');
+          prt(':'); mpl(78); input(fn,78);
+          if (fn<>'') then begin
+            if (pos('.',fn)=0) and (memuboard.arctype<>0) then
+              fn:=fn+'.'+systat.filearcinfo[memuboard.arctype].ext;
+            fnx:=isul(fn);
+            if (not fnx) then fn:=memuboard.dlpath+fn;
+            fn:=fexpand(fn); atype:=arctype(fn);
+            if (atype=0) then begin
+              print('Archive format not supported.');
+              listarctypes;
+            end else begin
+              done:=FALSE; c:='A';
+              repeat
+                if (c='A') then
+                  repeat
+                    nl;
+                    print('Add files to list - <CR> to end');
+                    prt(cstr(numfl)+':'); mpl(70); input(s,70);
+                    if s<>'' then begin
+                      if pos('.',s)=0 then s:=s+'*.*';
+                      addfl(s,isul(s));
+                    end;
+                  until (s='') or (numfl>=maxfiles) or (hangup);
+                nl;
+                prt('Add files to list (?=help) : '); onek(c,'QADLR?');
+                nl;
+                case c of
+                  '?':begin
+                        lcmds(19,3,'Add more to list','Do it!');
+                        lcmds(19,3,'List files in list','Remove files from list');
+                        lcmds(19,3,'Quit','');
+                      end;
+                  'D':begin
+                        i:=0;
+                        repeat
+                          inc(i); j:=1;
+                          s2:=sqoutsp(fl[i]);
+                          if not isul(s2) then
+                            s2:=memuboard.dlpath+s2;
+                          s1:=arcmci(systat.filearcinfo[atype].arcline,fn,s2);
+                          os1:=s1;
+                          while (length(s1)<=maxdoschrline) and (i<numfl) do begin
+                            inc(i); inc(j);
+                            s2:=sqoutsp(fl[i]);
+                            if (not isul(s2)) then
+                              s2:=memuboard.dlpath+s2;
+                            os1:=s1;
+                            s1:=s1+' '+s2;
+                          end;
+                          if (length(s1)>maxdoschrline) then begin
+                            dec(i); dec(j);
+                            s1:=os1;
+                          end;
+                          ok:=TRUE;
+                          star('Adding '+cstr(j)+' files to archive...');
+                          shel1;
+                          execbatch(ok,TRUE,'tgtemp1.bat','tgtemp1.$$$',
+                                    systat.temppath+'1\',s1,
+                                    systat.filearcinfo[atype].succlevel);
+                          shel2;
+                          if (not ok) then begin
+                            star('Errors in adding files');
+                            ok:=pynq('Continue anyway? ');
+                            if (hangup) then ok:=FALSE;
+                          end;
+                        until (i>=numfl) or (not ok);
+                        arccomment(ok,atype,memuboard.cmttype,fn);
+                        nl;
+                        if (not fnx) then begin
+                          s2:=stripname(fn);
+                          recno(s2,pl,rn);
+                          if (rn<>0) then
+                            sprint(#3#5+'NOTE: File already exists in listing!');
+                          if pynq('Add archive to listing? ') then begin
+                            assign(fi,fn);
+                            {$I-} reset(fi); {$I+}
+                            if ioresult=0 then begin
+                              f.blocks:=trunc((filesize(fi)+127.0)/128.0);
+                              close(fi);
+                            end;
+                            f.filename:=s2;
+                            ok1:=TRUE;
+                            if pynq('Use stats of file in directory? ') then begin
+                              repeat
+                                nl;
+                                prt('Enter filename: '); mpl(12); input(s2,12);
+                                recno(s2,pl,rn);
+                                if rn=0 then print('File not found!');
+                                if s2='' then print('Aborted!');
+                              until (rn<>0) or (s2='') or (hangup);
+                              if s2<>'' then begin
+                                seek(ulff,rn); read(ulff,f1);
+                                with f do begin
+                                  description:=f1.description;
+                                  vpointer:=f1.vpointer;
+                                  nacc:=f1.nacc;
+                                  ft:=f1.ft;
+                                  owner:=f1.owner;
+                                  stowner:=f1.stowner;
+                                  date:=f1.date;
+                                  daten:=f1.daten;
+                                end;
+                                f1.vpointer:=-1;
+                                seek(ulff,rn); write(ulff,f1);
+                              end else
+                                ok1:=FALSE;
+                            end else
+                              ok1:=FALSE;
+
+                            if (not ok1) then begin
+                              wenttosysop:=FALSE;
+                              dodescrs(f,v,pl,wenttosysop);
+                              f.nacc:=0;
+                              f.ft:=255;
+                              f.owner:=usernum;
+                              f.stowner:=allcaps(thisuser.name);
+                              f.date:=date;
+                              f.daten:=daynum(date);
+                            end;
+
+                            f.filestat:=[];
+                            if (not fso) and (not systat.validateallfiles) then
+                              f.filestat:=f.filestat+[notval];
+
+                            if (not systat.fileptratio) then f.filepoints:=0
+                            else begin
+                              rfpts:=(f.blocks/8)/systat.fileptcompbasesize;
+                              f.filepoints:=round(rfpts);
+                            end;
+
+                            if (rn=0) then newff(f,v) else writefv(rn,f,v);
+                          end;
+                        end;
+                        if pynq('Delete original files? ') then
+                          for i:=1 to numfl do begin
+                            s2:=sqoutsp(fl[i]);
+                            if not isul(fl[i]) then begin
+                              recno(s2,pl,rn);
+                              if rn<>0 then deleteff(rn,pl,TRUE);
+                              s2:=memuboard.dlpath+s2;
+                            end;
+                            assign(fi,s2);
+                            {$I-} erase(fi); {$I+}
+                            if (ioresult<>0) then
+                              print('"'+s2+'": Could not delete');
+                          end;
+                        if ok then done:=TRUE;
+                      end;
+                  'L':if (numfl=0) then print('No files in list!')
+                      else begin
+                        abort:=FALSE; next:=FALSE;
+                        s:=''; j:=0;
+                        i:=0;
+                        repeat
+                          inc(i);
+                          if isul(fl[i]) then s:=s+#3#3 else s:=s+#3#1;
+                          s:=s+align(stripname(fl[i]));
+                          inc(j);
+                          if j<5 then s:=s+'    '
+                          else begin
+                            printacr(s,abort,next);
+                            s:=''; j:=0;
+                          end;
+                        until (i=numfl) or (abort) or (hangup);
+                        if (j in [1..4]) and (not abort) then
+                          printacr(s,abort,next);
+                      end;
+                  'R':begin
+                        prt('Remove filename: '); mpl(12); input(s,12);
+                        i:=0;
+                        repeat
+                          inc(i);
+                          if align(stripname(fl[i]))=align(s) then begin
+                            s1:=sqoutsp(fl[i]); sprompt(#3#3+s1);
+                            if pynq('   Remove it? ') then begin
+                              for j:=i to numfl-1 do fl[j]:=fl[j+1];
+                              dec(numfl); dec(i);
+                            end;
+                          end;
+                        until (i>=numfl);
+                      end;
+                  'Q':done:=TRUE;
+                end;
+              until (done) or (hangup);
+
+            end;
+          end;
+        end;
+    'C':begin
+          nl;
+          print('Convert archive formats -');
+          nl;
+          print('Filespec:');
+          prt(':'); mpl(78); input(fn,78);
+          c_files:=0; c_oldsiz:=0; c_newsiz:=0;
+          if (fn<>'') then begin
+            nl;
+            abort:=FALSE; next:=FALSE;
+            repeat
+              prt('Archive type to use? (?=List) : '); input(s,3);
+              if (s='?') then begin nl; listarctypes; nl; end;
+            until (s<>'?');
+            if (value(s)<>0) then bb:=value(s)
+              else bb:=arctype(s+'FILENAME.'+s);
+            if (bb<>0) then begin
+              sysoplog('Conversion process began at '+date+' '+time+'.');
+              if (isul(fn)) then begin
+                fsplit(fn,dstr,nstr,estr); s:=dstr;
+                findfirst(fn,AnyFile-Directory-VolumeID,dirinfo);
+                abort:=FALSE; next:=FALSE;
+                while (doserror=0) and (not abort) and (not hangup) do begin
+                  fn:=fexpand(sqoutsp(dstr+dirinfo.name));
+                  atype:=arctype(fn);
+                  if (atype<>0) and (atype<>bb) then begin
+                    star('Converting "'+fn+'"');
+                    ok:=TRUE;
+                    s:=copy(fn,1,pos('.',s))+systat.filearcinfo[bb].ext;
+                    conva(ok,atype,bb,systat.temppath+'1\',fn,s);
+                    if (ok) then begin
+                      assign(fi,sqoutsp(fn));
+                      {$I-} reset(fi); {$I+}
+                      ok:=(ioresult=0);
+                      if (ok) then begin
+                        oldsiz:=trunc(filesize(fi));
+                        close(fi);
+                      end else
+                        star('Unable to access "'+sqoutsp(fn)+'"');
+                      if (ok) then
+                        if (not exist(sqoutsp(s))) then begin
+                          star('Unable to access "'+sqoutsp(s)+'"');
+                          sysoplog('Unable to access "'+sqoutsp(s)+'"');
+                          ok:=FALSE;
+                        end;
+                    end;
+                    if (ok) then begin
+                      {$I-} erase(fi); {$I+}
+                      if (ioresult<>0) then
+                        star('Unable to erase "'+sqoutsp(fn)+'"');
+
+                      assign(fi,sqoutsp(s));
+                      {$I-} reset(fi); {$I+}
+                      ok:=(ioresult=0);
+                      if (ok) then begin
+                        newsiz:=trunc(filesize(fi));
+                        close(fi);
+                      end else
+                        star('Unable to access "'+sqoutsp(s)+'"');
+
+                      if (ok) then begin
+                        inc(c_oldsiz,oldsiz);
+                        inc(c_newsiz,newsiz);
+                        inc(c_files);
+                        star('Old total space took up  : '+cstrl(oldsiz)+' bytes');
+                        star('New total space taken up : '+cstrl(newsiz)+' bytes');
+                        if (oldsiz-newsiz>0) then
+                          star('Space saved              : '+cstrl(oldsiz-newsiz)+' bytes')
+                        else
+                          star('Space wasted             : '+cstrl(newsiz-oldsiz)+' bytes');
+                      end;
+                    end else begin
+                      sysoplog('Unable to convert "'+sqoutsp(fn)+'"');
+                      star('Unable to convert "'+sqoutsp(fn)+'"');
+                    end;
+                  end;
+                  findnext(dirinfo);
+                  wkey(abort,next);
+                end;
+{                if (abort) then sprint('@M'+#3#7+'Conversion aborted.');}
+              end else begin
+                ok1:=pynq('Search all directories? ');
+                nl;
+                if (ok1) then begin
+                  i:=0; abort:=FALSE; next:=FALSE;
+                  while (not abort) and (i<=maxulb) and (not hangup) do begin
+                    if (fbaseac(i)) then
+                      cvtfiles(i,fn,bb,c_files,c_oldsiz,c_newsiz,abort,next);
+                    inc(i);
+                    wkey(abort,next);
+                    if (next) then abort:=FALSE;
+                  end;
+                end else
+                  cvtfiles(fileboard,fn,bb,c_files,c_oldsiz,c_newsiz,
+                           abort,next);
+                reset(ulff);
+              end;
+              sysoplog('Conversion process ended at '+date+' '+time+'.');
+              nl;
+              nl;
+              star('Total archives converted : '+cstr(c_files));
+              star('Old total space took up  : '+cstrl(c_oldsiz)+' bytes');
+              star('New total space taken up : '+cstrl(c_newsiz)+' bytes');
+              if (c_oldsiz-c_newsiz>0) then
+                star('Space saved              : '+cstrl(c_oldsiz-c_newsiz)+' bytes')
+              else
+                star('Space wasted             : '+cstrl(c_newsiz-c_oldsiz)+' bytes');
+              sysoplog('Converted '+cstr(c_files)+' archives; old size='+
+                       cstrl(c_oldsiz)+' bytes, new size='+cstrl(c_newsiz)+' bytes');
+            end;
+          end;
+        end;
+    'M':begin
+          nl;
+          print('Comment field update -');
+          nl;
+          print('Filespec:');
+          prt(':'); mpl(78); input(fn,78);
+          if (fn<>'') then begin
+            nl;
+            abort:=FALSE; next:=FALSE;
+            if (isul(fn)) then begin
+              prt('Comment type to use? (1-3,0=None) [1] : ');
+              ini(bb);
+              if (badini) then bb:=1;
+              if (bb<0) or (bb>3) then bb:=1;
+              fsplit(fn,dstr,nstr,estr); s:=dstr;
+              findfirst(fn,AnyFile-Directory-VolumeID,dirinfo);
+              abort:=FALSE; next:=FALSE;
+              while (doserror=0) and (not abort) and (not hangup) do begin
+                fn:=fexpand(sqoutsp(dstr+dirinfo.name));
+                atype:=arctype(fn);
+                if (atype<>0) then begin
+                  star('Commenting "'+fn+'"');
+                  ok:=TRUE;
+                  arccomment(ok,atype,bb,fn);
+                end;
+                findnext(dirinfo);
+                wkey(abort,next);
+              end;
+{              if (abort) then sprint('@M'+#3#7+'Comment update aborted.');}
+            end else begin
+              ok1:=pynq('Search all directories? ');
+              nl;
+              if (ok1) then begin
+                i:=0; abort:=FALSE; next:=FALSE;
+                while (not abort) and (i<=maxulb) and (not hangup) do begin
+                  if (fbaseac(i)) then cmtfiles(i,fn,abort,next);
+                  inc(i);
+                  wkey(abort,next);
+                  if (next) then abort:=FALSE;
+                end;
+              end else
+                cmtfiles(fileboard,fn,abort,next);
+              reset(ulff);
+            end;
+          end;
+        end;
+    'T':begin
+          nl;
+          print('File integrity testing -');
+          nl;
+          print('Filespec:');
+          prt(':'); mpl(78); input(fn,78);
+          if (fn<>'') then begin
+            nl;
+            delbad:=pynq('Delete files that don''t pass the test? ');
+            nl;
+            abort:=FALSE; next:=FALSE;
+            if (isul(fn)) then begin
+              fsplit(fn,dstr,nstr,estr); s:=dstr;
+              findfirst(fn,AnyFile-Directory-VolumeID,dirinfo);
+              abort:=FALSE; next:=FALSE;
+              while (doserror=0) and (not abort) and (not hangup) do begin
+                fn:=fexpand(sqoutsp(dstr+dirinfo.name));
+                atype:=arctype(fn);
+                if (atype<>0) then begin
+                  star('Testing "'+fn+'"');
+                  ok:=TRUE;
+                  arcintegritytest(ok,atype,fn);
+                  if (not ok) then begin
+                    star('File "'+fn+'" didn''t pass integrity test.');
+                    if (delbad) then begin
+                      assign(fi,fn);
+                      {$I-} erase(fi); {$I+}
+                      if (ioresult<>0) then star('Error erasing "'+fn+'"!');
+                    end;
+                  end;
+                end;
+                findnext(dirinfo);
+                wkey(abort,next);
+              end;
+{              if (abort) then sprint('@M'+#3#7+'Integrity testing aborted.');}
+            end else begin
+              ok1:=pynq('Search all directories? ');
+              nl;
+              if (ok1) then begin
+                i:=0; abort:=FALSE; next:=FALSE;
+                while (not abort) and (i<=maxulb) and (not hangup) do begin
+                  if (fbaseac(i)) then testfiles(i,fn,delbad,abort,next);
+                  inc(i);
+                  wkey(abort,next);
+                  if (next) then abort:=FALSE;
+                end;
+              end else
+                testfiles(fileboard,fn,delbad,abort,next);
+              reset(ulff);
+            end;
+          end;
+        end;
+    'X':begin {* extract *}
+        end;
+  end;
+  close(ulff);
+  thisuser.flistopt:=savflistopt;
+  if (savpause) then thisuser.ac:=thisuser.ac+[pause];
+end;
+
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/archive3.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,196 @@
+{$A+,B+,D-,E+,F+,I+,L-,N-,O+,R-,S+,V-}
+unit archive3;
+
+interface
+
+uses
+  crt, dos,
+
+  {rcg11172000 no overlay under Linux.}
+  {overlay,}
+
+  archive1,
+  common,
+  execbat,
+  file0, file11;
+
+procedure rezipstuff;
+
+implementation
+
+var rezipcmd:string;
+
+procedure cvtfiles(b:integer; fn:astr; var c_files,c_oldsiz,c_newsiz:longint;
+                   var abort,next:boolean);
+var fi:file of byte;
+    f:ulfrec;
+    s,ps,ns,es:astr;
+    oldsiz,newsiz:longint;
+    oldboard,pl,rn,atype:integer;
+    ok:boolean;
+begin
+  oldboard:=fileboard;
+  if (fileboard<>b) then changefileboard(b);
+  if (fileboard=b) then begin
+    recno(fn,pl,rn); { loads in memuboard }
+    abort:=FALSE; next:=FALSE;
+    while (fn<>'') and (rn<>0) and (not abort) and (not hangup) do begin
+      seek(ulff,rn); read(ulff,f);
+      fn:=memuboard.dlpath+f.filename;
+      atype:=arctype(fn);
+      if (atype<>0) then begin
+        pbn(abort,next); nl;
+        star('Converting "'+sqoutsp(fn)+'"');
+        ok:=FALSE;
+        if (not exist(fn)) then
+          star('File "'+sqoutsp(fn)+'" doesn''t exist.')
+        else begin
+          if (rezipcmd<>'') then begin
+            assign(fi,sqoutsp(fn));
+            {$I-} reset(fi); {$I+}
+            if (ioresult=0) then begin
+              oldsiz:=trunc(filesize(fi));
+              close(fi);
+            end;
+            shel1;
+            execbatch(ok,TRUE,'tgtemp1.bat','tgtest1.$$$',systat.temppath+'1\',
+                      rezipcmd+' '+sqoutsp(fn),-1);
+            shel2;
+            assign(fi,sqoutsp(fn));
+            {$I-} reset(fi); {$I+}
+            if (ioresult=0) then begin
+              newsiz:=trunc(filesize(fi));
+              f.blocks:=trunc((filesize(fi)+127.0)/128.0);
+              close(fi);
+              seek(ulff,rn); write(ulff,f);
+            end;
+          end else begin
+            ok:=TRUE;
+            s:=fn;
+            conva(ok,atype,atype,systat.temppath+'1\',sqoutsp(fn),sqoutsp(s));
+            if (ok) then begin
+              fsplit(fn,ps,ns,es); fn:=ps+ns+'.#$%';
+              assign(fi,sqoutsp(fn));
+              {$I-} reset(fi); {$I+}
+              ok:=(ioresult=0);
+              if (ok) then begin
+                oldsiz:=trunc(filesize(fi));
+                close(fi);
+              end else
+                star('Unable to access "'+sqoutsp(fn)+'"');
+              if (ok) then
+                if (not exist(sqoutsp(s))) then begin
+                  star('Unable to access "'+sqoutsp(s)+'"');
+                  sysoplog('Unable to access "'+sqoutsp(s)+'"');
+                  ok:=FALSE;
+                end;
+            end;
+            if (ok) then begin
+              f.filename:=align(stripname(sqoutsp(s)));
+              seek(ulff,rn); write(ulff,f);
+
+              fsplit(fn,ps,ns,es); fn:=ps+ns+'.#$%';
+              assign(fi,fn); {$I-} erase(fi); {$I+}
+
+              if (ioresult<>0) then begin
+                star('Unable to erase "'+sqoutsp(fn)+'"');
+                sysoplog('Unable to erase "'+sqoutsp(fn)+'"');
+              end;
+
+              assign(fi,sqoutsp(s));
+              {$I-} reset(fi); {$I+}
+              ok:=(ioresult=0);
+              if (not ok) then begin
+                star('Unable to access "'+sqoutsp(s)+'"');
+                sysoplog('Unable to access "'+sqoutsp(s)+'"');
+              end else begin
+                newsiz:=trunc(filesize(fi));
+                f.blocks:=trunc((filesize(fi)+127.0)/128.0);
+                close(fi);
+                seek(ulff,rn); write(ulff,f);
+                arccomment(ok,atype,memuboard.cmttype,sqoutsp(s));
+              end;
+            end else begin
+              sysoplog('Unable to convert "'+sqoutsp(fn)+'"');
+              star('Unable to convert "'+sqoutsp(fn)+'"');
+            end;
+          end;
+          if (ok) then begin
+            inc(c_oldsiz,oldsiz);
+            inc(c_newsiz,newsiz);
+            inc(c_files);
+            star('Old total space took up  : '+cstrl(oldsiz)+' bytes');
+            star('New total space taken up : '+cstrl(newsiz)+' bytes');
+            if (oldsiz-newsiz>0) then
+              star('Space saved              : '+cstrl(oldsiz-newsiz)+' bytes')
+            else
+              star('Space wasted             : '+cstrl(newsiz-oldsiz)+' bytes');
+          end;
+        end;
+      end;
+      nrecno(fn,pl,rn);
+      wkey(abort,next);
+    end;
+    close(ulff);
+  end;
+  fileboard:=oldboard;
+end;
+
+procedure rezipstuff;
+var fn:astr;
+    c_files,c_oldsiz,c_newsiz:longint;
+    i:integer;
+    abort,next,ok1:boolean;
+begin
+  nl;
+  print('Re-compress archives -');
+  nl;
+  print('Filespec:');
+  prt(':'); mpl(78); input(fn,78);
+  c_files:=0; c_oldsiz:=0; c_newsiz:=0;
+  if (fn<>'') then begin
+    nl;
+    sprint(#3#7+'Do you wish to use a REZIP external utility?');
+    if pynq('(such as REZIP.EXE) ? (Y/N) : ') then begin
+      nl;
+      prt('Enter commandline (example: "REZIP") : ');
+      input(rezipcmd,100);
+      if (rezipcmd='') then exit;
+    end else
+      rezipcmd:='';
+    nl;
+    abort:=FALSE; next:=FALSE;
+    ok1:=pynq('Search all directories? ');
+    nl;
+    sysoplog('Conversion process began at '+date+' '+time+'.');
+    print('Conversion process began at '+date+' '+time+'.');
+    nl;
+    if (ok1) then begin
+      i:=0; abort:=FALSE; next:=FALSE;
+      while ((not abort) and (i<=maxulb) and (not hangup)) do begin
+        if (fbaseac(i)) then
+          cvtfiles(i,fn,c_files,c_oldsiz,c_newsiz,abort,next);
+        inc(i);
+        wkey(abort,next);
+        if (next) then abort:=FALSE;
+      end;
+    end else
+      cvtfiles(fileboard,fn,c_files,c_oldsiz,c_newsiz,abort,next);
+  end;
+  nl;
+  sysoplog('Conversion process ended at '+date+' '+time+'.');
+  print('Conversion process ended at '+date+' '+time+'.');
+  nl;
+  nl;
+  star('Total archives converted : '+cstr(c_files));
+  star('Old total space took up  : '+cstrl(c_oldsiz)+' bytes');
+  star('New total space taken up : '+cstrl(c_newsiz)+' bytes');
+  if (c_oldsiz-c_newsiz>0) then
+    star('Space saved              : '+cstrl(c_oldsiz-c_newsiz)+' bytes')
+  else
+    star('Space wasted             : '+cstrl(c_newsiz-c_oldsiz)+' bytes');
+  sysoplog('Converted '+cstr(c_files)+' archives; old size='+
+           cstrl(c_oldsiz)+' bytes, new size='+cstrl(c_newsiz)+' bytes');
+end;
+
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ascii.inc	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,26 @@
+(*----------------------------------------------------------------------*)
+(*               ASCII character set definitions                        *)
+(*----------------------------------------------------------------------*)
+
+const
+  NUL  = 0;         (* NULL Character  *)
+  ETX  = 3;         (* ETX = ^C        *)
+  ENQ  = 5;         (* ENQ Character   *)
+  ACK  = 6;
+  BELL = 7;         (* BELL Character  *)
+  BS   = 8;         (* Backspace Char  *)
+  HT   = 9;         (* Horizontal Tab  *)
+  LF   = 10;        (* Line Feed       *)
+  VT   = 11;        (* Vertical Tab    *)
+  FF   = 12;        (* Form Feed       *)
+  CR   = 13;        (* Carriage Return *)
+  SO   = 14;        (* Start grahics   *)
+  SI   = 15;        (* End graphics    *)
+  XON  = 17;        (* XON  Character  *)
+  XOFF = 19;        (* XOFF Character  *)
+  CAN  = 24;
+  SUB  = 26;        (* EOF Character   *)
+  ESC  = 27;        (* Escape          *)
+  SP   = 32;        (* Space           *)
+  DEL  = 127;       (* DEL  Character  *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/asyint.map	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,38 @@
+
+ Start  Stop   Length Name               Class
+
+ 00000H 001AEH 001AFH CODE               
+ 001B0H 001B0H 00000H DATA               
+
+Undefined symbol 'ASYNC_UART_IIR' in module ASYINT.ASM
+Undefined symbol 'ASYNC_BASE' in module ASYINT.ASM
+Undefined symbol 'ASYNC_DO_XONXOFF' in module ASYINT.ASM
+Undefined symbol 'ASYNC_XOFF_RECEIVED' in module ASYINT.ASM
+Undefined symbol 'ASYNC_XOFF_REC_DISPLAY' in module ASYINT.ASM
+Undefined symbol 'ASYNC_XON_REC_DISPLAY' in module ASYINT.ASM
+Undefined symbol 'ASYNC_LINE_STATUS' in module ASYINT.ASM
+Undefined symbol 'ASYNC_BUFFER_HEAD' in module ASYINT.ASM
+Undefined symbol 'ASYNC_BUFFER_PTR' in module ASYINT.ASM
+Undefined symbol 'ASYNC_BUFFER_USED' in module ASYINT.ASM
+Undefined symbol 'ASYNC_MAXBUFFERUSED' in module ASYINT.ASM
+Undefined symbol 'ASYNC_BUFFER_SIZE' in module ASYINT.ASM
+Undefined symbol 'ASYNC_BUFFER_TAIL' in module ASYINT.ASM
+Undefined symbol 'ASYNC_BUFFER_HIGH' in module ASYINT.ASM
+Undefined symbol 'ASYNC_XOFF_SENT' in module ASYINT.ASM
+Undefined symbol 'ASYNC_BUFFER_HIGH_2' in module ASYINT.ASM
+Undefined symbol 'ASYNC_SEND_XOFF' in module ASYINT.ASM
+Undefined symbol 'ASYNC_DO_DSR' in module ASYINT.ASM
+Undefined symbol 'ASYNC_UART_MSR' in module ASYINT.ASM
+Undefined symbol 'ASYNC_DO_CTS' in module ASYINT.ASM
+Undefined symbol 'ASYNC_OBUFFER_TAIL' in module ASYINT.ASM
+Undefined symbol 'ASYNC_OBUFFER_HEAD' in module ASYINT.ASM
+Undefined symbol 'ASYNC_UART_IER' in module ASYINT.ASM
+Undefined symbol 'ASYNC_MODEM_STATUS' in module ASYINT.ASM
+Undefined symbol 'ASYNC_OBUFFER_PTR' in module ASYINT.ASM
+Undefined symbol 'ASYNC_OBUFFER_USED' in module ASYINT.ASM
+Undefined symbol 'ASYNC_OBUFFER_SIZE' in module ASYINT.ASM
+Undefined symbol 'ASYNC_UART_LSR' in module ASYINT.ASM
+Undefined symbol 'ASYNC_LINE_ERROR_FLAGS' in module ASYINT.ASM
+Program entry point at 0000:0000
+Warning: no stack
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bb.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,389 @@
+{$A+,B+,D-,E+,F+,I+,L+,N-,O+,R-,S+,V-}
+{$M 32150,0,0}          { Declared here suffices for all Units as well! }
+
+program BatchBackup;
+
+uses
+  crt,dos,
+  myio;
+
+{$I func.pas}
+
+type
+  lbrec=record
+          drv:char;
+          lb:datetime;
+          nacc:integer;
+        end;
+
+const
+  lastspec='c:\lastbak.txt';
+  cline='tape SBK @D:\/S-\TRAP*.MSG/S-\BBS.OVR/S-\BBS.EXE/S/A/C/C+/-O/R@T/LBAK@D@N';
+  lodrv:char='C';
+  hidrv:char='E';
+  go:boolean=FALSE;
+  abort:boolean=FALSE;
+  firstq:boolean=TRUE;
+
+var
+  lbdrv:array['C'..'G'] of lbrec;
+  tagged:array['C'..'G'] of boolean;
+  wind,winds:windowrec;
+  y,oy:char;
+  sx,sy:integer;
+  lbf:file of lbrec;
+
+{rcg11172000 had to change this to get it compiling under Free Pascal...}
+{function substall(src,old,new:string):string;}
+function substall(src,old,_new:string):string;
+var p:integer;
+begin
+  p:=1;
+  while p>0 do begin
+    p:=pos(old,src);
+    if p>0 then begin
+      insert(_new,src,p+length(old));
+      delete(src,p,length(old));
+    end;
+  end;
+  substall:=src;
+end;
+
+function sdat(dt:datetime):string;
+
+  function tch(i:integer):string;
+  var s:string;
+  begin
+    str(i,s);
+    if i<10 then s:='0'+s;
+    if i<0 then s:='00';
+    tch:=s;
+  end;
+
+begin
+  with dt do
+    sdat:=tch(month)+'/'+tch(day)+'/'+tch(year-1900)+' '+tch(hour)+':'+tch(min)+':'+tch(sec);
+end;
+
+procedure unsdat(s:string; var dt:datetime);
+var x:integer;
+begin
+  with dt do begin
+    val(copy(s,7,2),year,x); inc(year,1900);
+    val(copy(s,1,2),month,x);
+    val(copy(s,4,2),day,x);
+    val(copy(s,10,2),hour,x);
+    val(copy(s,13,2),min,x);
+    val(copy(s,16,2),sec,x);
+  end;
+end;
+
+procedure datnow(var dt:datetime);
+var r:registers;
+begin
+  with dt, r do begin
+    ax:=$2a00; msdos(dos.registers(r));
+    year:=cx;
+    month:=dx shr 8;
+    day:=dx mod 256;
+    ax:=$2c00; msdos(dos.registers(r)); {intr($21,dos.registers(r));}
+    hour:=cx shr 8;
+    min:=cx mod 256;
+    sec:=dx shr 8;
+  end;
+end;
+
+function dtchk(s:string):boolean;
+begin
+  dtchk:=FALSE;
+  if (s[1] in ['0'..'9']) and (s[2] in ['0'..'9']) and
+     (s[4] in ['0'..'9']) and (s[5] in ['0'..'9']) and
+     (s[7] in ['0'..'9']) and (s[8] in ['0'..'9']) then dtchk:=TRUE;
+end;
+
+function gooddate(s:string):boolean;
+begin
+  gooddate:=FALSE;
+  if (s[3] in ['-','/']) and (s[6] in ['-','/']) and (length(s)=8) then
+    if dtchk(s) then gooddate:=TRUE;
+end;
+
+procedure inlast;
+var c:char;
+    dt:datetime;
+begin
+  datnow(dt);
+  assign(lbf,lastspec);
+  {$I-} reset(lbf); {$I+}
+  if ioresult=0 then
+    for c:=lodrv to hidrv do
+      read(lbf,lbdrv[c])
+  else begin
+    rewrite(lbf);
+    for c:=lodrv to hidrv do begin
+      with lbdrv[c] do begin
+        drv:=c;
+        lb:=dt;
+        nacc:=0;
+      end;
+      write(lbf,lbdrv[c]);
+    end;
+  end;
+  close(lbf);
+end;
+
+procedure tagall;
+var c:char;
+begin
+  for c:=lodrv to hidrv do tagged[c]:=TRUE;
+end;
+
+procedure setscreen;
+begin
+  sx:=wherex; sy:=wherey;
+  savescreen(winds,1,1,80,25);
+  setwindow(wind,10,3,53,ord(hidrv)-ord(lodrv)+10,9,1,1);
+  window(12,4,52,ord(hidrv)-ord(lodrv)+9);
+  clrscr;
+end;
+
+procedure init;
+begin
+  inlast;
+  tagall;
+  setscreen;
+end;
+
+procedure closeup;
+begin
+  removewindow(winds);
+  gotoxy(sx,sy);
+end;
+
+procedure sc(s:string);
+const bcol:boolean=FALSE;
+      fcol:boolean=FALSE;
+var i:integer;
+begin
+  for i:=1 to length(s) do
+    if not fcol then
+      if not bcol then
+        case s[i] of
+          #3:fcol:=TRUE;
+          #4:bcol:=TRUE;
+        else
+             write(s[i]);
+        end
+      else begin
+        bcol:=FALSE;
+        textbackground(ord(s[i]));
+      end
+    else begin
+      fcol:=FALSE;
+      textcolor(ord(s[i]));
+    end;
+end;
+
+procedure scln(s:string);
+begin
+  sc(s);
+  writeln;
+end;
+
+procedure showstuff;
+var c:char;
+    s:string;
+begin
+  gotoxy(1,3);
+  for c:=lodrv to hidrv do begin
+    if tagged[c] then sc(#3#15+'+') else sc(#3#9+'-');
+    sc(#3#11+' Drive '+c+':'+#3#9+' Since '+#3#14+sdat(lbdrv[c].lb));
+    str(lbdrv[c].nacc,s);
+    scln(#3#9+' (#'+s+')');
+  end;
+  writeln;
+  scln(#3#11+'  OK');
+  sc(#3#11+'  Abort');
+end;
+
+procedure lin(i:integer);
+
+  procedure dd(y:char);
+  begin
+    if y<=hidrv then sc('Drive '+y+':') else
+      if y=chr(ord(hidrv)+2) then sc('OK') else
+        if y=chr(ord(hidrv)+3) then sc('Abort');
+  end;
+
+begin
+  case i of
+    0:begin
+        gotoxy(3,ord(oy)-64);
+        sc(#4#1+#3#11);
+        dd(oy);
+      end;
+    1:begin
+        gotoxy(3,ord(y)-64);
+        sc(#4#3+#3#0);
+        dd(y);
+      end;
+  end;
+end;
+
+procedure glin;
+begin
+  lin(0); lin(1);
+  oy:=y;
+end;
+
+procedure tell(s:string);
+var i:integer;
+begin
+  CursorOff;
+  i:=40-(length(s) div 2)-3;
+  setwindow(wind,i,10,i+length(s)+5,14,9,1,1);
+  gotoxy(3,2); textcolor(15); writeln(s);
+end;
+
+
+{rcg11172000 added by me.}
+procedure CursorOn;
+begin
+  writeln('STUB: bb.pas; CursorOn()...');
+end;
+{rcg11172000 adds end.}
+
+
+procedure makesound;
+var i,j,k:integer;
+begin
+  i:=100;
+  repeat
+    sound(i);
+    delay(i div 100);
+    j:=100;
+    repeat
+      sound(j);
+      delay(j div 100);
+      k:=100;
+      repeat
+        sound(k);
+        delay(k div 30);
+        inc(k,j);
+      until (k>=2000) or (keypressed);
+      inc(j,i);
+    until (j>=500) or (keypressed);
+    inc(i,k);
+  until (i>=1000) or (keypressed);
+  nosound;
+end;
+
+var
+  c:char;
+  s,s1,s2:string;
+  changed:boolean;
+  dt:datetime;
+  bf:text;
+  i:integer;
+
+begin
+  init;
+
+  infield_out_fgrd:=14; infield_out_bkgd:=1;
+  infield_inp_fgrd:=0; infield_inp_bkgd:=7;
+
+  scln(#3#15+'Backup new files');
+  writeln;
+  showstuff;
+  y:=chr(ord(hidrv)+2); oy:=y; glin;
+
+  repeat
+    case readkey of
+      #0 :case ord(readkey) of
+            ARROW_UP   :if y=chr(ord(hidrv)+2) then y:=pred(pred(y)) else y:=pred(y);
+            ARROW_DOWN :if y=hidrv then y:=succ(succ(y)) else y:=succ(y);
+            ARROW_LEFT,
+            ARROW_RIGHT:begin
+                          changed:=FALSE;
+                          s:=sdat(lbdrv[y].lb);
+                          s1:=copy(s,1,8); s2:=copy(s,10,8);
+                          infield1(18,ord(y)-64,s1,8);
+                          if not gooddate(s1) then s1:=copy(s,1,8);
+                          if s1<>copy(s,1,8) then changed:=TRUE;
+                          gotoxy(18,ord(y)-64); write(s1);
+                          if changed then unsdat(s1+' '+s2,lbdrv[y].lb);
+                          changed:=FALSE;
+                        end;
+          end;
+      #13:if y>hidrv then go:=TRUE
+          else begin
+            tagged[y]:=not tagged[y];
+            lin(0); showstuff;
+            glin;
+          end;
+      #27:begin
+            y:=chr(ord(hidrv)+3);
+            go:=TRUE;
+          end;
+    end;
+    if y>chr(ord(hidrv)+3) then y:=lodrv;
+    if y<lodrv then y:=chr(ord(hidrv)+3);
+    if y<>oy then glin;
+  until (go);
+  lin(0);
+
+  abort:=(y=chr(ord(hidrv)+3));
+
+  removewindow(wind);
+
+  if not abort then begin
+    for c:=lodrv to hidrv do
+      if tagged[c] then begin
+        inc(lbdrv[c].nacc);
+
+        assign(bf,'tempbat.bat');
+        rewrite(bf);
+{        writeln(bf,'@echo off');}
+        writeln(bf,'cls');
+        s1:=sdat(lbdrv[c].lb); s1:=copy(s1,1,8); str(lbdrv[c].nacc,s2);
+        s:=substall(cline,'@D',c);
+        s:=substall(s,'@N',s2);
+        s:=substall(s,'@T',s1);
+        writeln(bf,s);
+        close(bf);
+
+        datnow(dt);
+        lbdrv[c].lb:=dt;
+
+        removewindow(winds);
+        tell('Insert tape for drive '+c+': ...');
+        if not firstq then begin
+          repeat
+            makesound;
+            i:=0;
+            repeat
+              inc(i);
+            until (i=0) or (keypressed);
+          until keypressed;
+        end;
+
+        firstq:=FALSE;
+        y:=readkey;
+        removewindow(wind);
+        CursorOn;
+
+        rewrite(lbf);
+        for c:=lodrv to hidrv do
+          with lbdrv[c] do
+            write(lbf,lbdrv[c]);
+        close(lbf);
+
+        exec(getenv('COMSPEC'),'/c tempbat.bat');
+        erase(bf);
+        abort:=TRUE;
+        makesound;
+      end;
+  end;
+
+  closeup;
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bbs.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,332 @@
+{*****************************************************************************
+ *                               Project Coyote                              *
+ *                             ===================                           *
+ *                                                                           *
+ * Modification History                                                      *
+ * ====================                                                      *
+ *   11/19/92 - 0.14 - Robert Merritt                                        *
+ *                                                                           *
+ *                                                                           *
+ * NOTE: Project Coyote originated from TeleGard 2.5i which was originally   *
+ *       written by Eric Oman, and Martin Pollard.                           *
+ *                                                                           *
+ *****************************************************************************}
+{$A+,B+,D-,E+,F+,I+,L-,N-,O+,R-,S+,V-}
+{$M 60000,0,45000}      { Memory Allocation Sizes }
+
+Program BBS;
+Uses
+
+  {rcg11172000 no overlay under Linux.}
+  {Overlay,}
+
+  Crt,      Dos,      InitP,    Sysop1,   Sysop2,   Sysop3,
+  Sysop4,   Sysop5,   Sysop6,   Sysop7,   Sysop8,   Sysop9,   Sysop10,
+  Sysop11,  Mail0,    Mail1,    Mail2,    Mail3,    Mail4,    Mail5,
+  Mail6,    Mail9,    File0,    File1,    File2,    File3,    File4,
+  File5,    File6,    File7,    File8,    File9,    File10,   File11,
+  File12,   File13,   File14,   Archive1, Archive2, Archive3, Misc1,
+  Misc2,    Misc3,    Misc4,    MiscX,    CUser,    Doors,    Menus2,
+  Menus3,   Menus4,   MyIO,     Logon1,   Logon2,   NewUsers, WfcMenu,
+  Menus,    FvType,   TimeJunk, TmpCom,   MsgPack,  Common,   Common1,
+  Common2,  Common3,  ExecSwap;        {* MiniTerm, Window2,  NewCom *}
+
+{$O MsgPack   } {$O Common1   } {$O Common2   } {$O Common3   } {$O InitP     }
+{$O WfcMenu   } {$O FvType    } {$O TimeJunk  } {$O Sysop1    } {$O Sysop2    }
+{$O Sysop21   } {$O Sysop2a   } {$O Sysop2b   } {$O Sysop2c   } {$O Sysop2d   }
+{$O Sysop2e   } {$O Sysop2f   } {$O Sysop2fa  } {$O Sysop2g   } {$O Sysop2h   }
+{$O Sysop2i   } {$O Sysop2s   } {$O Sysop2z   } {$O Sysop3    } {$O Sysop4    }
+{$O Sysop5    } {$O Sysop6    } {$O Sysop7    } {$O Sysop7m   } {$O Sysop8    }
+{$O Sysop9    } {$O Sysop10   } {$O Sysop11   } {$O Mail0     } {$O Mail1     }
+{$O Mail2     } {$O Mail3     } {$O Mail4     } {$O Mail5     } {$O Mail6     }
+{$O Mail9     } {$O File0     } {$O File1     } {$O File2     } {$O File3     }
+{$O File4     } {$O File5     } {$O File6     } {$O File7     } {$O File8     }
+{$O File9     } {$O File10    } {$O File11    } {$O File12    } {$O File13    }
+{$O File14    } {$O Archive1  } {$O Archive2  } {$O Archive3  } {$O Logon1    }
+{$O Logon2    } {$O NewUsers  } {$O Misc1     } {$O Misc2     } {$O Misc3     }
+{$O Misc4     } {$O MiscX     } {$O CUser     } {$O Doors     } {$O ExecBat   }
+{$O MyIO      } {$O Menus2    } {$O Menus3    } {$O Menus4    }
+
+Const
+  OvrMaxSize      = 60000;
+  BBSMaxHeapSpace = 40000;
+
+{$I LcBbs.Pas}
+
+Var
+  ExitSave  : Pointer;
+  ExecFirst : Boolean;
+  NewMenuCmd: String;
+
+Procedure ErrorHandle;
+{*****************************************************************************
+ * Note: if error occurs IN THIS PROCEDURE,                                  *
+ * it is NOT executed again!  That way an infinite loop is *avoided*....     *
+ *****************************************************************************}
+Var
+  T:Text;
+  F:File;
+  S:String[80];
+  VidSeg:Word;
+  X,Y:Integer;
+  C:Char;
+Begin
+  ExitProc:=ExitSave;
+  If (ErrorAddr<>Nil) then
+  Begin
+    chdir(start_dir);
+    if (textrec(sysopf).mode=fmoutput) then
+    begin
+      writeln(sysopf,#3#8+'*>>'+#3#7+' Runtime error '+cstr(exitcode)+
+              ' at '+date+' '+time+#3#8+' <<*'+#3#5+
+              ' (Check ERR.LOG in main BBS dir)');
+      flush(sysopf); close(sysopf);
+    end;
+    if (textrec(trapfile).mode=fmoutput) then
+    begin
+      writeln(trapfile,'*>> Runtime error '+cstr(exitcode)+' at '+date+' '+
+              time+' <<*');
+      flush(trapfile); close(trapfile);
+    end;
+
+    assign(t,'err.log');
+    {$I-} append(t); {$I+}
+    if (ioresult<>0) then
+    begin
+      rewrite(t);
+      append(t);
+      writeln(t,'様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様');
+      writeln(t,'Critical Error Log file - Contains screen images at instant of Error.');
+      writeln(t);
+    end;
+    writeln(t);
+    if (serialnumber<>0) then
+      s:=' ('+cstr(serialnumber)+vercs+')'
+    else
+      s:='';
+    writeln(t,'> RT #'+cstr(exitcode)+' at '+date+' '+time+'  BBS-Ver: '+ver+s);
+    if (useron) then begin
+      if (spd<>'KB') then s:='at '+spd+' baud' else s:='Locally';
+      writeln(t,'> User "'+allcaps(thisuser.name)+' #'+cstr(usernum)+
+              '" was on '+s);
+    end;
+    writeln(t,' <- Screen Image: -> ');
+
+    {rcg11172000 Not under Linux...}
+    {
+    if (mem[$0000:$0449]=7) then vidseg:=$B000 else vidseg:=$B800;
+    for y:=1 to 25 do
+    begin
+      s:='';
+      for x:=1 to 80 do
+      begin
+        c:=chr(mem[vidseg:(160*(y-1)+2*(x-1))]);
+        if (c=#0) then c:=#32;
+        if ((x=wherex) and (y=wherey)) then c:=#178;
+        if ((x<>80) or ((x=80) and (c<>#32))) then s:=s+c;
+      end;
+      writeln(t,s);
+    end;
+    }
+
+
+    writeln('STUB: bbs.pas; ErrorHandler()...');
+    writeln(t, '  (No screen dump. Sorry.  --ryan.)');
+
+
+    writeln(t,'*');
+    close(t);
+
+    assign(f,'critical.err'); rewrite(f); close(f); setfattr(f,dos.hidden);
+
+    sprint(#3#8+'*>>'+#3#7+' System error occured at '+date+' '+time+#3#8+' <<*');
+    term_ready(TRUE); remove_port; {removeint(modemr.comport);}
+    writeln('*>> System error '+cstr(exitcode)+' at '+date+' '+time+' <<*');
+
+    if (exiterrors<>-1) then halt(exiterrors) else halt(254);
+    {* CRITICAL ERROR ERRORLEVEL *}
+  end;
+end;
+
+Procedure MenuExec;
+Var
+  Dt    : LDateTimeRec;
+  Cmd,s : String;
+  I     : Integer;
+  Aa,Abort,Next,Done:Boolean;
+Begin
+  If (ExecFirst) then
+  Begin
+    ExecFirst:=FALSE;
+    Cmd:=NewMenuCmd;
+    NewMenuCmd:='';
+  End Else MainMenuHandle(Cmd);
+
+  if ((copy(cmd,1,2)='\\') and (thisuser.sl=255)) then begin
+    domenucommand(done,copy(cmd,3,length(cmd)-2),newmenucmd);
+    if (newmenucmd<>'') then cmd:=newmenucmd else cmd:='';
+  end;
+
+  If (Cmd='|') then
+  Begin
+    nl; sprint(#3#3+verline(1)); sprint(#3#3+verline(2)); nl;
+    pdt2dt(sitedatetime,dt);
+    sprint(#3#3+'Release date: unreleased ');
+    lastcommandgood:=TRUE;
+  end else
+  if ((cmd='=') and (cso)) then showmenucmds
+  else
+  if (cmd<>'') then
+  begin
+    newmenucmd:='';
+    repeat domenuexec(cmd,newmenucmd) until (newmenucmd='');
+  end;
+end;
+
+Var
+  OvrPath,VerType : String;
+  I,RCode         : Integer;
+  NeedToHangup    : Boolean;
+  SyStatF         : File of systatrec;
+Begin
+  exitsave:=exitproc;
+  exitproc:=@errorhandle;
+
+  MaxHeapSpace:=BBSMaxHeapSpace;
+  checksnow:=TRUE; directvideo:=FALSE;
+
+  useron:=FALSE; usernum:=0;
+  getdir(0,start_dir);
+
+  assign(systatf,'status.dat');
+  {$I-} reset(systatf); {$I+}
+  if (ioresult<>0) then
+  begin
+    writeln;
+    writeln('Unable to find STATUS.DAT data file.  This file is absolutely');
+    writeln('*REQUIRED* to even load the BBS.  If you cannot find your');
+    writeln('STATUS.DAT data file, re-create one using the INIT package.');
+    if (exiterrors<>-1) then halt(exiterrors) else halt(254);
+  end else begin
+    {$I-} read(systatf,systat); {$I+}
+    close(systatf);
+  end;
+
+  {rcg11172000 No overlay on Linux.}
+  {
+  ovrinit('bbs.OVR');
+  ovrpath:=fsearch('bbs.OVR',getenv('PATH'));
+  if (ovrresult<>ovrok) then
+  begin
+    clrscr; writeln('Critical error: Overlay manager error.'); halt(1);
+  end;
+  if (systat.useems) then
+  begin
+    ovrinitems; if (ovrresult=ovrok) then overlayinems:=TRUE;
+  end;
+  ovrsetbuf(ovrmaxsize); ovrsetretry(ovrmaxsize div 2);
+  }
+
+  initexecswap2:=initexecswap;
+  execwithswap2:=execwithswap;
+  shutdownexecswap2:=shutdownexecswap;
+
+  findvertypeout(ovrpath,vercs,vertype,vertypes,serialnumber,licenseinfo,sitedatetime);
+  ver:=ver+' '+vertype;
+
+  init;
+
+  if (packbasesonly) then
+  begin
+    wfcmdefine; doshowpackbases; thisuser.ac:=thisuser.ac-[pause]; nl;
+    sprint(#3#5+'Message bases have been packed.');
+    cursoron(TRUE); halt(0);
+  end;
+  mailread:=FALSE; smread:=FALSE;
+
+  needtohangup:=wascriterr;           { hang up if critical error last call! }
+
+  repeat
+    write_msg:=FALSE;
+    sysopon:=not systat.localsec;
+    wantout:=not systat.localscreensec;
+    checksnow:=systat.cgasnow;
+
+    wfcmenus(needtohangup);
+    needtohangup:=FALSE;
+
+    useron:=FALSE; usernum:=0;
+    if (not doneday) then
+    begin
+      if (getuser) then newuser;
+      if (not hangup) then
+      begin
+        macok:=TRUE;
+        if (not hangup) then logon;
+        if (not hangup) then
+        begin
+          with thisuser do
+          begin
+            newdate:=laston;
+            if (not mbaseac(lastmsg)) then lastmsg:=1;
+            if (not fbaseac(lastfil)) then lastfil:=1;
+            board:=lastmsg; fileboard:=lastfil;
+          end;
+          batchtime:=0.0; numbatchfiles:=0; numubatchfiles:=0; hiubatchv:=0;
+          newcomptables;
+
+          menustackptr:=0; for i:=1 to 8 do menustack[i]:='';
+
+          last_menu:=systat.allstartmenu+'.MNU';
+
+          if (not exist(systat.menupath+last_menu)) then
+          begin
+            sysoplog('"'+systat.menupath+last_menu+'" is MISSING.  Loaded "MAIN.MNU" instead.');
+            last_menu:='main.mnu';
+          end;
+          curmenu:=systat.menupath+last_menu; readin;
+
+          if (novice in thisuser.ac) then chelplevel:=2 else chelplevel:=1;
+        end;
+
+        newmenucmd:=''; i:=1;
+        while ((i<=noc) and (newmenucmd='')) do
+        begin
+          if (cmdr[i].ckeys='FIRSTCMD') then
+            if (aacs(cmdr[i].acs)) then newmenucmd:='FIRSTCMD';
+          inc(i);
+        end;
+        execfirst:=(newmenucmd='FIRSTCMD');
+        while (not hangup) do menuexec;    {*** main BBS loop ***}
+      end;
+
+      if (quitafterdone) then
+      begin
+        elevel:=exitnormal; hangup:=TRUE; doneday:=TRUE; needtohangup:=TRUE;
+      end;
+      logoff;
+      if (not doneday) then sl1(#3#3+'Logoff '+#3#5+'['+dat+']');
+
+      if (textrec(sysopf1).mode=fmoutput) then
+      begin
+        {$I-} close(sysopf1); {$I+}
+        if (ioresult<>0) then writeln('Errors closing SLOGxxxx.LOG');
+      end;
+
+      if ((com_carrier) and (not doneday)) then
+        if (spd<>'KB') then needtohangup:=TRUE;
+      if (enddayf) then endday;
+      enddayf:=FALSE;
+    end;
+  until (doneday);
+
+  if (needtohangup) then hangupphone;
+  reset(sysopf); close(sysopf);
+  term_ready(TRUE); remove_port; {removeint(modemr.comport);}
+
+  if (exist('bbsdone.bat')) then shelldos(FALSE,'bbsdone.bat',rcode);
+
+  textcolor(7); clrscr; textcolor(14);
+  WriteLn('[> Exited with ErrorLevel ',elevel,' at '+date+' '+time);
+  halt(elevel);
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bbs.~pa	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,350 @@
+{*****************************************************************************
+ *                             T E L E G A R D - X                           *
+ *                             ===================                           *
+ *                                                                           *
+ * Modification History                                                      *
+ * ====================                                                      *
+ *   08/20/91 - 0.90 - Rls - Original Version.                               *
+ *                     Sad - Original Version.                               *
+ *                                                                           *
+ * NOTE: TeleGard-X originated from TeleGard 2.5i which was originally       *
+ *       written by Eric Oman, and Martin Pollard.                           *
+ *                                                                           *
+ *****************************************************************************}
+{$A+,B+,D-,E+,F+,I+,L-,N-,O+,R-,S+,V-}
+{$M 60000,0,45000}      { Memory Allocation Sizes }
+
+Program TeleGard-X;
+Uses
+  Crt,      Dos,      OverLay,  InitP,    Sysop1,   Sysop2,   Sysop3,
+  Sysop4,   Sysop5,   Sysop6,   Sysop7,   Sysop8,   Sysop9,   Sysop10,
+  Sysop11,  Mail0,    Mail1,    Mail2,    Mail3,    Mail4,    Mail5,
+  Mail6,    Mail9,    File0,    File1,    File2,    File3,    File4,
+  File5,    File6,    File7,    File8,    File9,    File10,   File11,
+  File12,   File13,   File14,   Archive1, Archive2, Archive3, Misc1,
+  Misc2,    Misc3,    Misc4,    MiscX,    CUser,    Doors,    Menus2,
+  Menus3,   Menus4,   MyIO,     Logon1,   Logon2,   NewUsers, WfcMenu,
+  Menus,    FvType,   TimeJunk, TmpCom,   MsgPack,  Common,   Common1,
+  Common2,  Common3,  ExecSwap;        {* MiniTerm, Window2,  NewCom *}
+
+{$O MsgPack   } {$O Common1   } {$O Common2   } {$O Common3   } {$O InitP     }
+{$O WfcMenu   } {$O FvType    } {$O TimeJunk  } {$O Sysop1    } {$O Sysop2    }
+{$O Sysop21   } {$O Sysop2a   } {$O Sysop2b   } {$O Sysop2c   } {$O Sysop2d   }
+{$O Sysop2e   } {$O Sysop2f   } {$O Sysop2fa  } {$O Sysop2g   } {$O Sysop2h   }
+{$O Sysop2i   } {$O Sysop2s   } {$O Sysop2z   } {$O Sysop3    } {$O Sysop4    }
+{$O Sysop5    } {$O Sysop6    } {$O Sysop7    } {$O Sysop7m   } {$O Sysop8    }
+{$O Sysop9    } {$O Sysop10   } {$O Sysop11   } {$O Mail0     } {$O Mail1     }
+{$O Mail2     } {$O Mail3     } {$O Mail4     } {$O Mail5     } {$O Mail6     }
+{$O Mail9     } {$O File0     } {$O File1     } {$O File2     } {$O File3     }
+{$O File4     } {$O File5     } {$O File6     } {$O File7     } {$O File8     }
+{$O File9     } {$O File10    } {$O File11    } {$O File12    } {$O File13    }
+{$O File14    } {$O Archive1  } {$O Archive2  } {$O Archive3  } {$O Logon1    }
+{$O Logon2    } {$O NewUsers  } {$O Misc1     } {$O Misc2     } {$O Misc3     }
+{$O Misc4     } {$O MiscX     } {$O CUser     } {$O Doors     } {$O ExecBat   }
+{$O MyIO      } {$O Menus2    } {$O Menus3    } {$O Menus4    }
+
+Const
+  OvrMaxSize      = 60000;
+  BBSMaxHeapSpace = 40000;
+
+{$I LcBbs.Pas}
+
+Var
+  ExitSave  : Pointer;
+  ExecFirst : Boolean;
+  NewMenuCmd: String;
+
+Procedure ErrorHandle;
+{*****************************************************************************
+ * Note: if error occurs IN THIS PROCEDURE,                                  *
+ * it is NOT executed again!  That way an infinite loop is *avoided*....     *
+ *****************************************************************************}
+Var
+  T:Text;
+  F:File;
+  S:String[80];
+  VidSeg:Word;
+  X,Y:Integer;
+  C:Char;
+Begin
+  ExitProc:=ExitSave;
+  If (ErrorAddr<>Nil) then
+  Begin
+    chdir(start_dir);
+    if (textrec(sysopf).mode=fmoutput) then
+    begin
+      writeln(sysopf,#3#8+'*>>'+#3#7+' Runtime error '+cstr(exitcode)+
+              ' at '+date+' '+time+#3#8+' <<*'+#3#5+
+              ' (Check ERR.LOG in main BBS dir)');
+      flush(sysopf); close(sysopf);
+    end;
+    if (textrec(trapfile).mode=fmoutput) then
+    begin
+      writeln(trapfile,'*>> Runtime error '+cstr(exitcode)+' at '+date+' '+
+              time+' <<*');
+      flush(trapfile); close(trapfile);
+    end;
+
+    assign(t,'err.log');
+    {$I-} append(t); {$I+}
+    if (ioresult<>0) then
+    begin
+      rewrite(t);
+      append(t);
+      writeln(t,'様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様');
+      writeln(t,'Critical Error Log file - Contains screen images at instant of Error.');
+      writeln(t,'The "" character shows the cursor position at time of error.');
+      writeln(t,'Note: You may periodically delete this file with no harm to the system,');
+      writeln(t,'but note the following information:');
+      writeln(t,'陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳');
+{*****
+      writeln(t,'Please notify Eric Oman that you have encountered a Critical Error.');
+      writeln(t,'You will need to send this file to him, along with a short message');
+      writeln(t,'stating - briefly - what events led up to the Critical Error, and whether');
+      writeln(t,'or not the error was repeatable, and under what circumstances.');
+      writeln(t);
+      writeln(t,'Eric can be reached at:  * The Pointe BBS       313-885-1779');
+      writeln(t,'                           Electric Eye ][ BBS  313-776-8928');
+      writeln(t,'                           The Ozone BBS        313-689-2876');
+      writeln(t,'( * -- Best chance )       Warp Speed BBS       313-544-0405');
+ *****}
+      writeln(t,'様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様');
+      writeln(t);
+    end;
+    writeln(t);
+    if (serialnumber<>0) then
+      s:=' ('+cstr(serialnumber)+vercs+')'
+    else
+      s:='';
+    writeln(t,'> RT #'+cstr(exitcode)+' at '+date+' '+time+'  BBS-Ver: '+ver+s);
+    if (useron) then begin
+      if (spd<>'KB') then s:='at '+spd+' baud' else s:='Locally';
+      writeln(t,'> User "'+allcaps(thisuser.name)+' #'+cstr(usernum)+
+              '" was on '+s);
+    end;
+    writeln(t,' <- Screen Image: -> ');
+    if (mem[$0000:$0449]=7) then vidseg:=$B000 else vidseg:=$B800;
+    for y:=1 to 25 do
+    begin
+      s:='';
+      for x:=1 to 80 do
+      begin
+        c:=chr(mem[vidseg:(160*(y-1)+2*(x-1))]);
+        if (c=#0) then c:=#32;
+        if ((x=wherex) and (y=wherey)) then c:=#178;
+        if ((x<>80) or ((x=80) and (c<>#32))) then s:=s+c;
+      end;
+      writeln(t,s);
+    end;
+    writeln(t,'*');
+    close(t);
+
+    assign(f,'critical.err'); rewrite(f); close(f); setfattr(f,dos.hidden);
+
+    sprint(#3#8+'*>>'+#3#7+' System error occured at '+date+' '+time+#3#8+' <<*');
+    term_ready(TRUE); remove_port; {removeint(modemr.comport);}
+    writeln('*>> System error '+cstr(exitcode)+' at '+date+' '+time+' <<*');
+
+    if (exiterrors<>-1) then halt(exiterrors) else halt(254);
+    {* CRITICAL ERROR ERRORLEVEL *}
+  end;
+end;
+
+Procedure MenuExec;
+Var
+  Dt    : LDateTimeRec;
+  Cmd,s : String;
+  I     : Integer;
+  Aa,Abort,Next,Done:Boolean;
+Begin
+  If (ExecFirst) then
+  Begin
+    ExecFirst:=FALSE;
+    Cmd:=NewMenuCmd;
+    NewMenuCmd:='';
+  End Else MainMenuHandle(Cmd);
+
+  if ((copy(cmd,1,2)='\\') and (thisuser.sl=255)) then begin
+    domenucommand(done,copy(cmd,3,length(cmd)-2),newmenucmd);
+    if (newmenucmd<>'') then cmd:=newmenucmd else cmd:='';
+  end;
+
+  If (Cmd='|') then
+  Begin
+    nl; sprint(#3#3+verline(1)); sprint(#3#3+verline(2)); nl;
+    pdt2dt(sitedatetime,dt);
+    sprint(#3#3+'Release date: '+#3#5+tch(cstr(dt.month))+'/'+
+           tch(cstr(dt.day))+'/'+cstr(dt.year)+' '+tch(cstr(dt.hour))+':'+
+           tch(cstr(dt.min))+':'+tch(cstr(dt.sec))+'.'+tch(cstr(dt.sec100)));
+    If (LicenseInfo<>'') then
+    Begin
+      nl; sprint(#3#3+'This version is licensed to:'); cl(5); prompt('  ');
+      aa:=allowabort; allowabort:=FALSE; abort:=FALSE; next:=FALSE;
+      s:=licenseinfo;
+      while (s<>'') do
+        if (pos(^J,s)<>0) then
+        begin
+          printa1(copy(s,1,pos(^J,s)-1),abort,next);
+          s:=copy(s,pos(^J,s)+1,length(s)-pos(^J,s));
+          nl; prompt('  '); cl(5);
+        end else
+        begin
+          printa1(s,abort,next); s:=''; nl;
+        end;
+      allowabort:=aa;
+    end;
+    lastcommandgood:=TRUE;
+  end else
+  if ((cmd='=') and (cso)) then showmenucmds
+  else
+  if (cmd<>'') then
+  begin
+    newmenucmd:='';
+    repeat domenuexec(cmd,newmenucmd) until (newmenucmd='');
+  end;
+end;
+
+Var
+  OvrPath,VerType : String;
+  I,RCode         : Integer;
+  NeedToHangup    : Boolean;
+  SyStatF         : File of systatrec;
+Begin
+  exitsave:=exitproc;
+  exitproc:=@errorhandle;
+
+  MaxHeapSpace:=BBSMaxHeapSpace;
+  checksnow:=TRUE; directvideo:=FALSE;
+
+  useron:=FALSE; usernum:=0;
+  getdir(0,start_dir);
+
+  assign(systatf,'status.dat');
+  {$I-} reset(systatf); {$I+}
+  if (ioresult<>0) then
+  begin
+    writeln;
+    writeln('Unable to find STATUS.DAT data file.  This file is absolutely');
+    writeln('*REQUIRED* to even load the BBS.  If you cannot find your');
+    writeln('STATUS.DAT data file, re-create one using the INIT package.');
+    if (exiterrors<>-1) then halt(exiterrors) else halt(254);
+  end else begin
+    {$I-} read(systatf,systat); {$I+}
+    close(systatf);
+  end;
+
+  ovrinit('BBS.OVR');
+  ovrpath:=fsearch('BBS.OVR',getenv('PATH'));
+  if (ovrresult<>ovrok) then
+  begin
+    clrscr; writeln('Critical error: Overlay manager error.'); halt(1);
+  end;
+  if (systat.useems) then
+  begin
+    ovrinitems; if (ovrresult=ovrok) then overlayinems:=TRUE;
+  end;
+  ovrsetbuf(ovrmaxsize); ovrsetretry(ovrmaxsize div 2);
+
+  initexecswap2:=initexecswap;
+  execwithswap2:=execwithswap;
+  shutdownexecswap2:=shutdownexecswap;
+
+  findvertypeout(ovrpath,vercs,vertype,vertypes,serialnumber,licenseinfo,sitedatetime);
+  ver:=ver+' '+vertype;
+
+  init;
+
+  if (packbasesonly) then
+  begin
+    wfcmdefine; doshowpackbases; thisuser.ac:=thisuser.ac-[pause]; nl;
+    sprint(#3#5+'Message bases have been packed.');
+    cursoron(TRUE); halt(0);
+  end;
+  mailread:=FALSE; smread:=FALSE;
+
+  needtohangup:=wascriterr;           { hang up if critical error last call! }
+
+  repeat
+    write_msg:=FALSE;
+    sysopon:=not systat.localsec;
+    wantout:=not systat.localscreensec;
+    checksnow:=systat.cgasnow;
+
+    wfcmenus(needtohangup);
+    needtohangup:=FALSE;
+
+    useron:=FALSE; usernum:=0;
+    if (not doneday) then
+    begin
+      if (getuser) then newuser;
+      if (not hangup) then
+      begin
+        macok:=TRUE;
+        if (not hangup) then logon;
+        if (not hangup) then
+        begin
+          with thisuser do
+          begin
+            newdate:=laston;
+            if (not mbaseac(lastmsg)) then lastmsg:=1;
+            if (not fbaseac(lastfil)) then lastfil:=1;
+            board:=lastmsg; fileboard:=lastfil;
+          end;
+          batchtime:=0.0; numbatchfiles:=0; numubatchfiles:=0; hiubatchv:=0;
+          newcomptables;
+
+          menustackptr:=0; for i:=1 to 8 do menustack[i]:='';
+
+          last_menu:=systat.allstartmenu+'.MNU';
+
+          if (not exist(systat.menupath+last_menu)) then
+          begin
+            sysoplog('"'+systat.menupath+last_menu+'" is MISSING.  Loaded "MAIN.MNU" instead.');
+            last_menu:='main.mnu';
+          end;
+          curmenu:=systat.menupath+last_menu; readin;
+
+          if (novice in thisuser.ac) then chelplevel:=2 else chelplevel:=1;
+        end;
+
+        newmenucmd:=''; i:=1;
+        while ((i<=noc) and (newmenucmd='')) do
+        begin
+          if (cmdr[i].ckeys='FIRSTCMD') then
+            if (aacs(cmdr[i].acs)) then newmenucmd:='FIRSTCMD';
+          inc(i);
+        end;
+        execfirst:=(newmenucmd='FIRSTCMD');
+        while (not hangup) do menuexec;    {*** main BBS loop ***}
+      end;
+
+      if (quitafterdone) then
+      begin
+        elevel:=exitnormal; hangup:=TRUE; doneday:=TRUE; needtohangup:=TRUE;
+      end;
+      logoff;
+      if (not doneday) then sl1(#3#3+'Logoff '+#3#5+'['+dat+']');
+
+      if (textrec(sysopf1).mode=fmoutput) then
+      begin
+        {$I-} close(sysopf1); {$I+}
+        if (ioresult<>0) then writeln('Errors closing SLOGxxxx.LOG');
+      end;
+
+      if ((com_carrier) and (not doneday)) then
+        if (spd<>'KB') then needtohangup:=TRUE;
+      if (enddayf) then endday;
+      enddayf:=FALSE;
+    end;
+  until (doneday);
+
+  if (needtohangup) then hangupphone;
+  reset(sysopf); close(sysopf);
+  term_ready(TRUE); remove_port; {removeint(modemr.comport);}
+
+  if (exist('bbsdone.bat')) then shelldos(FALSE,'bbsdone.bat',rcode);
+
+  textcolor(7); clrscr; textcolor(14);
+  WriteLn('[> TeleGard-X - Exited with ErrorLevel ',elevel,' at '+date+' '+time);
+  halt(elevel);
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/boarde.msg	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,25 @@
+様僕様様様様様様曜様僕様様様様曜様僕様様様様様様様様様様様様様様様様様様様=
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/boarder.msg	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,1 @@
+==:==============:==:==========:==:========================================
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brec17a2.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,233 @@
+
+(***** BETA CONVERSION RECORDS *****)
+
+  ulrec17a2=                          { UPLOADS.DAT : File base records }
+    record
+      name:string[40];               { area description  }
+      filename:string[12];            { filename + ".DIR" }
+      dlpath,                         { download path     }
+  ulpath:string[40];              { upload path       }
+      namesl:byte;                    { req SL to see who ULed }
+      maxfiles:integer;               { max files allowed }
+      password:string[20];            { password required }
+      arctype,                        { wanted archive type (1..maxarcs,0=inactive) }
+      cmttype:byte;                   { wanted comment type (1..3,0=inactive) }
+  fbdepth:integer;                { file base dir depth }
+  fbstat:set of fbflags;          { file base status vars }
+  acs:acstring;                   { access requirements }
+  {}sl:byte;                        { SL required       }
+  {}dsl:byte;                       { DSL required      }
+  {}ar:acrq;                        { AR flag required  }
+  {}agereq:byte;                    { age required      }
+      res:array[1..6] of byte;        { RESERVED }
+    end;
+
+  systatrec17a4=
+    record
+      bbsname:string[40];             {BBS's name                     }
+      bbsphone:string[12];            {BBS's phone #                  }
+      sysopfirst:string[12];          {SysOp's 1st name               }
+      sysoplast:string[16];           {SysOp's 2nd name               }
+      boardpw:string[20];             {newuser PW (if active)         }
+      sysoppw:string[20];             {SysOp PW                       }
+      bbspw:string[20];               {board PW (if matrix)           }
+      closedsystem:boolean;           {if no new users accepted       }
+      matrix:boolean;                 {if Shuttle Logon active        }
+      alias:boolean;                  {if allow alias's               }
+      clearmsg:boolean;               {if clear scr. before msg       }
+      fone:boolean;                   {if ph# PW's active             }
+      multitask:boolean;              {if BBS is multitasking         }
+      bwindow:boolean;                {if large window active         }
+      lock300:boolean;                {if lockout 300 baud            }
+      wantquote:boolean;              {///                            }
+      mcimsg:boolean;                 {///                            }
+      special:boolean;                {WFC menu special effects       }
+      localsec:boolean;               {if local security on           }
+      localscreensec:boolean;         {whether local screen security  }
+      autominlogon:boolean;           {if automessage in logon        }
+      bullinlogon:boolean;            {if bulletins in logon          }
+      lcallinlogon:boolean;           {if last caller list in logon   }
+      autochatopen:boolean;           {if chat buffer auto-open       }
+      yourinfoinlogon:boolean;        {whether yourinfo in logon      }
+      globaltrap:boolean;             {if trap all users activity     }
+      snowchecking:boolean;           {whether snow checking on       }
+      forcevoting:boolean;            {manditory voting during logon  }
+      offhooklocallogon:boolean;{take phone off hook when logon locally }
+
+      hmsg:messages;                  {highest msg counter    }
+      tfiledate:string[8];            {last Tfiles date       }
+      lastdate:string[8];             {/// }
+
+      callernum:longint;              {# of callers           }
+      users:integer;                  {# of users             }
+      activetoday:integer;            {TODAY's time-on count  }
+      callstoday:integer;             {TODAY's caller count   }
+      msgposttoday:integer;           {TODAY's post count     }
+      emailtoday:integer;             {TODAY's email count    }
+      fbacktoday:integer;             {TODAY's feedback count }
+      uptoday:integer;                {TODAY's upload count   }
+      newuk:integer;                  {TODAY's upload K count }
+      newusertoday:integer;           {TODAY's new user count }
+      dntoday:integer;                {TODAY's download count }
+      newdk:integer;                  {TODAY's download K count }
+
+      gfilepath:string[79];           {GFILES path }
+      pmsgpath:string[79];            {Private mail path }
+      menupath:string[79];            {MENUS path  }
+      tfilepath:string[79];           {TFILES path }
+      afilepath:string[79];           {alternate text files path }
+      trappath:string[79];            {user audit trap path }
+      temppath:string[79];            {"temp" directory path }
+
+      lowtime,hitime:integer;         {SysOp hours }
+      dllowtime,dlhitime:integer;     {download hours }
+      b300lowtime,b300hitime:integer; {300 baud hours }
+      b300dllowtime,b300dlhitime:integer; {300 baud DL hours }
+
+      app:integer;                    {user num to send new user application to }
+      guestuser:integer;              {user num of guest user }
+      timeoutbell:integer;            {mins before timeout bell }
+      timeout:integer;                {mins before timeout   }
+
+      sysopcolor,usercolor:byte;      {colors in chat mode   }
+      bsdelay:byte;                   {backspacing delay     }
+      tosysopdir:byte;                {"To SysOp" file dir   }
+
+      comport:byte;                   {comport #    }
+      maxbaud:word;                   {max baud     }
+      init:string[40];                {init string  }
+      hangup:string[40];              {hangup string }
+      offhook:string[40];             {phone off hook string }
+      answer:string[40];              {answer string }
+
+      resultcode:array[1..2,0..4] of integer; {**-Result codes-** }
+      nocarrier:integer;              {no carrier result code }
+      nodialtone:integer;             {no dialtone result code }
+      busy:integer;                   {busy result code }
+      nocallinittime:integer;         {reinit modem after x mins of inactivity }
+      tries:byte;                     {tries allowed for PW's }
+
+      newsl,newdsl:byte;              {new-       }
+      newar:set of acrq;              {user       }
+      newac:set of uflags;            {automatic  }
+      newfp:integer;                  {settings   }
+
+      autosl,autodsl:byte;            {auto-      }
+      autoar:set of acrq;             {validation }
+      autoac:set of uflags;           {settings   }
+
+      ansiq:string[80];               {"do you want ANSI" string }
+      engage:string[79];              {engage chat string   }
+      endchat:string[79];             {end chat string      }
+      sysopin:string[79];             {if in sysop hours    }
+      sysopout:string[79];            {if outside sysop hours }
+      note:array[1..2] of string[79]; {logon notes (L 1-2)  }
+      lprompt:string[40];             {logon prompt (L 3)   }
+      wait:string[79];                {sysop working string }
+      pause:string[79];               {pause string         }
+      msg1:string[79];                {enter msg line 1     }
+      msg2:string[79];                {enter msg line 2     }
+      new1:string[79];                {newscan begin string }
+      new2:string[79];                {newscan done string  }
+      read:string[79];                {Msg (S)can prompt    }
+      auto1:string[79];               {auto msg title       }
+      autom,                          {auto msg borders     }
+      echoc:char;                     {echo char for PWs    }
+
+      uldlratio,                      {if UL/DL ratios on }
+      fileptratio:boolean;            {if file pt ratios on }
+      fileptcomp,                     {file pt compensation ratio }
+      fileptcompbasesize:byte;        {file pt base compensation size }
+
+      timeallow,                      {time allowance       }
+      callallow,                      {call allowance       }
+      dlratio,                        {# DLs ratios         }
+      dlkratio,                       {DL k ratios          }
+      postratio:secrange;             {post ratios          }
+
+      normpubpost,anonpubpost,anonpubread, {public mail SLs }
+      normprivpost,anonprivpost,anonprivread, {email SLs }
+      maxpubpost,maxprivpost,         {max post/email per call }
+      maxfback,maxchat,               {max feedback/pages per call }
+      maxwaiting,csmaxwaiting,        {max mail waiting, normal/CS }
+      maxlines,csmaxlines:byte;       {max lines in msg, normal/CS }
+
+      sop,csop,                       {SysOp SL / CoSysOp SL   }
+      msop,fsop,             {Message SysOp SL / File SysOp SL }
+      spw,                            {SysOp PW at logon       }
+      seepw,                          {see SysOp PWs remotely  }
+      nodlratio,                      {no DL ratio checking    }
+      nopostratio,                    {no post ratio checking  }
+      nofilepts,                      {no file pts checking SL }
+      seeunval,                       {see unvalidated files SL }
+      dlunval,                        {download unval. files SL }
+      ulrefund:byte;                  {% time refund for ULs   }
+
+      eventwarningtime:integer;       {time before event warning }
+      filearccomment:array[1..3] of string[80]; {BBS comment for ARC file }
+      filearcinfo:array[1..6] of filearcinforec; {ARC specs}
+
+      minspaceforpost,                {minimum K req'd for a post}
+      minspaceforupload:integer;      {minimum K req'd for an upload}
+postcredits:integer; {file points/upload credit compensation for posts}
+ulvalreq:byte; {uploads require validation override SL}
+
+mmmmm:array[1..31] of byte;
+
+      backsysoplogs:byte;               {# back-days to keep SYSOP##.LOG}
+      compressbases:boolean;            {whether to "compress" file/msg bases}
+      remdevice:string[10];             {remote output device }
+      userbaud:array[0..4] of integer;  {user baud rates ... }
+      criterr:integer;                  {# critical errors occured today }
+
+      searchdup:boolean;                {search for dup. filenames when UL?}
+      istopwindow:boolean;              {put SysOp window on top of screen?}
+
+      arq9600rate:word;            {baud rate to USE when 9600 ARQ result code}
+      allstartmenu:string[8];           {menu to start ALL users out on}
+  wfcblanktime:byte;                {minutes after which to blank WFC menu}
+  validateallfiles:boolean;         {validate all files automatically?}
+  maxintemp:integer;                {max k-bytes allowed in TEMP\3\}
+  slogtype:byte;                    {output SysOp log to printer?}
+  stripclog:boolean;                {strip color from SysOp log output?}
+  noforcerate:boolean;              {whether to force baud rate}
+  rebootforevent:boolean;           {reboot before events?}
+  minresume:integer;                {minimum k-bytes to allow save for resume}
+
+      res:array[1..123] of byte;        {***-> reserved <-***}
+    end;
+
+  boardrec17a5=                       { BOARDS.DAT : Message base records }
+    record
+      name:string[40];                { message base description }
+      filename:string[12];            { *.BRD data filename }
+      msgpath:string[40];             { messages pathname   }
+      acs,                            { access requirement }
+      postacs,                        { post access requirement }
+      mciacs:acstring;                { MCI usage requirement }
+      maxmsgs:byte;                   { max message count }
+      anonymous:anontyp;              { anonymous type }
+      password:string[20];            { base password }
+      mbstat:set of mbflags;          { message base status vars }
+      permindx:longint;               { permanent index # }
+{*}mbdepth:integer;                { message base dir depth }
+      res:array[1..4] of byte;        { RESERVED }
+    end;
+
+  modemrec17a7=
+    record
+      waitbaud:word;                  { wait baud }
+      comport:byte;                   { comport number }
+      init:string[80];                { initialization string }
+      answer:string[40];              { answer string }
+      hangup:string[40];              { hangup string }
+      offhook:string[40];             { phone off-hook string }
+      nocallinittime:integer;       { reinit modem after x mins of inactivity }
+      arq9600rate:word;          { baud rate to USE when 9600 ARQ result code }
+      noforcerate:boolean;            { whether to force baud rate}
+      nocarrier:integer;              { no carrier result code }
+      nodialtone:integer;             { no dialtone result code }
+      busy:integer;                   { busy result code }
+      resultcode:array[1..2,0..4] of integer; {**-Result codes-** }
+    end;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c.bat	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,2 @@
+c:\tp\tpc /$G+ /B /ic:\t\ /uc:\t\ /uc:\tp /m /l bbs.pas %2 %3 %4 %5 %6
+
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c.~ba	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,2 @@
+c:\tp\tpc /$G+ /ic:\t\ /uc:\t\ /uc:\tp /m /l bbs.pas %2 %3 %4 %5 %6
+
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbbs.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,110 @@
+uses dos;
+
+var f:text;
+
+function tch(i:string):string;
+begin
+  if length(i)>2 then i:=copy(i,length(i)-1,2) else
+    if length(i)=1 then i:='0'+i;
+  tch:=i;
+end;
+
+function cstr(i:integer):string;
+var c:string;
+begin
+  str(i,c);
+  cstr:=c;
+end;
+
+function value(s:string):integer;
+var n,n1:integer;
+begin
+  val(s,n,n1);
+  if n1<>0 then begin
+    s:=copy(s,1,n1-1);
+    val(s,n,n1)
+  end;
+  value:=n;
+  if s='' then value:=0;
+end;
+
+function time:string;
+var r:registers;
+    h,m,s:string[4];
+begin
+  r.ax:=$2c00; intr($21,dos.registers(r));
+  str(r.cx shr 8,h); str(r.cx mod 256,m); str(r.dx shr 8,s);
+  time:=tch(h)+':'+tch(m)+':'+tch(s);
+end;
+
+function date:string;
+var r:registers;
+    m,d,y:string[4];
+begin
+  r.ax:=$2a00; msdos(dos.registers(r)); str(r.cx,y); str(r.dx mod 256,d);
+  str(r.dx shr 8,m);
+  date:=tch(m)+'/'+tch(d)+'/'+tch(y);
+end;
+
+function leapyear(yr:integer):boolean;
+begin
+  leapyear:=(yr mod 4=0) and ((yr mod 100<>0) or (yr mod 400=0));
+end;
+
+function days(mo,yr:integer):integer;
+var d:integer;
+begin
+  d:=value(copy('312831303130313130313031',1+(mo-1)*2,2));
+  if (mo=2) and leapyear(yr) then d:=d+1;
+  days:=d;
+end;
+
+function daycount(mo,yr:integer):integer;
+var m,t:integer;
+begin
+  t:=0;
+  for m:=1 to (mo-1) do t:=t+days(m,yr);
+  daycount:=t;
+end;
+
+function daynum(dt:string):integer;
+var d,m,y,t,c:integer;
+begin
+  t:=0;
+  m:=value(copy(dt,1,2));
+  d:=value(copy(dt,4,2));
+  y:=value(copy(dt,7,2))+1900;
+  for c:=1985 to y-1 do
+    if leapyear(c) then t:=t+366 else t:=t+365;
+  t:=t+daycount(m,y)+(d-1);
+  daynum:=t;
+  if y<1985 then daynum:=0;
+end;
+
+function dat:string;
+const mon:array [1..12] of string[3] =
+          ('Jan','Feb','Mar','Apr','May','Jun',
+           'Jul','Aug','Sep','Oct','Nov','Dec');
+var ap,x,y:string;
+    i:integer;
+begin
+  case daynum(date) mod 7 of
+    6:x:='Mon';    3:x:='Fri';
+    0:x:='Tue';    4:x:='Sat';
+    1:x:='Wed';    5:x:='Sun';
+    2:x:='Thu';
+  end;
+  y:=mon[value(copy(date,1,2))];
+  x:=x+' '+y+' '+copy(date,4,2)+', '+cstr(1900+value(copy(date,7,2)));
+  y:=time; i:=value(copy(y,1,2));
+  if i>11 then ap:='pm' else ap:='am';
+  if i>12 then i:=i-12;
+  if i=0 then i:=12;
+  dat:=cstr(i)+copy(y,3,3)+' '+ap+'  '+x;
+end;
+
+begin
+  assign(f,paramstr(1)); rewrite(f);
+  writeln(f,'lastcompiled=''Last official compilation date:  < '+dat+' >'';');
+  close(f);
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cc.bat	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,14 @@
+echo off
+c:
+cd \tp\telegard
+del *.bak
+ds en
+echo 
+type baa2.ans
+echo 
+cecho $07 "C:\T> " $0b "\com\tp\tpc /m /l " $09 "bbs.pas" $0b " /DAlpha"
+cbbs lcbbs.pas
+c:\com\tp\tpc /m /l bbs.pas /DAlpha /uc:\com\tp
+mabs1
+rem mabs 2 mylicens.dat 1
+echo 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/change.me	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,168 @@
+File CONV17A.PAS:
+  write('Telegard Conversion for '+ver1+' ^P^P '+ver);
+  writeln('This program is provided to add/modify/create files used by Telegard to');
+    write('Thank you for choosing Telegard!');
+File CONV17A9.PAS:
+  write(' Telegard Conversion for '+ver1+' ^P^P '+ver);
+  writeln('This program is provided to add/modify/create files used by Telegard to');
+    write('Thank you for choosing Telegard!');
+File CONV18A.PAS:
+  write(' Telegard Conversion for '+ver1+' ^P^P '+ver);
+  writeln('This program is provided to add/modify/create files used by Telegard to');
+    write('Thank you for choosing Telegard!');
+File FILE5.PAS:
+    print('Telegard(R) Mini-DOS(R)  Version '+ver);
+    print('            (C)Copyright 1988,89,90 The Telegard Team');
+        print('Licensed for internal usage in Telegard v'+ver);
+        print(s+' - Telegard archive conversion command.');
+        print('Telegard will convert from the one archive format to the other.');
+        print(s+' - Telegard archive de-compression command.');
+        print('configured into Telegard via System Configuration.');
+        print(s+' - Telegard archive compression command.');
+        print('configured into Telegard via System Configuration.');
+  print('Type "EXIT" to return to Telegard.');
+File INIT.PAS:
+(*>  Telegard Bulletin Board System - Copyright 1988,89,90 by               <*)
+    bbsname:='Telegard BBS';
+                       {* A-32767.1 is the "Greetings from Telegard" message *}
+    note[1]:='Enter your Telegard NAME or USER NUMBER';
+    waiting:=1;         {* A-32767.1 -- "Greetings from Telegard" message *}
+    title:='Greetings, new Telegard SysOp!!';
+      as:='The Telegard Team';
+      real:='The Telegard Team';
+      alias:='The Telegard Team';
+    name:='The Telegard Team';
+    citystate:='Telegard Development HQ, MI';
+    msg:='Telegard system initialized on '+date+' at '+time+'.';
+  ttl('Creating Telegard directory paths');
+  ttl('Creating Telegard data files');
+  write('Telegard v'+ver+' Initialization Utility - Copyright 1988,89,90 by');
+    writeln('Telegard has already been initialized!');
+  writeln('that will be used by Telegard.  Each directory will be created');
+  writeln('GFILES pathname.  This is the directory where the Telegard data');
+  writeln('files and miscellaneous Telegard text files will be located.');
+  writeln('files (*.BRD, *.MIX, *.TRE) used by Telegard for both private');
+  writeln('MENUS pathname.  This is the directory where the Telegard menu');
+  writeln('TFILES pathname.  This is the directory where the Telegard');
+  writeln('AFILES pathname.  This is the directory where the Telegard');
+  writeln('TRAP pathname.  This is the directory where Telegard will');
+  writeln('TEMP pathname.  Telegard uses this directory to convert between');
+  writeln('SWAP pathname.  This is the directory where Telegard''s swap');
+  star('Telegard BBS installed and initialized successfully!');
+  star('Thanks for trying Telegard!');
+File INIT16D3.PAS:
+    bbsname:='Telegard BBS';
+                       {* A-32767.1 is the "Greetings from Telegard" message *}
+    note[1]:='Enter your Telegard NAME or USER NUMBER';
+    waiting:=1;         {* A-32767.1 -- "Greetings from Telegard" message *}
+    title:='Greetings from Telegard';
+    msg:='Telegard files initialized on '+date+' '+time+'.';
+  ttl('Creating Telegard directory paths');
+  ttl('Creating Telegard data files');
+  clreol; write(' Initialization Utility for Telegard version '+ver);
+    writeln('Telegard has already been initialized!');
+  writeln('that will be used by Telegard.  Each directory will be created');
+  writeln('GFILES pathname.  This is the directory where the Telegard data');
+  writeln('files and miscellaneous Telegard text files will be located.');
+  writeln('MSGS pathname.  This is the directory where the Telegard message');
+  writeln('MENUS pathname.  This is the directory where the Telegard menu');
+  writeln('TFILES pathname.  This is the directory where the Telegard');
+  star('Telegard BBS installed and initialized successfully!');
+  star('Thanks for trying Telegard!');
+File INIT16E1.PAS:
+    bbsname:='Telegard BBS';
+                       {* A-32767.1 is the "Greetings from Telegard" message *}
+    note[1]:='Enter your Telegard NAME or USER NUMBER';
+    waiting:=1;         {* A-32767.1 -- "Greetings from Telegard" message *}
+    title:='Greetings from Telegard';
+    description:='A NEW Telegard Event';
+    msg:='Telegard files initialized on '+date+' '+time+'.';
+  ttl('Creating Telegard directory paths');
+  ttl('Creating Telegard data files');
+  clreol; write(' Initialization Utility for Telegard version '+ver);
+    writeln('Telegard has already been initialized!');
+  writeln('that will be used by Telegard.  Each directory will be created');
+  writeln('GFILES pathname.  This is the directory where the Telegard data');
+  writeln('files and miscellaneous Telegard text files will be located.');
+  writeln('directory paths used by Telegard, including private mail (EMAIL).');
+  writeln('Located in these paths are the text of the Telegard messages.');
+  writeln('MENUS pathname.  This is the directory where the Telegard menu');
+  writeln('TFILES pathname.  This is the directory where the Telegard');
+  writeln('AFILES pathname.  This is the directory where the Telegard');
+  writeln('TRAP pathname.  This is the directory where Telegard will');
+  writeln('TEMP pathname.  Telegard uses this directory to convert between');
+  star('Telegard BBS installed and initialized successfully!');
+  star('Thanks for trying Telegard!');
+File INITP.PAS:
+    description:='Telegard Nightly Events';
+      description:='A NEW Telegard Event';
+File MAIL1.PAS:
+        s:=#3+cstr(tear_color)+'--- Telegard v'+ver;
+File MINITERM.PAS:
+(*>  MINITERM.PAS - Telegard Communications Program                         <*)
+    wcenter('Telegard MiniTerm - Version '+ver,15,2);
+File MISC1.PAS:
+  sprint('^5Telegard Time Bank v'+ver);
+File MISCX.PAS:
+    sl1('\  Telegard SysOp Log for '+date+':  /');
+      writeln(sysopf1,'>> Telegard SysOp Log for '+nam+': <<');
+File MMODEM.PAS:
+        cwriteat(2,25,'Telegard:'+#3#14);
+File SEPMSGS.PAS:
+  star('Each message base in Telegard can now occupy its own, seperate directory');
+  star('Message directories will be created off of your current Telegard MSGS\');
+File SYSOP2A.PAS:
+(*>  Telegard Bulletin Board System - Copyright 1988,89,90 by               <*)
+              print('This is the baud rate that Telegard will use when waiting for calls');
+              print('This is the baud rate Telegard will USE between Telegard and your');
+              print('These are communications flags used by Telegard.');
+File T2T.PAS:
+  backtotag:boolean;  { CONVERTING TO TELEGARD .. }
+        ttl('Converting "NAMES.LST" to Telegard format');
+        ttl('Converting "USER.LST" to Telegard format');
+        ttl('Converting "BOARDS.DAT" to Telegard format');
+        ttl('Converting "FBOARDS.DAT" to Telegard format ("UPLOADS.DAT")');
+        ttl('Converting "VOTING.DAT" to Telegard format.');
+  write(' Conversion for TAG '+tag_ver+' ^Q-^P Telegard '+s_ver);
+  writeln('TAG '+tag_ver+' to the proper formats used by Telegard '+s_ver+'.');
+  writeln('It may ALSO be used to convert from Telegard format to TAG.');
+  writeln('   TAG '+tag_ver+'                Telegard '+s_ver);
+  writeln('   already in the correct Telegard '+s_ver+' format.');
+    writeln('1. From TAG to Telegard format');
+    writeln('2. From Telegard to TAG format');
+      writeln('such files are here, and will be used to create the Telegard');
+      writeln('equivalents in your Telegard paths.');
+      textcolor(15); writeln('Enter your Telegard MAIN BBS pathname.');
+      writeln('This step is involved to ensure you have a version of Telegard');
+      textcolor(9); write('Telegard Path: '); infield(tgpath,40);
+      textcolor(15); writeln('Enter your Telegard MAIN BBS pathname.');
+      writeln('The Telegard file STATUS.DAT should exist in this directory.');
+      textcolor(9); write('Telegard Path: '); infield(tgpath,40);
+      else writeln('TO TELEGARD FORMAT');
+    textcolor(9); write('Telegard Path: '); textcolor(15); writeln(tgpath);
+    writeln('Now you need to enter your Telegard MSGS directory, where you');
+    textcolor(9); write('Telegard MSGS Path: '); infield(tmsgpath,40);
+        writeln('Convert Telegard '+s_ver+' ^P^P TAG '+tag_ver)
+        writeln('Convert TAG '+tag_ver+' ^P^P Telegard '+s_ver);
+        writeln('If Telegard data files are not in version '+s_ver+' format,')
+    if (not backtotag) then write('Thank you for choosing Telegard!')
+                       else write('Well, thanks for TRYING Telegard!');
+File TA2Z.PAS:
+  textcolor(15); write('CONVERSION UTILITY for Telegard '+ver+': ');
+  writeln('your Telegard v'+ver+' BBS to the newer .ZIP format.  PKZIP.EXE');
+  elog('Telegard v'+ver+' ARC ---> ZIP file conversion utility');
+  write('Thank you for choosing Telegard!');
+File TMU.PAS:
+program TelegardMasterUtility;
+                   #3#14+'for Telegard '+
+File SYSOP6.PAS:
+        description:='A NEW Telegard Event';
+File SYSOP7.PAS:
+      writeln(f,'New TeleGard-X Menu');
+      ldesc:='(XXX)New TeleGard-X Command';
+      sprint(#3#3+'TeleGard-X Menu Editor');
+File COMMON.PAS:
+        s:='TeleGard-X Bulletin Board System, Version '+ver;
+File COMMON1.PAS:
+    writeln(trapfile,'***** TeleGard-X User Audit - '+nam+' on at '+date+' '+time+' *****');
+  tc(11); writeln('[> Type "EXIT" to return to TeleGard-X.');
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coconfig.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,800 @@
+program coconfig;
+
+{$M 35000,0,1000}
+
+uses myio,
+     {rcg11172000 hhmm...what's turbo3 do?}
+     {crt, dos, turbo3;}
+     crt, dos;
+
+{$I func.pas}
+
+type cfilterrec=array[0..255] of byte;
+     colorset=set of #0..#255;
+
+var cfilterf:file of cfilterrec;
+    cfilter:cfilterrec;
+    cfilter_name:string;
+    changed:boolean;
+
+const CURSOR_COLOR = 15;
+      default_cfilter:cfilterrec=
+        (9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+         9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+         9,9,11,9,9,9,9,11,11,11,9,9,9,9,9,9,
+         14,14,14,14,14,14,14,14,14,14,11,11,11,9,11,11,
+         9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
+         11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,9,
+         11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
+         11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,9,
+         9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+         9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+         9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+         9,9,9,13,13,13,13,13,13,13,13,13,13,13,13,13,
+         13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+         13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+         9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+         9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9);
+
+
+{rcg11172000 added by me.}
+procedure CursorOn(flag:boolean);
+begin
+  writeln('STUB: bb.pas; CursorOn()...');
+end;
+{rcg11172000 adds end.}
+
+
+procedure textset(f,b:byte);
+begin
+  textcolor(f);
+  textbackground(b);
+end;
+
+function cstr(i:longint):string;
+var c:string;
+begin
+  str(i,c);
+  cstr:=c;
+end;
+
+function mln(s:string; len:integer):string;
+begin
+  while (length(s)<len) do s:=s+' ';
+  mln:=s;
+end;
+
+function getscreen(x,y,z:byte):byte;
+begin
+  {rcg11172000 doesn't fly under Linux.}
+  {getscreen:=mem[vidseg:(160*(y-1)+2*(x-1))+z];}
+  writeln('STUB: coconfig.pas; getscreen()...');
+  getscreen:=0;
+end;
+
+procedure putscreen(x,y,c,col:byte);
+begin
+  {rcg11172000 doesn't fly under Linux.}
+  {
+  mem[vidseg:(160*(y-1)+2*(x-1))]:=c;
+  mem[vidseg:(160*(y-1)+2*(x-1))+1]:=col;
+  }
+  writeln('STUB: coconfig.pas; putscreen()...');
+end;
+
+procedure updateeditingline;
+begin
+  textset(0,7); gotoxy(34,13);
+  if (cfilter_name<>'') then
+    write('Editing "'+cfilter_name+'"')
+  else
+    write('New file');
+  if (changed) then cwrite(#3#16+' * ');
+  textset(7,0);
+end;
+
+procedure initchrsettings;
+var i,x,y:integer;
+begin
+  textset(0,7); box(8,32,1,67,14); window(1,1,80,25);
+
+  cwriteat(32,6,'');
+  textset(7,0); for i:=1 to 34 do write('');
+  textset(0,7); write('');
+
+  cwriteat(32,12,'');
+  for i:=1 to 34 do write('');
+  write('');
+
+  gotoxy(33,13); for i:=1 to 34 do write(' ');
+  updateeditingline;
+
+  cwriteat(40,1,#3#15+#2#1+' Character Settings ');
+
+  i:=32;
+  for y:=3 to 10 do begin
+    if (y=6) then inc(y);
+    for x:=34 to 65 do begin
+      putscreen(x,y,i,7);
+      inc(i);
+    end;
+  end;
+end;
+
+procedure updatechrsettings(uset:colorset; col:integer);
+var i,x,y:integer;
+begin
+  i:=32;
+  for y:=3 to 10 do begin
+    if (y=6) then inc(y);
+    for x:=34 to 65 do begin
+      if (chr(i) in uset) then
+        if (col=-1) then
+          putscreen(x,y,i,cfilter[i])
+        else
+          putscreen(x,y,i,col);
+      inc(i);
+    end;
+  end;
+end;
+
+procedure docolortable(editset:colorset; cx,cy:integer; var feedback:char);
+var ctwind,undercursor:windowrec;
+    curb,curf,oldb,oldf,i:integer;
+    c:char;
+    col,oldcol,bb:byte;
+    abort,done:boolean;
+
+  procedure putwithbg(x,y,col:byte; c:char);
+  var oldattr:byte;
+  begin
+    putscreen(x,y,ord(c),(getscreen(x,y,1) and 240)+col);
+  end;
+
+  procedure putcursor;
+  begin
+    savescreen(undercursor,cx+curb*3+1,cy+curf+1,cx+curb*3+5,cy+curf+3);
+    putwithbg(cx+curb*3+1, cy+curf+1, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+2, cy+curf+1, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+3, cy+curf+1, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+4, cy+curf+1, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+5, cy+curf+1, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+1, cy+curf+2, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+5, cy+curf+2, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+1, cy+curf+3, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+2, cy+curf+3, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+3, cy+curf+3, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+4, cy+curf+3, CURSOR_COLOR, '');
+    putwithbg(cx+curb*3+5, cy+curf+3, CURSOR_COLOR, '');
+    oldb:=curb; oldf:=curf;
+  end;
+
+  procedure delcursor;
+  begin
+    removewindow1(undercursor);
+  end;
+
+  procedure setupcolortable;
+  var x,y:integer;
+  begin
+    setwindow(ctwind,cx,cy,cx+27,cy+19,0,7,8);
+    window(cx+2,cy+2,cx+25,cy+18);
+
+    gotoxy(1,1);
+    for y:=0 to 15 do begin
+      textcolor(y);
+      for x:=0 to 7 do begin
+        textbackground(x);
+        write(' x ');
+      end;
+    end;
+    window(cx,cy,cx+27,cy+19);
+
+    cwriteat(6,1,#3#15+#2#1+' Color Selection: ');
+
+    window(1,1,80,25);
+
+    cwriteat(34,22,#3#14+#2#0+'余: '+#3#11+'Save color selection');
+    cwriteat(34,23,#3#14+#2#0+'ESC: '+#3#11+'Abort');
+
+    curb:=(col and 112) shr 4; curf:=col and 15;
+    putcursor;
+  end;
+
+begin
+  i:=32;
+  while (i<=255) do begin
+    if (chr(i) in editset) then begin
+      col:=cfilter[i];
+      i:=255;
+    end;
+    inc(i);
+  end;
+  oldcol:=col;
+
+  setupcolortable;
+
+  abort:=FALSE; done:=FALSE;
+  while (not done) do begin
+    c:=upcase(readkey);
+    case ord(c) of
+      0:case ord(readkey) of
+          ARROW_HOME :curb:=0;
+          ARROW_UP   :if (curf>0) then dec(curf);
+          ARROW_PGUP :curf:=0;
+          ARROW_LEFT :if (curb>0) then dec(curb);
+          ARROW_RIGHT:if (curb<7) then inc(curb);
+          ARROW_END  :curb:=7;
+          ARROW_DOWN :if (curf<15) then inc(curf);
+          ARROW_PGDN :curf:=15;
+        end;
+     13:done:=TRUE;
+     27:begin abort:=TRUE; done:=TRUE; end;
+     49..56,67:begin feedback:=c; abort:=TRUE; done:=TRUE; end;
+    end;
+    if ((curf<>oldf) or (curb<>oldb)) then begin
+      delcursor;
+      putcursor;
+      col:=(curb shl 4)+curf;
+      updatechrsettings(editset,col);
+    end;
+  end;
+
+  if (not abort) then begin
+    if (not changed) then begin
+      changed:=TRUE;
+      updateeditingline;
+    end;
+    i:=32;
+    while (i<=255) do begin
+      if (chr(i) in editset) then cfilter[i]:=col;
+      inc(i);
+    end;
+  end else
+    updatechrsettings(editset,-1);
+
+  gotoxy(34,22); clreol; gotoxy(34,23); clreol;
+  removewindow1(ctwind);
+end;
+
+function allcaps(s:string):string;
+var i:integer;
+begin
+  for i:=1 to length(s) do s[i]:=upcase(s[i]);
+  allcaps:=s;
+end;
+
+procedure getsetchr(var sc:char; var cx,cy:byte);
+var ox,oy:byte;
+    c:char;
+    done:boolean;
+
+  procedure revcursor(x,y:byte);
+  begin
+    putscreen(x,y,getscreen(x,y,0),255-getscreen(x,y,1));
+  end;
+
+begin
+  ox:=cx; oy:=cy;
+
+  revcursor(cx,cy);
+
+  done:=FALSE;
+  while (not done) do begin
+    c:=upcase(readkey);
+    case ord(c) of
+      0:case ord(readkey) of
+          ARROW_HOME :cx:=34;
+          ARROW_UP   :if (cy>3) then begin dec(cy); if (cy=6) then cy:=5; end;
+          ARROW_PGUP :cy:=3;
+          ARROW_LEFT :if (cx>34) then dec(cx);
+          ARROW_RIGHT:if (cx<65) then inc(cx);
+          ARROW_END  :cx:=65;
+          ARROW_DOWN :if (cy<10) then begin inc(cy); if (cy=6) then cy:=7; end;
+          ARROW_PGDN :cy:=10;
+        end;
+     13:begin
+          sc:=chr(getscreen(cx,cy,0));
+          done:=TRUE;
+        end;
+     27:done:=TRUE;
+    end;
+    if ((cx<>ox) or (cy<>oy)) then begin
+      revcursor(ox,oy);
+      ox:=cx; oy:=cy;
+      revcursor(cx,cy);
+    end;
+  end;
+  revcursor(cx,cy);
+end;
+
+function ritr(c:char; len:integer):string;
+var s:string;
+    i:integer;
+begin
+  s:='';
+  for i:=1 to len do s:=s+c;
+  ritr:=s;
+end;
+
+procedure docwindow(var wind:windowrec; y:integer; s:string);
+var xx,x1,y1,x2,y2:integer;
+    sx,sy,sz:byte;
+begin
+  sx:=wherex; sy:=wherey; sz:=textattr;
+  x1:=36-(length(s) div 2); y1:=y;
+  x2:=x1+length(s)+8; y2:=y+4;
+  xx:=length(s);
+  savescreen(wind,x1,y1,x2,y2);
+  cwriteat(x1,y1,   #3#4+#2#0+'樛樛'+ritr('',xx)+'樛樛');
+  cwriteat(x1,y1+1,#3#14+#2#4+' 桎'+ritr('',xx)+'烝 ');
+  cwriteat(x1,y1+2,#3#14+#2#4+'   '+s+'   ');
+  cwriteat(x1,y1+3,#3#14+#2#4+' 桀'+ritr('',xx)+'樛 ');
+  cwriteat(x1,y1+4,#3#4+#2#0+ '烝烝'+ritr('',xx)+'烝烝');
+  gotoxy(sx,sy); textattr:=sz;
+end;
+
+var newf,oldf:file;
+    buff:array[1..16384] of byte;
+
+procedure killoldcode(fname:string);
+var tempwind:windowrec;
+    fspecpath,s1:dirstr;
+    fspecname,s2:namestr;
+    s3:extstr;
+    j:longint;
+    numread:word;
+    bb:byte;
+begin
+  docwindow(tempwind,10,fname+': Removing old filter.');
+  fsplit(fname,s1,s2,s3);
+  assign(newf,s1+s2+'.$$$');
+  {$I-} rewrite(newf,1); {$I+}
+  if (ioresult<>0) then begin
+    removewindow1(tempwind);
+    docwindow(tempwind,10,s1+s2+'.$$$: Unable to create.');
+    delay(1000);
+    removewindow1(tempwind);
+    close(oldf);
+  end else begin
+    seek(oldf,0); blockread(oldf,bb,1,numread); blockread(oldf,bb,1,numread);
+    repeat blockread(oldf,bb,1,numread) until ((chr(bb)=';') or (eof(oldf)));
+    if (not eof(oldf)) then
+      repeat
+        blockread(oldf,buff,16384,numread);
+        blockwrite(newf,buff,numread);
+      until (numread<16384);
+    close(oldf); close(newf);
+    erase(oldf); rename(newf,fname);
+    assign(oldf,fname); reset(oldf);
+    removewindow1(tempwind);
+  end;
+end;
+
+function addthefilter(fname:string; cfiltername:string):boolean;
+var tempwind:windowrec;
+    cfcode:string;
+    fspecpath,s1:dirstr;
+    fspecname,s2:namestr;
+    s3:extstr;
+    numread:word;
+    j:integer;
+begin
+  addthefilter:=TRUE;
+  cfcode:=^T+'c'+cfiltername+';';
+  assign(oldf,fname);
+  {$I-} reset(oldf,1); {$I+}
+  if (ioresult<>0) then begin
+    docwindow(tempwind,10,fname+': Unable to open.');
+    delay(1000);
+    removewindow1(tempwind);
+    addthefilter:=FALSE;
+  end else begin
+    seek(oldf,0); blockread(oldf,buff,2,numread);
+    if ((chr(buff[1])=^T) and (chr(buff[2])='c')) then killoldcode(fname);
+    fsplit(fname,s1,s2,s3);
+    assign(newf,s1+s2+'.$$$');
+    {$I-} rewrite(newf,1); {$I+}
+    if (ioresult<>0) then begin
+      docwindow(tempwind,10,s1+s2+'.$$$: Unable to create.');
+      delay(1000);
+      removewindow1(tempwind);
+      close(oldf);
+      addthefilter:=FALSE;
+    end else begin
+      for j:=1 to length(cfcode) do buff[j]:=ord(cfcode[j]);
+      blockwrite(newf,buff,length(cfcode));
+      reset(oldf,1);
+      repeat
+        blockread(oldf,buff,16384,numread);
+        blockwrite(newf,buff,numread);
+      until (numread<16384);
+      close(oldf); close(newf);
+      erase(oldf); rename(newf,fname);
+    end;
+  end;
+end;
+
+procedure addfilters;
+var oldf,newf:file;
+    savescr,tempwind:windowrec;
+    dirinfo:searchrec;
+    fs:array[1..110] of string[12];
+    tagstat:array[1..110] of boolean;
+    fspecpath,s1:dirstr;
+    fspecname,s2:namestr;
+    s3:extstr;
+    fspec,fname,cfname,cfcode:string;
+    numread:word;
+    numfs,i,cx,cy,ci,ox,oy,oi:integer;
+    c:char;
+    bb:byte;
+    abort,done,noneyet:boolean;
+
+  function cxp1(i:integer):byte;
+  begin
+    cxp1:=((i-1) mod 5)+1;
+  end;
+
+  function cxp(i:integer):byte;
+  begin
+    cxp:=16*(cxp1(i)-1)+2;
+  end;
+
+  function cyp(i:integer):byte;
+  begin
+    cyp:=((i-1) div 5)+1;
+  end;
+
+  procedure putcursor;
+  var i,x,y:integer;
+  begin
+    x:=cxp(oi); y:=cyp(oi);
+    for i:=x to x+13 do putscreen(i,y,getscreen(i,y,0),30);
+  end;
+
+  procedure delcursor;
+  var i,x,y:integer;
+  begin
+    x:=cxp(oi); y:=cyp(oi);
+    for i:=x to x+13 do putscreen(i,y,getscreen(i,y,0),14);
+  end;
+
+  procedure tagit(i:integer);
+  begin
+    tagstat[i]:=not tagstat[i];
+    if (tagstat[i]) then
+      putscreen(cxp(i)-1,cyp(i),ord('*'),10)
+    else
+      putscreen(cxp(i)-1,cyp(i),ord(' '),10);
+  end;
+
+  procedure doaddfilters;
+  var j:longint;
+      i,savci:integer;
+  begin
+    delcursor; savci:=ci;
+
+    fsplit(cfilter_name,s1,s2,s3); cfname:=s2+s3;
+
+    setwindow(tempwind,11,9,67,14,9,1,8); textset(9,1); clrscr;
+    window(1,1,80,25);
+    cwriteat(14,11,#3#11+#2#1+'Color filter filename:');
+    cwriteat(14,12,#3#9+#2#1+':');
+    cursoron(TRUE); infield1(15,12,cfname,50); cursoron(FALSE);
+    removewindow1(tempwind);
+
+    if (cfname<>'') then begin
+      cfcode:=^T+'c'+cfname+';';
+      for i:=1 to numfs do
+        if (tagstat[i]) then begin
+          oi:=i; putcursor;
+          if (addthefilter(fspecpath+fs[i],cfname)) then tagit(i);
+          delcursor;
+        end;
+    end;
+    ci:=savci; oi:=ci;
+    putcursor;
+  end;
+
+begin
+  setwindow(savescr,1,1,80,25,14,0,0); clrscr;
+
+  cursoron(TRUE);
+  textcolor(11); writeln('  Enter filespec to edit:');
+  textcolor(9); write('  :');
+  fspec:='*.MSG';
+  infield1(wherex,wherey,fspec,76); fspec:=fexpand(allcaps(fspec));
+  fsplit(fspec,fspecpath,fspecname,s3);
+  cursoron(FALSE);
+  if (fspec='') then exit;
+  clrscr;
+
+  findfirst(fspec,anyfile-directory,dirinfo);
+  if (doserror<>0) then begin
+    docwindow(tempwind,10,'No files found.');
+    delay(1000);
+    removewindow1(tempwind);
+  end else begin
+    ci:=1;
+    while ((ci<=110) and (doserror=0)) do begin
+      fs[ci]:=dirinfo.name; tagstat[ci]:=FALSE;
+      findnext(dirinfo);
+      inc(ci);
+    end;
+    numfs:=ci-1;
+    textcolor(14);
+    for ci:=1 to numfs do
+      cwriteat(cxp(ci),cyp(ci),mln(fs[ci],12));
+
+    cwriteat(1,25,#3#14+'SPACE: '+#3#11+'Tag files   '+
+                  #3#14+'A: '+#3#11+'Tag all   '+
+                  #3#14+'余: '+#3#11+'Go!   '+
+                  #3#14+'ESC: '+#3#11+'Done');
+
+    ci:=1; oi:=1; putcursor;
+
+    abort:=FALSE; done:=FALSE;
+    while (not done) do begin
+      c:=upcase(readkey);
+      case ord(c) of
+        0:case ord(readkey) of
+            ARROW_HOME :ci:=(cyp(ci)-1)*5+1;
+            ARROW_UP   :dec(ci,5);
+            ARROW_PGUP :ci:=cxp1(ci);
+            ARROW_LEFT :dec(ci);
+            ARROW_RIGHT:inc(ci);
+            ARROW_END  :ci:=(cyp(ci)-1)*5+5;
+            ARROW_DOWN :inc(ci,5);
+            ARROW_PGDN :begin
+                          ci:=(cyp(numfs)-1)*5+cxp1(ci);
+                          if (ci>numfs) then dec(ci,5);
+                        end;
+          end;
+       13:begin
+            noneyet:=TRUE;
+            for i:=1 to numfs do
+              if (tagstat[i]) then noneyet:=FALSE;
+            if (noneyet) then tagit(ci);
+            doaddfilters;
+          end;
+       27:begin abort:=TRUE; done:=TRUE; end;
+       32:begin tagit(ci); inc(ci); end;
+       65:for i:=1 to numfs do tagit(i);
+      end;
+      if (ci<>oi) then begin
+        if (ci<1) then ci:=1;
+        if (ci>numfs) then ci:=numfs;
+        delcursor; oi:=ci; putcursor;
+      end;
+    end;
+    delcursor;
+  end;
+
+  removewindow1(savescr);
+end;
+
+var doswindow,askwindow:windowrec;
+    allset,set1,set2,set3,set4,set5,set6,set7,set8:colorset;
+    editset:colorset;
+    dirinfo:searchrec;
+    setname:string;
+    dosx,dosy,i,j,k:integer;
+    c,feedback,setc1,setc2:char;
+    sx,sy:byte;
+    done,isnew:boolean;
+
+procedure definesets;
+begin
+  set1:=['A'..'Z'];
+  set2:=['a'..'z','"','''',':',';','?','\','`','|'];
+  set3:=['0'..'9'];
+  set4:=[#179..#223];
+  set5:=[#176..#178];
+{ set6:= }
+  set7:=['(',')','<','>','[',']','{','}'];
+  set8:=['!','#','$','%','&','*','@','^'];
+
+  allset:=[#0..#255];
+  set6:=allset-set1-set2-set3-set4-set5-set7-set8;
+end;
+
+procedure exite(i:integer);
+begin
+  clrscr;
+  removewindow1(doswindow);
+  gotoxy(dosx,dosy);
+  cursoron(TRUE);
+  halt(i);
+end;
+
+procedure savecfilter;
+var tempwind:windowrec;
+begin
+  if (cfilter_name='') then begin
+    setwindow(tempwind,11,9,67,14,9,1,8); textset(9,1); clrscr;
+    window(1,1,80,25);
+    cwriteat(14,11,#3#11+#2#1+'Save color filter as:');
+    cwriteat(14,12,#3#9+#2#1+':');
+    cursoron(TRUE); infield1(15,12,cfilter_name,50); cursoron(FALSE);
+    removewindow1(tempwind);
+  end;
+  if (cfilter_name<>'') then begin
+    assign(cfilterf,cfilter_name);
+    {$I-} rewrite(cfilterf); {$I+}
+    if (ioresult<>0) then begin
+      docwindow(tempwind,10,cfilter_name+': Unable to create.');
+      delay(1000);
+      removewindow1(tempwind);
+    end else begin
+      {$I-} write(cfilterf,cfilter); {$I+}
+      if (ioresult<>0) then begin
+        docwindow(tempwind,10,cfilter_name+': Unable to write color filter.');
+        delay(1000);
+        removewindow1(tempwind);
+      end else begin
+        changed:=FALSE;
+        updateeditingline;
+        updatechrsettings(allset,-1);
+      end;
+      close(cfilterf);
+    end;
+  end;
+end;
+
+begin
+  infield_out_fgrd:=15;
+  infield_out_bkgd:=1;
+  infield_inp_fgrd:=0;
+  infield_inp_bkgd:=7;
+  infield_arrow_exit:=FALSE;
+
+  dosx:=wherex; dosy:=wherey;
+  checkvidseg;
+  cursoron(FALSE);
+  savescreen(doswindow,1,1,80,25);
+  clrscr;
+
+  if ((paramcount>0) and (paramstr(1)<>'')) then
+    cfilter_name:=paramstr(1)
+  else
+    cfilter_name:='';
+(*  begin
+    cursoron(TRUE);
+    textcolor(11); writeln('Enter color configuration filename');
+    textcolor(9); write(':');
+    infield(cfilter_name,78); cfilter_name:=allcaps(cfilter_name);
+    cursoron(FALSE);
+    clrscr;
+  end;*)
+
+  if (paramcount>1) then begin
+    writeln;
+    cwrite(#3#9+' '+#3#11+'Color filter name: "'+cfilter_name+'"');
+    writeln; writeln;
+    j:=0;
+    for i:=2 to paramcount do begin
+      findfirst(paramstr(i),anyfile-directory,dirinfo);
+      while (doserror=0) do begin
+        cwrite(#3#9+' '+#3#11+dirinfo.name+#3#9+' - '+#3#11);
+        if (addthefilter(dirinfo.name,cfilter_name)) then begin
+          cwrite('Done.');
+          inc(j);
+        end else
+          cwrite('Unable to add color filter!'^G^G);
+        writeln;
+        findnext(dirinfo);
+      end;
+    end;
+    writeln;
+    cwrite(#3#9+' '+#3#11+'Added color filter to '+#3#15+cstr(j)+#3#11+' file');
+    if (j<>1) then cwrite('s');
+    cwrite('.');
+    writeln;
+    delay(3000);
+    exite(0);
+  end;
+
+  isnew:=FALSE;
+  if (cfilter_name<>'') then begin
+    assign(cfilterf,cfilter_name);
+    {$I-} reset(cfilterf); {$I+}
+    if (ioresult=0) then begin
+      {$I-} read(cfilterf,cfilter); {$I+}
+      if (ioresult<>0) then begin end;
+      close(cfilterf);
+    end else
+      isnew:=TRUE;
+  end else
+    isnew:=TRUE;
+
+  if (isnew) then begin
+    cfilter:=default_cfilter;
+{    cwriteat(1,1,#3#12+'陳 '+#3#14+'NEW FILE'+#3#12+' 陳');
+    delay(1000);}
+    clrscr;
+  end;
+
+  changed:=FALSE;
+  definesets;
+  initchrsettings;
+  updatechrsettings(allset,-1);
+
+  cwriteat(34,16,#2#0+#3#14+'1-8: '+#3#11+'Edit pre-defined set');
+  cwriteat(34,17,#2#0+#3#14+'  A: '+#3#11+'Add filter to text files');
+  cwriteat(34,18,#2#0+#3#14+'  C: '+#3#11+'Edit character range');
+{  cwriteat(34,19,#2#0+#3#14+'  L: '+#3#11+'Load new color filter');}
+  cwriteat(34,19,#2#0+#3#14+'  S: '+#3#11+'Save color filter');
+  cwriteat(34,20,#2#0+#3#14+'  Q: '+#3#11+'Quit & Save');
+
+  changed:=FALSE; done:=FALSE;
+  feedback:=#0;
+  while (not done) do begin
+    if (feedback<>#0) then begin
+      c:=feedback;
+      feedback:=#0;
+    end else
+      c:=readkey;
+    case upcase(c) of
+      '1'..'8':
+          begin
+            case c of
+              '1':begin editset:=set1; setname:='Upper-case letters'; end;
+              '2':begin editset:=set2; setname:='Lower-case letters'; end;
+              '3':begin editset:=set3; setname:='Number chrs'; end;
+              '4':begin editset:=set4; setname:='Line-drawing chrs'; end;
+              '5':begin editset:=set5; setname:='Graphic chrs'; end;
+              '6':begin editset:=set6; setname:='Other chrs'; end;
+              '7':begin editset:=set7; setname:='Bracket chrs'; end;
+              '8':begin editset:=set8; setname:='Special chrs'; end;
+            end;
+
+            cwriteat(2,22,#3#14+'Editing pre-defined set #'+c);
+            cwriteat(4,23,#3#14+'"'+setname+'"');
+
+            docolortable(editset,1,1,feedback);
+
+            gotoxy(1,22); clreol; gotoxy(1,23); clreol;
+          end;
+      'A':addfilters;
+      'C':begin
+            cwriteat(34,22,#3#14+'Select set starting character, and hit 余.');
+            setc1:=#0; sx:=34; sy:=3;
+            getsetchr(setc1,sx,sy);
+            gotoxy(34,22); clreol;
+            if (setc1<>#0) then begin
+              cwriteat(34,22,#3#14+'Select set ending character, and hit 余.');
+              setc2:=#0;
+              getsetchr(setc2,sx,sy);
+              gotoxy(34,22); clreol;
+              if (setc2<>#0) then begin
+                editset:=[];
+                for c:=setc1 to setc2 do editset:=editset+[c];
+                cwriteat(2,22,#3#14+'Editing user-defined set,');
+                cwriteat(2,23,#3#14+'Chrs "'+setc1+'".."'+setc2+
+                        '" ('+cstr(ord(setc1))+'..'+cstr(ord(setc2))+')');
+
+                docolortable(editset,1,1,feedback);
+
+                gotoxy(1,22); clreol; gotoxy(1,23); clreol;
+              end;
+            end;
+          end;
+      'S':savecfilter;
+      'Q':done:=TRUE;
+    end;
+  end;
+
+  gotoxy(34,16); clreol; gotoxy(34,17); clreol; gotoxy(34,18); clreol;
+  gotoxy(34,19); clreol; gotoxy(34,20); clreol;
+
+  if (changed) then begin
+    docwindow(askwindow,15,'Save? (Y/n)');
+    repeat c:=upcase(readkey) until (c in ['Y','N',^M]);
+    removewindow1(askwindow);
+    changed:=(c<>'N');
+    if (changed) then savecfilter;
+  end;
+
+  exite(0);
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,2965 @@
+{$A+,B+,D-,E+,F+,I+,L-,N-,O-,R-,S+,V-}
+unit common;
+
+interface
+
+uses
+  crt,dos,printer,
+  myio,tmpcom,timejunk;
+
+{$I func.pas}
+{$I rec25.pas}
+
+const strlen=160;
+      dsaves:integer=0;
+      BOXEDTITLE='`#[';
+      sepr2=#3#4+':'+#3#3;
+
+type f_initexecswap = function(p:pointer; s:string):boolean;
+     f_execwithswap = function(p,c:string):word;
+     p_shutdownexecswap = procedure;
+
+var initexecswap2:f_initexecswap;
+    execwithswap2:f_execwithswap;
+    shutdownexecswap2:p_shutdownexecswap;
+
+var uf:file of userrec;           { USER.LST                              }
+    bf:file of boardrec;          { BOARDS.DAT                            }
+    xf:file of protrec;           { PROTOCOL.DAT                          }
+    ulf:file of ulrec;            { UPLOADS.DAT                           }
+    ulff:file of ulfrec;          { *.DIR                                 }
+    sf:file of smalrec;           { NAMES.LST                             }
+    smf:file of smr;              { SHORTMSG.DAT                          }
+    verbf:file of verbrec;        { VERBOSE.DAT                           }
+    mixf:file;                    { *.MIX                                 }
+    brdf:file;                    { *.BRD                                 }
+
+    sysopf,                       { SYSOP.LOG                             }
+    sysopf1,                      { SLOGxxxx.LOG                          }
+    trapfile,                     { TRAP*.MSG                             }
+    cf:text;                      { CHAT*.MSG                             }
+
+    systat:systatrec;             { configuration information             }
+    fstring:fstringrec;           { string configuration                  }
+    modemr:modemrec;              { modem configuration                   }
+    fidor:fidorec;                { FidoNet information                   }
+
+    thisuser:userrec;             { user's account records                }
+    macros:macrorec;              { user's macros, if any                 }
+    zscanr:zscanrec;              { user's zscan records                  }
+
+    { BRD files }
+    msg_on:integer;               { current message being read            }
+
+    { EVENTS }
+    events:array[0..maxevents] of ^eventrec;
+    numevents:integer;            { # of events                           }
+
+    { PROTOCOLS }
+    protocol:protrec;             { protocol in memory                    }
+    numprotocols:integer;         { # of protocols                        }
+
+    { FILE BASES }
+    memuboard,tempuboard:ulrec;   { uboard in memory, temporary uboard    }
+    readuboard,                   { current uboard # in memory            }
+    maxulb,                       { # of file bases                       }
+    fileboard:integer;            { file base user is in                  }
+
+    { MESSAGE BASES }
+    memboard:boardrec;            { board in memory                       }
+    readboard,                    { current board # in memory             }
+    numboards,                    { # of message bases                    }
+    board:integer;                { message base user is in               }
+
+    { FILE/MESSAGE BASE COMPRESSION TABLES }
+    ccboards:array[0..1,1..maxboards] of byte;
+    ccuboards:array[0..1,0..maxuboards] of byte;
+
+    spd:string[6];                { current modem speed, "KB" for local   }
+    spdarq:boolean;               { whether modem connected with ARQ      }
+
+(*****************************************************************************)
+
+    { message stuff }
+    mintabloaded:word;            { minor table loaded }
+    mintaboffset:longint;         { minor table file offset }
+    mintab:array[0..99] of msgindexrec; { minor table }
+    himsg:longint;                { highest message number }
+    himintab:longint;             { highest minor table number }
+
+
+    buf:string[255];              { macro buffer                          }
+
+    sitedatetime:packdatetime;    { last time site compiled/changed status }
+
+    vercs:string;
+    vertypes:byte;                { Alpha/Beta/etc, Registered, Node      }
+
+    chatr,                        { last chat reason                      }
+    cmdlist,                      { list of cmds on current menu          }
+    irt,                          { reason for reply                      }
+    lastname,                     { author of last message displayed      }
+    lastuname,                    { last name, whether anon or not        }
+    licenseinfo,                  { licensing info, if present            }
+    ll,                           { "last-line" string for word-wrapping  }
+    start_dir:string;             { directory BBS was executed from       }
+
+    tim,                          { time last keystroke entered           }
+    timeon:datetimerec;           { time user logged on                   }
+
+    choptime,                     { time to chop off for system events    }
+    extratime,                    { extra time - given by F7/F8, etc      }
+    freetime,                     { free time                             }
+    oltime:real;
+
+    answerbaud,                   { baud rate to answer the phone at      }
+    exteventtime,                 { # minutes before external event       }
+    maxheapspace,                 { max heap space available              }
+    serialnumber:longint;         { serial number, if present             }
+
+    chatt,                        { number chat attempts made by user     }
+    etoday,                       { E-mail sent by user this call         }
+    ftoday,                       { feedback sent by user this call       }
+    lastprot,                     { last protocol #                       }
+    ldate,                        { last daynum()                         }
+    lil,                          { lines on screen since last pausescr() }
+    mread,                        { # public messages has read this call  }
+    pap,                          { characters on this line so far        }
+    ptoday,                       { posts made by user this call          }
+    realdsl,                      { real DSL level of user                }
+    realsl,                       { real SL level of user (for F9)        }
+    usernum:integer;              { user's user number                    }
+ 
+    bread,                        { board loaded, or -1 for e-mail        }
+    bwant:integer;
+
+    chelplevel,                   { current help level                    }
+    curco,                        { current ANSI color                    }
+    elevel,                       { ERRORLEVEL to exit with               }
+    tshuttlelogon:byte;           { type of special Shuttle Logon command }
+
+const
+    allowabort:boolean=TRUE;      { are aborts allowed?                   }
+    echo:boolean=TRUE;            { is text being echoed? (FALSE=use echo chr)}
+    flistverb:boolean=TRUE;       { list verbose descriptions?            }
+    hangup:boolean=TRUE;          { is user offline now?                  }
+    nofile:boolean=TRUE;          { did last pfl() file NOT exist?        }
+    onekcr:boolean=TRUE;          { does ONEK prints<CR> upon exit?       }
+    onekda:boolean=TRUE;          { does ONEK display the choice?         }
+    slogging:boolean=TRUE;        { are we outputting to the SysOp log?   }
+    sysopon:boolean=TRUE;         { is SysOp logged onto the WFC menu?    }
+    wantout:boolean=TRUE;         { output text locally?                  }
+    wcolor:boolean=TRUE;          { in chat: was last key pressed by SysOp? }
+
+    badfpath:boolean=FALSE;       { is the current DL path BAD?           }
+    badufpath:boolean=FALSE;      { is the current UL path BAD?           }
+    badini:boolean=FALSE;         { was last call to ini/inu value()=0, s<>"0"? }
+    bchanged:boolean=FALSE;       { was BRD file changed?                 }
+    beepend:boolean=FALSE;        { whether to beep after caller logs off }
+    bnp:boolean=FALSE;            { was file base name printed yet?       }
+    cfilteron:boolean=FALSE;      { is the color filter on?               }
+    cfo:boolean=FALSE;            { is chat file open?                    }
+    ch:boolean=FALSE;             { are we in chat mode?                  }
+    chatcall:boolean=FALSE;       { is the chat call "noise" on?          }
+    checkit:boolean=FALSE;        { }
+    contlist:boolean=FALSE;       { continuous message listing mode on?   }
+    croff:boolean=FALSE;          { are CRs turned off?                   }
+    ctrljoff:boolean=FALSE;       { turn color to #1 after ^Js??          }
+    cwindowon:boolean=FALSE;      { is SysOp window ON?                   }
+    doneafternext:boolean=FALSE;  { offhook and exit after next logoff?   }
+    doneday:boolean=FALSE;        { are we done now? ready to drop to DOS? }
+    dosansion:boolean=FALSE;      { output chrs to DOS for ANSI codes?!!? }
+    dyny:boolean=FALSE;           { does YN return Yes as default?        }
+    enddayf:boolean=FALSE;        { perfrom "endday" after logoff?        }
+    fastlogon:boolean=FALSE;      { if a FAST LOGON is requested          }
+    hungup:boolean=FALSE;         { did user drop carrier?                }
+    incom:boolean=FALSE;          { accepting input from com?             }
+    inmsgfileopen:boolean=FALSE;  { are we //U ULing a file into a message? }
+    inwfcmenu:boolean=FALSE;      { are we in the WFC menu?               }
+    lan:boolean=FALSE;            { was last post/email anonymous/other?  }
+    lastcommandgood:boolean=FALSE;{ was last command a REAL command?      }
+    lastcommandovr:boolean=FALSE; { override PAUSE? (NO pause?)           }
+    lmsg:boolean=FALSE;           { }
+    macok:boolean=FALSE;          { are macros OKay right now?            }
+    mailread:boolean=FALSE;       { did user delete some e-mail?          }
+(*  minitermonly:boolean=FALSE;   { load up MiniTerm ONLY?                }*)
+    localioonly:boolean=FALSE;    { local I/O ONLY?                       }
+    packbasesonly:boolean=FALSE;  { pack message bases ONLY?              }
+    mtcfilteron:boolean=FALSE;    { Manhattan Transfer color-filter active }
+    mtcolors:boolean=FALSE;       { Manhattan Transfer colors in use      }
+    newmenutoload:boolean=FALSE;  { menu command returns TRUE if new menu to load }
+    nightly:boolean=FALSE;        { execute hard-coded nightly event?     }
+    nofeed:boolean=FALSE;         { }
+    nopfile:boolean=FALSE;        { }
+    overlayinems:boolean=FALSE;   { is overlay file in EMS memory?        }
+    outcom:boolean=FALSE;         { outputting to com?                    }
+    printingfile:boolean=FALSE;   { are we printing a file?               }
+    quitafterdone:boolean=FALSE;  { quit after next user logs off?        }
+    reading_a_msg:boolean=FALSE;  { is user reading a message?            }
+    readingmail:boolean=FALSE;    { reading private mail?                 }
+    read_with_mci:boolean=FALSE;  { read message with MCI?                }
+    returna:boolean=FALSE;        { return from MiniTerm and answer phone? }
+    shutupchatcall:boolean=FALSE; { was chat call "SHUT UP" for this call? }
+    smread:boolean=FALSE;         { were "small messages" read? (delete them) }
+    trapping:boolean=FALSE;       { are we trapping users text?           }
+    trm:boolean=FALSE;            { is MiniTerm in use?                   }
+    useron:boolean=FALSE;         { is there a user on right now?         }
+    wantfilename:boolean=FALSE;   { display message filename in scan?     }
+    wascriterr:boolean=FALSE;     { critical error during last call?      }
+    wasguestuser:boolean=FALSE;   { did a GUEST USER log on?              }
+    wasnewuser:boolean=FALSE;     { did a NEW USER log on?                }
+    write_msg:boolean=FALSE;      { is user writing a message?            }
+
+    telluserevent:byte=0;     { has user been told about the up-coming event? }
+    exiterrors:byte=254;          { ERRORLEVEL for Critical Error exit    }
+    exitnormal:byte=255;          { ERRORLEVEL for Normal exit            }
+
+    unlisted_filepoints=5;        { file points for unlisted downloads    }
+
+var
+    first_time:boolean;           { first time loading a menu?            }
+    menustack:array[1..8] of string[12]; { menu stack                     }
+    menustackptr:integer;         { menu stack pointer                    }
+    last_menu,                    { last menu loaded                      }
+    curmenu:string;                 { current menu loaded                   }
+    menur:menurec;                { menu information                      }
+    cmdr:array[1..50] of commandrec; { command information                }
+    noc:integer;                  { # of commands on menu                 }
+    fqarea,mqarea:boolean;        { file/message quick area changes       }
+
+    doit,doitt:boolean;
+    newdate:string[8];            { NewScan pointer date                  }
+    lrn:integer;                  { last record # for recno/nrecno        }
+    lfn:string;                     { last filename for recno/nrecno        }
+
+    batchtime:real;               { }
+    numbatchfiles:integer;        { # files in DL batch queue             }
+    batch:array[1..20] of record
+      fn:string[65];
+      section:integer;
+      pts:integer;
+      blks:longint;
+      tt:real;
+    end;
+
+    numubatchfiles:integer;       { # files in UL batch queue }
+    ubatch:array[1..maxubatchfiles] of record
+      fn:string[12];
+      section:integer;
+      description:string[65];
+      vr:byte;
+    end;
+    ubatchv:array[1..maxubatchfiles] of ^verbrec;
+    hiubatchv:integer;
+
+
+function lenn(s:string):integer;
+function lennmci(s:string):integer;
+procedure loaduboard(i:integer);
+procedure loadboard(i:integer);
+function smci(c:char):string;
+procedure sprompt(s:string);
+procedure tc(n:integer);
+function mso:boolean;
+function fso:boolean;
+function cso:boolean;
+function so:boolean;
+function timer:real;
+function fbaseac(b:byte):boolean;
+function mbaseac(nb:integer):boolean;
+procedure newcomptables;
+procedure changefileboard(b:integer);
+procedure changeboard(b:integer);
+function freek(d:integer):longint;    (* See disk space *)
+function nma:integer;
+function okansi:boolean;
+function okavatar:boolean;
+procedure cline(var s:string; dd:string);
+function nsl:real;
+function ageuser(bday:string):integer;     (* returns age of user by birthdate *)
+function allcaps(s:string):string;    (* returns a COMPLETELY capitalized string *)
+function caps(s:string):string;                (* returns a capitalized string.. *)
+procedure remove_port;
+procedure iport;
+{procedure initthething;}
+function getwindysize(wind:integer):integer;
+procedure commandline(s:string);
+procedure sclearwindow;
+procedure schangewindow(needcreate:boolean; newwind:integer);
+function ccinkey1:char;
+function cinkey1:char;
+procedure gameport;
+procedure sendcom1(c:char);
+function recom1(var c:char):boolean;
+procedure term_ready(ready_status:boolean);
+procedure checkhangup;
+function cinkey:char;
+{procedure o(c:char);}
+function intime(tim:real; tim1,tim2:integer):boolean;
+                                              (* check whether in time range *)
+function sysop1:boolean;
+function checkpw:boolean;
+function sysop:boolean;
+function stripcolor(o:string):string;
+procedure sl1(s:string);
+procedure sysoplog(s:string);
+function tch(s:string):string;
+function time:string;
+function date:string;
+function value(s:string):longint;
+function cstr(i:longint):string;
+function nam:string;
+procedure shelldos(bat:boolean; cl:string; var rcode:integer);
+procedure sysopshell(takeuser:boolean);
+procedure readinzscan;
+procedure savezscanr;
+procedure redrawforansi;
+function leapyear(yr:integer):boolean;
+function days(mo,yr:integer):integer;
+function daycount(mo,yr:integer):integer;
+function daynum(dt:string):integer;
+function dat:string;
+procedure doeventstuff;
+procedure getkey(var c:char);
+procedure pr1(s:string);
+procedure pr(s:string);
+procedure sde; {* restore curco colors (DOS and tc) loc. after local *}
+procedure sdc;
+procedure stsc;
+procedure setc(c:byte);
+procedure cl(c:integer);
+(*procedure promptc(c:char);*)
+procedure dosansi(c:char);
+procedure prompt(s:string);
+function sqoutsp(s:string):string;
+function exdrv(s:string):byte;
+function mln(s:string; l:integer):string;
+function mlnnomci(s:string; l:integer):string;
+function mlnmci(s:string; l:integer):string;
+function mrn(s:string; l:integer):string;
+function mn(i,l:longint):string;
+procedure pausescr;
+procedure print(s:string);
+procedure nl;
+procedure prt(s:string);
+procedure ynq(s:string);
+procedure mpl(c:integer);
+procedure tleft;
+procedure prestrict(u:userrec);
+procedure topscr;
+procedure readinmacros;
+procedure saveuf;
+procedure loadurec(var u:userrec; i:integer);
+procedure saveurec(u:userrec; i:integer);
+function empty:boolean;
+function inkey:char;
+{procedure oc(c:char);}
+procedure outkey(c:char);
+function checkeventday(i:integer; t:real):boolean;
+function checkpreeventtime(i:integer; t:real):boolean;
+function checkeventtime(i:integer; t:real):boolean;
+function checkevents(t:real):integer;
+procedure dm(i:string; var c:char);
+procedure cls;
+procedure wait(b:boolean);
+procedure swac(var u:userrec; r:uflags);
+function tacch(c:char):uflags;
+procedure acch(c:char; var u:userrec);
+procedure sprint(s:string);
+procedure lcmds(len,c:byte; c1,c2:string);
+procedure autovalidate(var u:userrec; un:integer);
+procedure rsm;
+procedure inittrapfile;
+procedure sysopstatus;
+procedure chatfile(b:boolean);
+function aonoff(b:boolean; s1,s2:string):string;
+function onoff(b:boolean):string;
+function syn(b:boolean):string;
+procedure pyn(b:boolean);
+function yn:boolean;
+function pynq(s:string):boolean;
+procedure inu(var i:integer);
+procedure ini(var i:byte);
+procedure inputwn1(var v:string; l:integer; flags:string; var changed:boolean);
+procedure inputwn(var v:string; l:integer; var changed:boolean);
+procedure inputwnwc(var v:string; l:integer; var changed:boolean);
+procedure inputmain(var s:string; ml:integer; flags:string);
+procedure inputwc(var s:string; ml:integer);
+procedure input(var s:string; ml:integer);
+procedure inputl(var s:string; ml:integer);
+procedure inputcaps(var s:string; ml:integer);
+procedure onek(var c:char; ch:string);
+procedure local_input1(var i:string; ml:integer; tf:boolean);
+procedure local_input(var i:string; ml:integer);
+procedure local_inputl(var i:string; ml:integer);
+procedure local_onek(var c:char; ch:string);
+function centre(s:string):string;
+procedure wkey(var abort,next:boolean);
+function ctim(rl:real):string;
+function tlef:string;
+procedure printa1(s:string; var abort,next:boolean);
+procedure printacr(s:string; var abort,next:boolean);
+function longtim(dt:datetimerec):string;
+function dt2r(dt:datetimerec):real;
+procedure r2dt(r:real; var dt:datetimerec);
+procedure timediff(var dt:datetimerec; dt1,dt2:datetimerec);
+procedure getdatetime(var dt:datetimerec);
+function cstrl(li:longint):string;
+function cstrr(rl:real; base:integer):string;
+procedure savesystat;  (* save systat *)
+procedure pfl(fn:string; var abort,next:boolean; cr:boolean);
+procedure printfile(fn:string);
+function exist(fn:string):boolean;
+procedure printf(fn:string);
+procedure mmkey(var s:string);
+
+procedure com_flush_rx;
+function com_carrier:boolean;
+function com_rx_empty:boolean;
+procedure com_set_speed(speed:word);
+
+procedure chat;
+procedure skey(c:char);
+procedure showudstats;
+procedure skey1(c:char);
+function verline(i:integer):string;
+function aacs1(u:userrec; un:integer; s:string):boolean;
+function aacs(s:string):boolean;
+
+procedure DisableInterrupts;
+procedure EnableInterrupts;
+
+implementation
+
+uses common1, common2, common3;
+
+(*****************************************************************************\
+ **
+ **  These routines have been placed in the overlay to decrease the
+ **  in-memory size of the BBS.  Routines that are used frequently, and are
+ **  HIGHLY related to the overall speed of the BBS, have been kept out
+ **  of the overlay file, and remain in memory at all times.
+ **
+\*****************************************************************************)
+function checkpw:boolean; begin checkpw:=common1.checkpw; end;
+procedure newcomptables; begin common1.newcomptables; end;
+procedure cline(var s:string; dd:string); begin common1.cline(s,dd); end;
+procedure pausescr; begin common1.pausescr; end;
+procedure wait(b:boolean); begin common1.wait(b); end;
+(*procedure fix_window; begin common1.fix_window; end;*)
+procedure inittrapfile; begin common1.inittrapfile; end;
+procedure chatfile(b:boolean); begin common1.chatfile(b); end;
+procedure local_input1(var i:string; ml:integer; tf:boolean);
+          begin common1.local_input1(i,ml,tf); end;
+procedure local_input(var i:string; ml:integer);
+          begin common1.local_input(i,ml); end;
+procedure local_inputl(var i:string; ml:integer);
+          begin common1.local_inputl(i,ml); end;
+procedure local_onek(var c:char; ch:string);
+          begin common1.local_onek(c,ch); end;
+function chinkey:char; begin chinkey:=common1.chinkey; end;
+procedure inli1(var s:string); begin common1.inli1(s); end;
+procedure chat; begin common1.chat; end;
+procedure sysopshell(takeuser:boolean);
+          begin common1.sysopshell(takeuser); end;
+procedure globat(i:integer); begin common1.globat(i); end;
+procedure exiterrorlevel; begin common1.exiterrorlevel; end;
+procedure showsysfunc; begin common1.showsysfunc; end;
+procedure readinzscan; begin common1.readinzscan; end;
+procedure savezscanr; begin common1.savezscanr; end;
+procedure redrawforansi; begin common1.redrawforansi; end;
+
+procedure showudstats; begin common2.showudstats; end;
+procedure skey1(c:char); begin common2.skey1(c); end;
+procedure savesystat; begin common2.savesystat; end;
+procedure remove_port; begin common2.remove_port; end;
+procedure iport; begin common2.iport; end;
+{procedure initthething; begin common2.initthething; end;}
+procedure gameport; begin common2.gameport; end;
+procedure sendcom1(c:char); begin common2.sendcom1(c); end;
+function recom1(var c:char):boolean; begin recom1:=common2.recom1(c); end;
+procedure term_ready(ready_status:boolean); begin common2.term_ready(ready_status); end;
+function getwindysize(wind:integer):integer; begin getwindysize:=common2.getwindysize(wind); end;
+procedure commandline(s:string); begin common2.commandline(s); end;
+procedure sclearwindow; begin common2.sclearwindow; end;
+procedure schangewindow(needcreate:boolean; newwind:integer);
+  begin common2.schangewindow(needcreate,newwind); end;
+procedure topscr; begin common2.topscr; end;
+procedure tleft; begin common2.tleft; end;
+procedure readinmacros; begin common2.readinmacros; end;
+procedure saveuf; begin common2.saveuf; end;
+
+procedure inu(var i:integer); begin common3.inu(i); end;
+procedure ini(var i:byte); begin common3.ini(i); end;
+procedure inputwn1(var v:string; l:integer; flags:string; var changed:boolean);
+  begin common3.inputwn1(v,l,flags,changed); end;
+procedure inputwn(var v:string; l:integer; var changed:boolean);
+  begin common3.inputwn(v,l,changed); end;
+procedure inputwnwc(var v:string; l:integer; var changed:boolean);
+  begin common3.inputwnwc(v,l,changed); end;
+procedure inputmain(var s:string; ml:integer; flags:string);
+  begin common3.inputmain(s,ml,flags); end;
+procedure inputwc(var s:string; ml:integer); begin common3.inputwc(s,ml); end;
+procedure input(var s:string; ml:integer); begin common3.input(s,ml); end;
+procedure inputl(var s:string; ml:integer); begin common3.inputl(s,ml); end;
+procedure inputcaps(var s:string; ml:integer);
+  begin common3.inputcaps(s,ml); end;
+procedure mmkey(var s:string); begin common3.mmkey(s); end;
+
+procedure com_flush_rx; begin tmpcom.com_flush_rx; end;
+function com_carrier:boolean; begin com_carrier:=tmpcom.com_carrier; end;
+function com_rx_empty:boolean; begin com_rx_empty:=tmpcom.com_rx_empty; end;
+procedure com_set_speed(speed:word); begin tmpcom.com_set_speed(speed); end;
+(*****************************************************************************)
+
+var cfilter:cfilterrec;
+    cfiltertype,cfilternum,cfiltercount:integer;
+
+procedure shelldos(bat:boolean; cl:string; var rcode:integer);
+var t:text;
+    s:string;
+    i,speed:integer;
+    emsswap:boolean;
+begin
+  nosound;
+  if (bat) then begin
+    assign(t,'tgtempx.bat'); rewrite(t);
+    writeln(t,cl);
+    close(t);
+    cl:='tgtempx.bat';
+  end;
+  if (cl<>'') then cl:='/c '+cl;    { if '', just a local shell to DOS }
+
+  s:=^M^J+#27+'[0m';
+  for i:=1 to length(s) do dosansi(s[i]);
+
+  remove_port;
+
+  emsswap:=FALSE;
+  if (systat.swapshell) then
+    if (initexecswap2(heapptr,systat.swappath+'TGSWAP.$$$')) then
+      emsswap:=TRUE;
+  swapvectors;
+  if (not emsswap) then exec(getenv('COMSPEC'),cl) else begin
+    textcolor(7); writeln('Swapping...');
+    if (execwithswap2(getenv('COMSPEC'),cl)<>0) then begin
+      writeln('Cannot swap, performing normal execution');
+      exec(getenv('COMSPEC'),cl);
+    end else shutdownexecswap2;
+  end;
+  swapvectors;
+
+  rcode:=lo(dosexitcode);
+  if (bat) then begin
+    assign(t,'tgtempx.bat');
+    {$I-} erase(t); {$I+}
+    if (ioresult<>0) then ;
+  end;
+  if (spd='KB') then speed:=modemr.waitbaud else speed:=value(spd);
+  iport; {  installint(modemr.comport);}
+  openport(modemr.comport,speed,'N',8,1);
+end;
+
+procedure sysopstatus;
+begin
+	if (sysop) then begin
+		nl;
+		printf('SYSOPIN');
+		if (nofile) then sprint(fstring.sysopin);
+	end else begin
+		nl;
+		printf('SYSOPOUT');
+		if (nofile) then sprint(fstring.sysopout);
+	end;
+end;
+
+
+procedure DisableInterrupts;
+begin
+{rcg11172000 not needed under Linux.}
+(*
+  inline($FA);  {cli}
+*)
+end;
+
+procedure EnableInterrupts;
+begin
+{rcg11172000 not needed under Linux.}
+(*
+  inline($FB);  {sti}
+*)
+end;
+
+procedure autovalidate(var u:userrec; un:integer);
+var settings:set of uflags;
+    b:boolean;
+begin
+  settings:=[rlogon,rchat,rvalidate,rbackspace,ramsg,rpostan,rpost,remail,
+             rvoting,rmsg,fnodlratio,fnopostratio,fnofilepts,fnodeletion];
+  with u do begin
+    if (un=usernum) then begin
+      realsl:=sl; realdsl:=dsl;
+      newcomptables;
+    end;
+    sl:=systat.autosl; dsl:=systat.autodsl;
+    ac:=ac-settings;
+    ac:=ac+(systat.autoac*settings);
+      (* do NOT modify user's personal settings, such as ANSI, color, etc.. *)
+    ar:=systat.autoar;
+    tltoday:=systat.timeallow[sl];
+  end;
+end;
+
+procedure rsm;
+var x:smr;
+    i:integer;
+begin
+  {$I-} reset(smf); {$I+}
+  if ioresult=0 then begin
+    i:=0; cl(1);
+    repeat
+      if (i<=filesize(smf)-1) then begin seek(smf,i); read(smf,x);
+      end;
+      while (i<filesize(smf)-1) and (x.destin<>usernum) do begin
+        inc(i);
+        seek(smf,i); read(smf,x);
+      end;
+      if (x.destin=usernum) and (i<=filesize(smf)-1) then begin
+        print(x.msg);
+        seek(smf,i); x.destin:=-1; write(smf,x);
+        smread:=TRUE;
+      end;
+      inc(i);
+    until (i>filesize(smf)-1) or hangup;
+    close(smf);
+    cl(1);
+  end;
+end;
+
+function lenn(s:string):integer;
+var i,len:integer;
+begin
+  len:=length(s); i:=1;
+  while (i<=length(s)) do begin
+    if (s[i] in [#3,'^']) then
+      if (i<length(s)) then begin dec(len,2); inc(i); end;
+    inc(i);
+  end;
+  lenn:=len;
+end;
+
+function lennmci(s:string):integer;
+var i,len:integer;
+    lastco,lastmci:boolean;
+begin
+  len:=length(s);
+  lastco:=FALSE; lastmci:=FALSE;
+  for i:=1 to length(s) do
+    if (not lastco) and (not lastmci) then
+      case s[i] of
+        #3,'^':if (not lastco) and (i<>length(s)) then lastco:=TRUE;
+        '@':if (not lastmci) and (i<>length(s)) then lastmci:=TRUE;
+      end
+    else begin
+      if (lastco) then
+        if s[i] in [#0..#9,'0'..'9'] then begin
+          dec(len,2);
+          lastco:=FALSE;
+        end;
+      if (lastmci) then begin
+        dec(len,2);
+        inc(len,lennmci(smci(s[i])));
+        lastmci:=FALSE;
+      end;
+    end;
+  lennmci:=len;
+end;
+
+procedure loaduboard(i:integer);
+var ulfo:boolean;
+begin
+  if (readuboard<>i) then begin
+    ulfo:=(filerec(ulf).mode<>fmclosed);
+    if (not ulfo) then reset(ulf);
+    if ((i>=0) and (i<=filesize(ulf)-1)) then begin
+      seek(ulf,i);
+      read(ulf,memuboard);
+    end else
+      memuboard:=tempuboard;
+    readuboard:=i;
+    if (not ulfo) then close(ulf);
+  end;
+end;
+
+procedure loadboard(i:integer);
+var bfo:boolean;
+begin
+  if (readboard<>i) then begin
+    bfo:=(filerec(bf).mode<>fmclosed);
+    if (not bfo) then reset(bf);
+    if ((i-1<0) or (i-1>filesize(bf)-1)) then i:=1;
+    seek(bf,i-1); read(bf,memboard);
+    readboard:=i;
+    if (not bfo) then close(bf);
+  end;
+end;
+
+procedure lcmds(len,c:byte; c1,c2:string);
+var s:string;
+begin
+  s:=copy(c1,2,lenn(c1)-1);
+  if (c2<>'') then s:=mln(s,len-1);
+  sprompt(#3#1+'('+#3+chr(c)+c1[1]+#3#1+')'+s);
+  if (c2<>'') then sprompt(#3#1+'('+#3+chr(c)+c2[1]+#3#1+')'+copy(c2,2,lenn(c2)-1));
+  nl;
+end;
+
+procedure tc(n:integer);
+begin
+  textcolor(n);
+end;
+
+function mso:boolean;
+var i:byte;
+    b:boolean;
+begin
+  b:=FALSE;
+  for i:=1 to 5 do
+    if (board=thisuser.boardsysop[i]) then b:=TRUE;
+  mso:=((cso) or (aacs(systat.msop)) or (b));
+end;
+
+function fso:boolean;
+begin
+  fso:=((cso) or (aacs(systat.fsop)));
+end;
+
+function cso:boolean;
+begin
+  cso:=((so) or (aacs(systat.csop)));
+end;
+
+function so:boolean;
+begin
+  so:=(aacs(systat.sop));
+end;
+
+function timer:real;
+var r:registers;
+    h,m,s,t:real;
+begin
+  r.ax:=44*256;
+  msdos(dos.registers(r));
+  h:=(r.cx div 256); m:=(r.cx mod 256); s:=(r.dx div 256); t:=(r.dx mod 256);
+  timer:=h*3600+m*60+s+t/100;
+end;
+
+function fbaseac(b:byte):boolean;
+begin
+  fbaseac:=FALSE;
+  if ((b<0) or (b>maxulb)) then exit;
+  loaduboard(b);
+  fbaseac:=aacs(memuboard.acs);
+end;
+
+function mbaseac(nb:integer):boolean;
+begin
+  mbaseac:=FALSE;
+  if ((nb<1) or (nb>numboards)) then exit;
+  loadboard(nb);
+  mbaseac:=aacs(memboard.acs);
+end;
+
+procedure changefileboard(b:integer);
+var s:string[20];
+    go:boolean;
+begin
+  go:=FALSE;
+  if (b>=0) and (b<=maxulb) then
+    if (fbaseac(b)) then { fbaseac loads memuboard itself ... }
+      if (memuboard.password='') then go:=TRUE
+      else begin
+        nl; sprint('File base '+cstr(ccuboards[1][b])+': '+
+                   #3#5+memuboard.name);
+        prt('Password? '); mpl(20); input(s,20);
+        if (s=memuboard.password) then go:=TRUE else print('Wrong.');
+      end;
+  if (go) then begin fileboard:=b; thisuser.lastfil:=fileboard; end;
+end;
+
+procedure changeboard(b:integer);
+var s:string[20];
+    go:boolean;
+begin
+  go:=FALSE;
+  if (b>=1) and (b<=numboards) then
+    if (mbaseac(b)) then { mbaseac loads memboard itself ... }
+      if (memboard.password='') then go:=TRUE
+      else begin
+        nl; sprint('Message base '+cstr(ccboards[1][b])+': '+
+                   #3#5+memboard.name);
+        prt('Enter thy Password? '); mpl(20); input(s,20);
+        if (s=memboard.password) then go:=TRUE else print('Wrong.');
+      end;
+  if (go) then begin board:=b; thisuser.lastmsg:=board; end;
+end;
+
+function freek(d:integer):longint;
+var lng:longint;
+begin
+  lng:=diskfree(d);
+  freek:=lng div 1024;
+end;
+
+function nma:integer;
+begin
+  nma:=thisuser.tltoday;
+end;
+
+function okansi:boolean;
+begin
+  okansi:=((ansi in thisuser.ac) or (avatar in thisuser.ac));
+end;
+
+function okavatar:boolean;
+begin
+  okavatar:=((avatar in thisuser.ac) and (not mtcolors));
+end;
+
+function nsl:real;
+var ddt,dt:datetimerec;
+    beenon:real;
+begin
+  if ((useron) or (not inwfcmenu)) then begin
+    getdatetime(dt);
+    timediff(ddt,timeon,dt);
+    beenon:=dt2r(ddt);
+    nsl:=((nma*60.0+extratime+freetime)-(beenon+choptime));
+  end else
+    nsl:=3600.0
+end;
+
+procedure checkhangup;
+begin
+  if (not com_carrier) then
+    if ((outcom) and (not hangup)) then begin
+      hangup:=TRUE; hungup:=TRUE;
+    end;
+end;
+
+function waitackfile(s:string):boolean;
+var rl:real;
+begin
+  pr1(^T+'f'+s+';');
+  rl:=timer;
+  waitackfile:=TRUE;
+  repeat
+    if (not com_rx_empty) then
+      case com_rx of
+        #6:exit;                                  { ACK }
+        #21:begin waitackfile:=FALSE; exit; end;  { NAK }
+      end;
+  until (timer-rl>10.0);
+  waitackfile:=FALSE;
+end;
+
+procedure sendfilep(s:string);
+var f:file of char;
+    ps:string[67];
+    ns:string[8];
+    es:string[4];
+    c:char;
+begin
+  assign(f,s);
+  {$I-} reset(f); {$I+}
+  if (ioresult<>0) then begin
+    pr('');
+    pr('"'+s+'": File not found.');
+    pr('');
+  end else begin
+    fsplit(s,ps,ns,es);
+    if (waitackfile(ns+es)) then begin
+      while (not eof(f)) do begin read(f,c); com_tx(c); end;
+      pr1(^Z^Z^Z);
+    end;
+    close(f);
+  end;
+end;
+
+procedure handlempcode(var ccc:char);
+var tf:file of tfilerec;
+    temptfilebase:tfilerec;
+    tempboard:boardrec;
+    s:string;
+    i,j:integer;
+    mc:array[1..6] of char;
+    bfo,ulfo:boolean;
+begin
+  if (not mpcoder) then exit;
+  ccc:=#0;
+  for i:=1 to 6 do mc[i]:=chr(mpcode[i]);
+  case chr(mpcode[1]) of
+    'r':begin
+          if (mc[2]+mc[3]='mt') then mtcolors:=(mc[4]='1');
+        end;
+    '*':begin
+          if (mc[2]+mc[3]='li') then
+            case mc[4] of
+              'b':begin
+                    pr('');
+                    bfo:=(filerec(bf).mode<>fmclosed);
+                    if (not bfo) then reset(bf);
+                    i:=1;
+                    with tempboard do
+                      while (not eof(bf)) do begin
+                        read(bf,tempboard);
+                        s:=aonoff(aacs(acs),' ','*')+mn(i,3)+':'+
+                           mln(stripcolor(name),40)+':'+acs+'/'+password;
+                        pr1(s+^M^J);
+                        inc(i);
+                      end;
+                    pr('');
+                    if (not bfo) then close(bf);
+                  end;
+              'f':begin
+                    pr('');
+                    ulfo:=(filerec(ulf).mode<>fmclosed);
+                    if (not ulfo) then reset(ulf);
+                    i:=1;
+                    with tempuboard do
+                      while (not eof(ulf)) do begin
+                        read(ulf,tempuboard);
+                        s:=aonoff(aacs(acs),' ','*')+mn(i,3)+':'+
+                           mln(stripcolor(name),40)+':'+acs+'/'+password;
+                        pr1(s+^M^J);
+                        inc(i);
+                      end;
+                    pr('');
+                    if (not ulfo) then close(ulf);
+                  end;
+              'r':sendfilep(start_dir+'\err.log');
+              't':begin
+                    pr('');
+                    assign(tf,systat.gfilepath+'gfiles.dat');
+                    {$I-} reset(tf); {$I+}
+                    i:=1;
+                    read(tf,temptfilebase); j:=temptfilebase.gdaten;
+                    with temptfilebase do
+                      while ((not eof(tf)) and (i<j)) do begin
+                        read(tf,temptfilebase);
+                        s:=aonoff(aacs(acs),' ','*')+mn(i,3)+':'+
+                           mln(filen,12)+':'+mln(stripcolor(title),40)+':'+
+                           acs+'/'+gdate;
+                        pr1(s+^M^J);
+                        inc(i);
+                      end;
+                    pr('');
+                    close(tf);
+                  end;
+            end;
+        end;
+  end;
+(*  write('(<-'); for i:=1 to 6 do write(chr(mpcode[i])); write('->)');*)
+  mpcoder:=FALSE;
+end;
+
+function ccinkey1:char;
+var tar:array[1..20] of char;
+    rl:real;
+    tarc:integer;
+    c:char;
+begin
+  if (recom1(c)) then begin
+    ccinkey1:=c;
+    if ((c=^A) and (not trm)) then begin
+      tarc:=1; tar[1]:=^B;
+      rl:=timer;
+      repeat
+        if (recom1(c)) then begin tar[tarc]:=c; inc(tarc); end;
+      until ((timer-rl>2.0) or (tarc>11) or (tar[1]<>^B));
+{      commandline('<<'+tar[3]+tar[4]+tar[5]+tar[6]+tar[7]+tar[8]+'>>');}
+      if (tarc>11) then begin
+        mpcoder:=(tar[1]+tar[2]+tar[9]+tar[10]+tar[11]=^B^A+#253+#254+#255);
+        if (mpcoder) then begin
+          for tarc:=1 to 6 do mpcode[tarc]:=ord(tar[tarc+2]);
+          handlempcode(c); ccinkey1:=#0;
+        end;
+      end;
+    end;
+  end else
+    ccinkey1:=#0;
+end;
+
+function cinkey1:char;
+var rl:real;
+    c:char;
+begin
+  cinkey1:=ccinkey1;
+(*  if (recom1(c)) then begin
+    cinkey1:=c;
+    if ((c=^A) and (not trm)) then begin
+      rl:=timer;
+      repeat until ((timer-rl>2.0) or (mpcoder));
+      if (mpcoder) then begin handlempcode(c); cinkey1:=#0; end;
+    end;
+  end else
+    cinkey1:=#0;*)
+end;
+
+function cinkey:char;
+begin
+  cinkey:=cinkey1;
+end;
+
+procedure o(c:char);
+begin
+  if ((outcom) and (not trm) and (c<>#1)) then sendcom1(c);
+end;
+
+function intime(tim:real; tim1,tim2:integer):boolean;
+(* "tim" is seconds (timer) time; tim1/tim2 are minutes time. *)
+begin
+  intime:=TRUE;
+  while (tim>=24.0*60.0*60.0) do tim:=tim-24.0*60.0*60.0;
+  if (tim1<>tim2) then
+    if (tim2>tim1) then
+      if (tim<=tim1*60.0) or (tim>=tim2*60.0) then
+        intime:=FALSE
+      else
+    else
+      if (tim<=tim1*60.0) and (tim>=tim2*60.0) then
+        intime:=FALSE;
+end;
+
+function sysop1:boolean;
+{rcg11172000 ?!}
+{
+var a:byte absolute $0000:$0417;
+begin
+  if (a and 16)=0 then sysop1:=TRUE else sysop1:=FALSE;
+end;
+}
+begin
+   writeln('STUB: common.pas; sysop1()...');
+   sysop1 := FALSE;
+end;
+
+
+function sysop:boolean;
+var s:boolean;
+begin
+  s:=sysop1;
+{  if (systat.lowtime=systat.hitime) then s:=FALSE;}
+  if (not intime(timer,systat.lowtime,systat.hitime)) then s:=FALSE;
+  if (rchat in thisuser.ac) then s:=FALSE;
+  sysop:=s;
+end;
+
+procedure opensysopf;
+begin
+  assign(sysopf,systat.trappath+'sysop.log');
+  {$I-} append(sysopf); {$I+}
+  if (ioresult<>0) then begin
+    rewrite(sysopf);
+    append(sysopf);
+  end;
+end;
+
+function stripcolor(o:string):string;
+var s:string;
+    i:integer;
+    lc:boolean;
+begin
+  s:=''; lc:=FALSE;
+  for i:=1 to length(o) do
+    if (lc) then lc:=FALSE
+      else if ((o[i]=#3) or (o[i]='^')) then lc:=TRUE else s:=s+o[i];
+  stripcolor:=s;
+end;
+
+procedure sl1(s:string);
+begin
+  if (slogging) then begin
+    if (systat.stripclog) then s:=stripcolor(s);
+    if (systat.slogtype in [0,1]) then begin
+      if (textrec(sysopf).mode<>fmoutput) then opensysopf;
+      writeln(sysopf,s);
+    end;
+    if ((thisuser.slogseperate) and (textrec(sysopf1).mode=fmoutput)) then
+      writeln(sysopf1,s);
+
+    if (systat.slogtype in [1,2]) then begin
+      if (not systat.stripclog) then s:=stripcolor(s);
+      writeln(lst,s);
+    end;
+  end;
+end;
+
+procedure sysoplog(s:string);
+begin
+  sl1('   '+s);
+end;
+
+function tch(s:string):string;
+begin
+  if (length(s)>2) then s:=copy(s,length(s)-1,2) else
+    if (length(s)=1) then s:='0'+s;
+  tch:=s;
+end;
+
+function time:string;
+var h,m,s:string[3];
+    hh,mm,ss,ss100:word;
+begin
+  gettime(hh,mm,ss,ss100);
+  str(hh,h); str(mm,m); str(ss,s);
+  time:=tch(h)+':'+tch(m)+':'+tch(s);
+end;
+
+function date:string;
+var r:registers;
+    y,m,d:string[3];
+    yy,mm,dd,dow:word;
+begin
+  getdate(yy,mm,dd,dow);
+  str(yy-1900,y); str(mm,m); str(dd,d);
+  date:=tch(m)+'/'+tch(d)+'/'+tch(y);
+end;
+
+function value(s:string):longint;
+var i:longint;
+    j:integer;
+begin
+  val(s,i,j);
+  if (j<>0) then begin
+    s:=copy(s,1,j-1);
+    val(s,i,j)
+  end;
+  value:=i;
+  if (s='') then value:=0;
+end;
+
+function cstr(i:longint):string;
+var c:string[16];
+begin
+  str(i,c);
+  cstr:=c;
+end;
+
+function nam:string;
+begin
+  nam:=caps(thisuser.name)+' #'+cstr(usernum);
+end;
+
+function ageuser(bday:string):integer;
+var i:integer;
+begin
+  i:=value(copy(date,7,2))-value(copy(bday,7,2));
+  if (daynum(copy(bday,1,6)+copy(date,7,2))>daynum(date)) then dec(i);
+  ageuser:=i;
+end;
+
+function allcaps(s:string):string;
+var i:integer;
+begin
+  for i:=1 to length(s) do s[i]:=upcase(s[i]);
+  allcaps:=s;
+end;
+
+function caps(s:string):string;
+var i:integer;
+begin
+  for i:=1 to length(s) do
+    if (s[i] in ['A'..'Z']) then s[i]:=chr(ord(s[i])+32);
+  for i:=1 to length(s) do
+    if (not (s[i] in ['A'..'Z','a'..'z'])) then
+      if (s[i+1] in ['a'..'z']) then s[i+1]:=upcase(s[i+1]);
+  s[1]:=upcase(s[1]);
+  caps:=s;
+end;
+
+function leapyear(yr:integer):boolean;
+begin
+  leapyear:=(yr mod 4=0) and ((yr mod 100<>0) or (yr mod 400=0));
+end;
+
+function days(mo,yr:integer):integer;
+var d:integer;
+begin
+  d:=value(copy('312831303130313130313031',1+(mo-1)*2,2));
+  if ((mo=2) and (leapyear(yr))) then inc(d);
+  days:=d;
+end;
+
+function daycount(mo,yr:integer):integer;
+var m,t:integer;
+begin
+  t:=0;
+  for m:=1 to (mo-1) do t:=t+days(m,yr);
+  daycount:=t;
+end;
+
+function daynum(dt:string):integer;
+var d,m,y,t,c:integer;
+begin
+  t:=0;
+  m:=value(copy(dt,1,2));
+  d:=value(copy(dt,4,2));
+  y:=value(copy(dt,7,2))+1900;
+  for c:=1985 to y-1 do
+    if (leapyear(c)) then inc(t,366) else inc(t,365);
+  t:=t+daycount(m,y)+(d-1);
+  daynum:=t;
+  if y<1985 then daynum:=0;
+end;
+
+function dat:string;
+const mon:array [1..12] of string[3] =
+          ('Jan','Feb','Mar','Apr','May','Jun',
+           'Jul','Aug','Sep','Oct','Nov','Dec');
+var ap,x,y:string; i:integer;
+    year,month,day,dayofweek,hour,minute,second,sec100:word;
+begin
+  getdate(year,month,day,dayofweek);
+  gettime(hour,minute,second,sec100);
+
+  if (hour<12) then ap:='am'
+  else begin
+    ap:='pm';
+    if (hour>12) then dec(hour,12);
+  end;
+  if (hour=0) then hour:=12;
+
+  dat:=cstr(hour)+':'+tch(cstr(minute))+' '+ap+'  '+
+       copy('SunMonTueWedThuFriSat',dayofweek*3+1,3)+' '+
+       mon[month]+' '+cstr(day)+', '+cstr(year);
+(*  5:43 pm  Fri Jul 28, 1989  *)
+
+(*
+  ap:=date;
+  y:=mon[value(copy(ap,1,2))];
+  x:=x+' '+y+' '+copy(ap,4,2)+', '+cstr(1900+value(copy(ap,7,2)));
+  y:=time; i:=value(copy(y,1,2));
+  if i>11 then ap:='pm' else ap:='am';
+  if i>12 then i:=i-12;
+  if i=0 then i:=12;
+  dat:=cstr(i)+copy(y,3,3)+' '+ap+'  '+x;
+*)
+end;
+
+procedure pr1(s:string);
+var i:integer;
+begin
+  for i:=1 to length(s) do sendcom1(s[i]);
+end;
+
+procedure pr(s:string);
+begin
+  pr1(s+#13);
+end;
+
+procedure scc;    {* make local textcolor( = curco *}
+var f:integer;
+begin
+  if (okansi) then begin
+    f:=curco and 7;
+    if (curco and 8)<>0 then inc(f,8);
+    if (curco and 128)<>0 then inc(f,16);
+    tc(f);
+    textbackground((curco shr 4) and 7);
+  end;
+end;
+
+procedure sde; { restore curco colors (DOS and tc) loc. after local }
+var c:byte;
+    b:boolean;
+begin
+  if (okansi) then begin
+    c:=curco; curco:=255-curco;
+    b:=outcom; outcom:=FALSE;
+    setc(c);
+    outcom:=b;
+  end;
+end;
+
+procedure sdc; { restore curco colors (DOS and tc) loc/rem after loc/rem }
+var c:byte;
+begin
+  if (okansi) then begin
+    c:=curco; curco:=255-curco;
+    setc(c);
+  end;
+end;
+
+procedure stsc;
+begin
+  tc(11); textbackground(0);
+end;
+
+function getc(c:byte):string;
+const xclr:array[0..7] of char=('0','4','2','6','1','5','3','7');
+var s:string;
+    b:boolean;
+
+  procedure adto(ss:string);
+  begin
+    if (s[length(s)]<>';') and (s[length(s)]<>'[') then s:=s+';';
+    s:=s+ss; b:=TRUE;
+  end;
+
+begin
+  b:=FALSE;
+  if ((curco and (not c)) and $88)<>0 then begin
+    s:=#27+'[0';
+    curco:=$07;
+  end else
+    s:=#27+'[';
+  if (c and 7<>curco and 7) then adto('3'+xclr[c and 7]);
+  if (c and $70<>curco and $70) then adto('4'+xclr[(c shr 4) and 7]);
+  if (c and 128<>0) then adto('5');
+  if (c and 8<>0) then adto('1');
+  if (not b) then adto('3'+xclr[c and 7]);
+  s:=s+'m';
+  getc:=s;
+end;
+
+procedure omtcolor(c:byte);
+const color:array[0..15] of byte=($00,$04,$02,$06,$01,$05,$03,$07,
+                                  $08,$0C,$0A,$0E,$09,$0D,$0B,$0F);
+var c1:byte;
+begin
+  if (mtcolors) then begin
+    if (c and $70=0) then pr1(^T+chr(c or $70)) else pr1(^T+'C'+chr(c));
+  end else begin
+    if (thisuser.avadjust=2) then begin
+      c1:=color[c and $0F]+(color[(c and $70) shr 4] shl 4);
+      if (c and $80<>0) then c1:=c1 or $80;
+      pr1(^V^A+chr(c1));
+    end else pr1(^V^A+chr(c and $7F));
+    if (c and $80<>0) then pr1(^V^B);
+  end;
+end;
+
+procedure setc(c:byte);
+var s:string;
+    i:integer;
+begin
+  if ((c<>curco) or (dosansion)) then begin
+    s:=getc(c); curco:=c;
+    if (okansi) then begin
+      if (outcom) then
+        if ((okavatar) or (mtcolors)) then omtcolor(c) else pr1(s);
+      if (wantout) then begin
+        textattr:=c;
+        if (dosansion) then begin
+          s:=#27+'[0;'+copy(s,3,length(s)-2);
+          for i:=1 to length(s) do dosansi(s[i]);
+        end;
+      end;
+    end;
+    scc;
+  end;
+end;
+
+procedure cl(c:integer);
+begin
+  if (c in [0..9]) then
+    if (okansi) then
+      setc(thisuser.cols[(color in thisuser.ac)][c]);
+end;
+
+function sqoutsp(s:string):string;
+begin
+  while (pos(' ',s)>0) do delete(s,pos(' ',s),1);
+  sqoutsp:=s;
+end;
+
+function exdrv(s:string):byte;
+begin
+  s:=fexpand(s);
+  exdrv:=ord(s[1])-64;
+end;
+
+function mlnnomci(s:string; l:integer):string;
+begin
+  while (length(s)<l) do s:=s+' ';
+  if (length(s)>l) then
+    repeat s:=copy(s,1,length(s)-1) until (length(s)=l) or (length(s)=0);
+  mlnnomci:=s;
+end;
+
+function mlnmci(s:string; l:integer):string;
+begin
+  while (lennmci(s)<l) do s:=s+' ';
+  if (lennmci(s)>l) then
+    repeat s:=copy(s,1,length(s)-1) until (lennmci(s)=l) or (length(s)=0);
+  mlnmci:=s;
+end;
+
+function mln(s:string; l:integer):string;
+begin
+  while (lenn(s)<l) do s:=s+' ';
+  if (lenn(s)>l) then
+    repeat s:=copy(s,1,length(s)-1) until (lenn(s)=l) or (length(s)=0);
+  mln:=s;
+end;
+
+function mrn(s:string; l:integer):string;
+begin
+  while lenn(s)<l do s:=' '+s;
+  if lenn(s)>l then s:=copy(s,1,l);
+  mrn:=s;
+end;
+
+function mn(i,l:longint):string;
+begin
+  mn:=mln(cstr(i),l);
+end;
+
+(*
+procedure cjp;
+begin
+  if ((not ch) and (not write_msg) and (not reading_a_msg)) then cl(1);
+end;
+
+procedure docc(c:char);
+begin
+  case c of
+    ^H:if (pap>0) then dec(pap);
+    ^L:begin
+         lil:=0;
+         clrscr;
+       end;
+    ^M:pap:=0;
+    ^J:begin
+         inc(lil);
+         if (lil>=thisuser.pagelen-1) then begin
+           lil:=0;
+           if (pause in thisuser.ac) then pausescr;
+         end;
+       end;
+  end;
+end;
+
+procedure promptc(c:char);
+begin
+  if (c=^J) then cjp;
+  if (wantout) then
+    if (((c<>^G) or (not incom)) and (not (c in [#1,^L]))) then
+{      write(c);}
+      write(c);
+{  if (trapping) then if (c<>^G) then write(trapfile,c);}
+  if (outcom) then sendcom1(c);
+  if ((c>=#32) and (c<=#255)) then inc(pap) else docc(c);
+end;
+*)
+
+procedure dosansi(c:char);
+var r:registers;
+begin
+  with r do begin
+    dx:=ord(c); ax:=$0200;
+    msdos(r);
+  end;
+end;
+
+procedure lpromptc(c:char);
+var ss:string;
+    bb:byte;
+begin
+  if (c=^G) then exit;
+  case c of
+    ^H:if (pap>0) then dec(pap);
+    ^J:begin
+         if ((not ch) and (not write_msg) and (not reading_a_msg)) then
+           if ((not ctrljoff) and (not dosansion)) then begin
+             bb:=thisuser.cols[color in thisuser.ac][1];
+             if ((outcom) and (okansi)) then
+               if ((okavatar) or (mtcolors)) then omtcolor(bb) else pr1(getc(bb));
+             curco:=bb; textattr:=bb;
+           end else
+             lil:=0;
+         if (wantout) then write(^J);
+         inc(lil);
+         if (lil>=thisuser.pagelen-1) then begin
+           lil:=0;
+           if (pause in thisuser.ac) then pausescr;
+         end;
+         exit;
+       end;
+    ^L:lil:=0;
+    ^M:pap:=0;
+    ^[:dosansion:=TRUE;
+  end;
+  if (wantout) then if (not dosansion) then write(c) else dosansi(c);
+end;
+
+procedure prompt(s:string);
+var s1,s2:string;
+    i:integer;
+    bb:byte;
+begin
+  checkhangup;
+  if (hangup) then exit;
+  if (outcom) then begin
+    s1:=s;
+    while (pos(^J,s1)<>0) do begin
+      i:=pos(^J,s1);
+      s2:=copy(s,1,i-1); s1:=copy(s1,i+1,length(s1)-i);
+      for i:=1 to length(s2) do sendcom1(s2[i]);
+      if ((not ch) and (not write_msg) and (not reading_a_msg)) then
+        if (not ctrljoff) then begin
+          bb:=thisuser.cols[color in thisuser.ac][1];
+          if (okansi) then
+            if ((okavatar) or (mtcolors)) then omtcolor(bb) else pr1(getc(bb));
+          curco:=bb;
+        end else
+          lil:=0;
+      sendcom1(^J);
+    end;
+    for i:=1 to length(s1) do sendcom1(s1[i]);
+  end;
+  for i:=1 to length(s) do lpromptc(s[i]);
+  if (trapping) then
+    if (copy(s,length(s)-1,2)=^M^J) then
+      writeln(trapfile,copy(s,1,length(s)-2))
+    else
+      write(trapfile,s);
+end;
+
+procedure print(s:string);
+begin
+  prompt(s+^M^J);
+end;
+
+procedure nl;
+begin
+  prompt(^M^J);
+end;
+
+procedure prt(s:string);
+begin
+  cl(4); sprompt(s); cl(3);
+end;
+
+procedure ynq(s:string);
+begin
+  cl(7); sprompt(s); cl(3);
+end;
+
+procedure mpl(c:integer);
+var i,x:integer;
+begin
+  if (okansi) then begin
+    cl(6);
+    x:=wherex;
+    if (outcom) then for i:=1 to c do sendcom1(' ');
+    if (wantout) then for i:=1 to c do write(' ');
+    gotoxy(x,wherey);
+    if (outcom) then begin
+      if (okavatar) then pr1(^Y+^H+chr(c)) else pr1(#27+'['+cstr(c)+'D');
+    end;
+  end;
+  dec(pap,c);
+end;
+
+function smci(c:char):string;
+var s,dum:string;
+    i:integer;
+begin
+  dum:=nam;
+  case upcase(c) of
+    'A':s:=cstr(ccboards[1][board]);
+    'B':begin
+          loadboard(board);
+          s:=#3#5+memboard.name;
+        end;
+    'C':s:=cstr(ccuboards[1][fileboard]);
+    'D':begin
+          loaduboard(fileboard);
+          s:=#3#5+memuboard.name;
+          if (fbnoratio in memuboard.fbstat) then s:=s+#3#5+' <NR>';
+        end;
+    'F':s:=copy(thisuser.realname,1,pos(' ',thisuser.realname)-1);
+    'G':if (sysop) then begin
+		nl;
+		printf('SYSOPIN');
+		if (nofile) then s:=(fstring.sysopin);
+	end else begin
+		nl;
+		printf('SYSOPOUT');
+		if (nofile) then s:=fstring.sysopout;
+                end;
+    'H':s:=copy(dum,1,pos('#',dum)-2);
+    'K':begin
+          loaduboard(fileboard);
+          s:=cstrl(freek(exdrv(memuboard.ulpath)));
+        end;
+    'L':begin
+          dum:=caps(thisuser.realname);
+          i:=length(dum);
+          while ((dum[i]<>' ') and (i>1)) do begin
+            s:=copy(dum,i,(length(dum)-i)+1);
+            dec(i);
+          end;
+        end;
+    'M':s:=^M^J;
+    'N':s:=dum;
+    'P':s:=cstr(thisuser.filepoints);
+    'R':s:=thisuser.realname;
+    'T':s:=tlef;
+    'U':s:=cstr(msg_on);
+    'V':s:=cmdlist;
+    'W':s:=cstr(himsg+1);
+    'X':begin
+          if (cso) then i:=systat.csmaxlines else i:=systat.maxlines;
+          s:=cstr(i);
+        end;
+    'Y':begin
+          loadboard(board);
+          s:=#3#5+memboard.name+#3#5+' #'+cstr(ccboards[1][board]);
+        end;
+    'Z':s:=chatr;
+  else
+        s:='@'+c;
+  end;
+  smci:=s;
+end;
+
+{rcg11172000 had to change this to get it compiling under Free Pascal...}
+{function substone(src,old,new:string):string;}
+function substone(src,old,_new:string):string;
+var p:integer;
+begin
+  if (old<>'') then begin
+    p:=pos(old,allcaps(src));
+    if (p>0) then begin
+      insert(_new,src,p+length(old));
+      delete(src,p,length(old));
+    end;
+  end;
+  substone:=src;
+end;
+
+procedure sprompt(s:string);
+var ss,sss:string;
+    i,p1,p2,x,z:integer;
+    c,mc:char;
+    xx,b:boolean;
+begin
+  checkhangup;
+  if (hangup) then exit;
+  ss:=s; sss:='';
+  b:=FALSE;
+  if (pos('@',ss)<>0) then begin
+    for c:='A' to 'Z' do
+      while (pos('@'+c,allcaps(ss))<>0) do begin
+        ss:=substone(ss,'@'+c,smci(c));
+        b:=TRUE;
+      end;
+    while ((pos('@',ss)<>0) and (b)) do begin
+      for c:='A' to 'Z' do
+        while (pos('@'+c,allcaps(ss))<>0) do ss:=substone(ss,'@'+c,smci(c));
+      for i:=1 to length(ss)-1 do
+        if ((ss[i]='@') and (not (ss[i+1] in ['A'..'Z']))) then
+					ss[i]:=#28;
+			if (ss[length(ss)]='@') then ss[length(ss)]:=#28;
+    end;
+    for i:=1 to length(ss) do
+			if (ss[i]=#28) then ss[i]:='@';
+  end;
+
+  if (trapping) then write(trapfile,ss);
+  if (not okansi) then
+    ss:=stripcolor(ss)
+  else
+    while (ss<>'') and ((pos(#3,ss)<>0) or (pos('^',ss)<>0)) do begin
+      p1:=pos(#3,ss); if (p1=0) then p1:=500;
+      p2:=pos('^',ss); if (p2=0) then p2:=500;
+
+      if (p2<p1) then p1:=p2;
+
+      if (p1<>500) then begin
+        mc:=ss[p1+1]; sss:=copy(ss,1,p1-1);
+        ss:=copy(ss,p1+2,length(ss)-(p1+1));
+      end else begin
+        sss:=ss; ss:='';
+      end;
+
+      if (outcom) then
+        for i:=1 to length(sss) do sendcom1(sss[i]);
+      for i:=1 to length(sss) do lpromptc(sss[i]);
+
+      if ((mc>=#0) and (mc<=#9)) then cl(ord(mc)) else
+        if ((mc>='0') and (mc<='9')) then cl(ord(mc)-48);
+    {**** ADD @E SUPPORT *}
+
+    end;
+  if (outcom) then
+    for i:=1 to length(ss) do sendcom1(ss[i]);
+  for i:=1 to length(ss) do lpromptc(ss[i]);
+end;
+
+procedure sprint(s:string);
+begin
+  sprompt(s+'@M');
+end;
+
+procedure prestrict(u:userrec);
+var r:uflags;
+begin
+  for r:=rlogon to rmsg do
+    if (r in u.ac) then write(copy('LCVBA*PEKM',ord(r)+1,1)) else write('-');
+  writeln;
+end;
+
+function empty:boolean;
+var e:boolean;
+begin
+  e:=(not keypressed);
+  if ((incom) and (e)) then e:=(com_rx_empty);
+  if (hangup) then begin com_flush_rx; e:=TRUE; end;
+  empty:=e;
+end;
+
+function inkey:char;
+var c:char;
+begin
+  c:=#0; inkey:=#0;
+  checkhangup;
+  if (keypressed) then begin
+    c:=readkey;
+    if ((c=#0) and (keypressed)) then begin
+      c:=readkey;
+      skey1(c);
+      if (c=#68) then c:=#1 else c:=#0;
+      if (buf<>'') then begin
+        c:=buf[1];
+        buf:=copy(buf,2,length(buf)-1);
+      end;
+    end;
+    inkey:=c;
+  end else
+    if (incom) then inkey:=cinkey;
+{      if ((async_buffer_head<>async_buffer_tail) and (incom)) then
+      inkey:=cinkey;}
+end;
+
+procedure outtrap(c:char);
+begin
+  if (c<>^G) then write(trapfile,c);
+end;
+
+procedure docc2(c:char);
+var i:integer;
+begin
+  case c of
+    ^G:if (outcom) then for i:=1 to 4 do sendcom1(#0);
+    ^J:begin
+         if (wantout) then write(^J);
+         inc(pap);
+       end;
+    ^L:begin
+         if (wantout) then clrscr;
+         lil:=0;
+       end;
+  end;
+end;
+
+procedure outkey(c:char);
+begin
+  if (c=#29) then exit;
+  if (not echo) then
+    if ((systat.localsec) and (c in [#32..#255])) then c:=fstring.echoc;
+  if (c=#27) then dosansion:=TRUE;
+  if (not (c in [^J,^L])) then
+    if (not ((c=^G) and (incom))) then
+      if ((c<>#0) and (not nopfile) and (wantout)) then
+        if (not dosansion) then write(c) else dosansi(c);
+  if ((not echo) and (c in [#32..#255])) then c:=fstring.echoc;
+  if (outcom) then sendcom1(c);
+  if (c<#32) then docc2(c);
+end;
+
+function checkeventday(i:integer; t:real):boolean;
+var s:string;
+    year,month,day,dayofweek:word;
+    e:integer;
+begin
+  checkeventday:=FALSE;
+  with events[i]^ do begin
+    getdate(year,month,day,dayofweek);
+    e:=0;
+    if (timer+t>=24.0*60.0*60.0) then begin
+      inc(dayofweek); e:=1;
+      if (dayofweek>6) then dayofweek:=0;
+    end;
+    if (monthly) then begin
+      if (value(copy(date,4,2))+e=execdays) then
+        checkeventday:=TRUE;
+    end else begin
+      if ((1 shl (6-dayofweek)) and execdays<>0) then
+        checkeventday:=TRUE;
+    end;
+  end;
+end;
+
+function checkpreeventtime(i:integer; t:real):boolean;
+begin
+  with events[i]^ do
+    if (busytime=0) then
+      checkpreeventtime:=FALSE
+    else
+      checkpreeventtime:=intime(timer+t,exectime-busytime,exectime);
+end;
+
+function checkeventtime(i:integer; t:real):boolean;
+begin
+  with events[i]^ do
+    if (duration=0) then
+      checkeventtime:=FALSE
+    else
+      checkeventtime:=intime(timer+t,exectime,exectime+duration);
+end;
+
+function checkevents(t:real):integer;
+var i:integer;
+begin
+  for i:=0 to numevents do
+    with events[i]^ do
+      if (active) then
+        if (checkeventday(i,t)) then begin
+          checkevents:=i;
+          if (checkpreeventtime(i,t)) or (checkeventtime(i,t)) then begin
+            if (etype in ['D','E','P']) then exit;
+            if ((etype='A') and (not aacs(execdata)) and (useron)) then exit;
+          end;
+        end;
+  checkevents:=0;
+end;
+
+procedure dm(i:string; var c:char);
+begin
+  buf:=i;
+  if (buf<>'') then begin
+    c:=buf[1];
+    buf:=copy(buf,2,length(buf)-1);
+  end;
+end;
+
+procedure doeventstuff;
+var s:string;
+    e,savpap:integer;
+    aaa:boolean;
+begin
+  case telluserevent of
+    0:begin
+        oltime:=timer;
+        e:=checkevents(systat.eventwarningtime);
+        if (e<>0) then begin
+          telluserevent:=1;
+          nl;
+          sysoplog('[> '+date+' '+time+' - Displayed "REVENT'+cstr(e)+'" in preparation for event #'+cstr(e));
+          savpap:=pap;
+          aaa:=allowabort; allowabort:=FALSE;
+          printf('revent'+cstr(e));
+          allowabort:=aaa;
+          if (nofile) then begin
+            nl; nl;
+            sprint(#3#8+^G'Warning: '+#3#5+'System event approaching.'^G);
+            sprint(#3#5+^G'System will be shut down in '+
+                    copy(ctim(systat.eventwarningtime),4,5)+' minutes.'^G);
+            nl; nl;
+          end;
+          pap:=savpap;
+        end else
+          if (checkevents(0)=0) then telluserevent:=0;
+      end;
+    1:begin
+        oltime:=timer;
+        e:=checkevents(0);
+        if (e<>0) then begin
+          telluserevent:=2;
+          sysoplog('[> '+date+' '+time+' - Logged user off in preparation for '+
+                   'event #'+cstr(e));
+          nl; nl; sprint(#3#8+^G'Shutting down for system events'^G); nl; nl;
+          hangup:=TRUE;
+        end;
+      end;
+  end;
+end;
+
+procedure getkey(var c:char);
+var dt,ddt:datetimerec;
+    aphase,e:integer;
+    abort,next,b,tf,t1,bufalready:boolean;
+begin
+  lil:=0; 
+  if (buf<>'') then begin
+    c:=buf[1];
+    buf:=copy(buf,2,length(buf)-1);
+  end else begin
+    if (not empty) then begin
+      if (ch) then c:=chinkey else c:=inkey;
+    end else begin
+      getdatetime(tim);
+      t1:=FALSE; tf:=FALSE;
+      c:=#0;
+      if (alert in thisuser.ac) then aphase:=1 else aphase:=0;
+      while ((c=#0) and (not hangup)) do begin
+        if (aphase<>0) then begin
+          case aphase of
+            1:begin sound(1000); delay(35); end;
+            2:begin sound(1500); delay(40); end;
+            3:begin sound(1900); delay(45); end;
+            4:begin sound(2300); delay(50); end;
+            5:begin sound(3400); delay(55); end;
+          end;
+          aphase:=aphase mod 5+1;
+        end;
+
+        if (ch) then c:=chinkey else c:=inkey;
+        getdatetime(dt);
+        timediff(ddt,tim,dt);
+        if (systat.timeout<>-1) and
+           (dt2r(ddt)>systat.timeout*60) and (c=#0) then begin
+          nl; nl;
+          printf('timedout');
+          if (nofile) then
+            print('Time out has occurred.  Log off time was at '+time+'.');
+          nl; nl;
+          hangup:=TRUE;
+          sysoplog(#3#7+'!*!*! Time-out at '+time+' !*!*!');
+        end;
+        if (systat.timeoutbell<>-1) and
+           (dt2r(ddt)>systat.timeoutbell*60) and (not tf) and (c=#0) then begin
+          tf:=TRUE;
+          outkey(^G); delay(100); outkey(^G);
+        end;
+        checkhangup;
+      end;
+      nosound;
+    end;
+  end;
+  if (checkit) then
+    if (ord(c) and 128>0) then checkit:=FALSE;
+  if (c<#32) then skey(c);
+end;
+
+procedure cls;
+begin
+  if (okansi) then begin
+    if (outcom) then begin
+      if (okavatar) then pr(^L) else pr(#27+'[2J');
+    end;
+    if (wantout) then clrscr;
+  end else
+    outkey(^L);
+  if (trapping) then writeln(trapfile,^L);
+  cl(1);
+  lil:=0;
+end;
+
+procedure swac(var u:userrec; r:uflags);
+begin
+  if (r in u.ac) then
+    u.ac:=u.ac-[r] else u.ac:=u.ac+[r];
+end;
+
+function tacch(c:char):uflags;
+begin
+  case c of
+    'L':tacch:=rlogon;
+    'C':tacch:=rchat;
+    'V':tacch:=rvalidate;
+    'B':tacch:=rbackspace;
+    'A':tacch:=ramsg;
+    '*':tacch:=rpostan;
+    'P':tacch:=rpost;
+    'E':tacch:=remail;
+    'K':tacch:=rvoting;
+    'M':tacch:=rmsg;
+    '1':tacch:=fnodlratio;
+    '2':tacch:=fnopostratio;
+    '3':tacch:=fnofilepts;
+    '4':tacch:=fnodeletion;
+  end;
+end;
+
+procedure acch(c:char; var u:userrec);
+begin
+  swac(u,tacch(c));
+end;
+
+function aonoff(b:boolean; s1,s2:string):string;
+begin
+  if (b) then aonoff:=s1 else aonoff:=s2;
+end;
+
+function onoff(b:boolean):string;
+begin
+  if (b) then onoff:='On ' else onoff:='Off';
+end;
+
+function syn(b:boolean):string;
+begin
+  if (b) then syn:='Yes' else syn:='No ';
+end;
+  
+procedure pyn(b:boolean);
+begin
+  print(syn(b));
+end;
+
+function yn:boolean;
+var c:char;
+begin
+  if (not hangup) then begin
+    cl(3);
+    repeat
+      getkey(c);
+      c:=upcase(c);
+    until (c in ['Y','N',^M,^N]) or (hangup);
+    if (dyny) and (c<>'N') then c:='Y';
+    if (c='Y') then begin
+      print('Yes');
+      yn:=TRUE;
+    end else begin
+      print('No');
+      yn:=FALSE;
+    end;
+    if (hangup) then yn:=FALSE;
+  end;
+  dyny:=FALSE;
+end;
+
+function pynq(s:string):boolean;
+begin
+  ynq(s);
+  pynq:=yn;
+end;
+
+procedure onek(var c:char; ch:string);
+var s:string;
+begin
+  repeat
+    if (not (onekey in thisuser.ac)) then begin
+      input(s,3);
+      if length(s)>=1 then c:=s[1] else
+        if (s='') and (pos(^M,ch)<>0) then c:=^M else
+          c:=' ';
+    end else begin
+      getkey(c);
+      c:=upcase(c);
+    end;
+  until (pos(c,ch)>0) or (hangup);
+  if (hangup) then c:=ch[1];
+  if (onekey in thisuser.ac) then begin
+    if (onekda) then
+      if (c in [#13,#32..#255]) then begin
+        outkey(c);
+        if (trapping) then write(trapfile,c);
+      end;
+    if (onekcr) then nl;
+  end;
+  onekcr:=TRUE;
+  onekda:=TRUE;
+end;
+
+function centre(s:string):string;
+var i,j:integer;
+begin
+  if (pap<>0) then nl;
+  if (s[1]=#2) then s:=copy(s,2,length(s)-1);
+  i:=length(s); j:=1;
+  while (j<=length(s)) do begin
+    if s[j]=#3 then begin
+      dec(i,2);
+      inc(j);
+    end;
+    inc(j);
+  end;
+  if i<thisuser.linelen then
+    s:=copy('                                               ',1,
+      (thisuser.linelen-i) div 2)+s;
+  centre:=s;
+end;
+
+procedure wkey(var abort,next:boolean);
+var c:char;
+begin
+  if (empty) then exit;
+  if ((abort) or (hangup)) then exit;
+
+  getkey(c);
+  case upcase(c) of
+    ' ',^C,^X,^K:abort:=TRUE;
+          'N',^N:begin abort:=TRUE; next:=TRUE; end;
+          'P',^S:getkey(c);
+  end;
+  if (not allowabort) then begin abort:=FALSE; next:=FALSE; end;
+  if (abort) then begin com_purge_tx; nl; sprint(#3#7+'Aborted.'); end;
+end;
+
+function ctim(rl:real):string;
+var h,m,s:string;
+begin
+  s:=tch(cstr(trunc(rl-int(rl/60.0)*60.0)));
+  m:=tch(cstr(trunc(int(rl/60.0)-int(rl/3600.0)*60.0)));
+  h:=cstr(trunc(rl/3600.0));
+  if (length(h)=1) then h:='0'+h;
+  ctim:=h+':'+m+':'+s;
+end;
+
+function tlef:string;
+begin
+  tlef:=ctim(nsl);
+end;
+
+function longtim(dt:datetimerec):string;
+var s:string;
+    d:integer;
+
+  procedure ads(comma:boolean; i:integer; lab:string);
+  begin
+    if (i<>0) then begin
+      s:=s+cstrl(i)+' '+lab;
+      if (i<>1) then s:=s+'s';
+      if (comma) then s:=s+', ';
+    end;
+  end;
+
+begin
+  s:='';
+  with dt do begin
+    d:=day;
+    if (d>=7) then begin
+      ads(TRUE,d div 7,'week');
+      d:=d mod 7;
+    end;
+    ads(TRUE,d,'day');
+    ads(TRUE,hour,'hour');
+    ads(TRUE,min,'minute');
+    ads(FALSE,sec,'second');
+  end;
+  if (s='') then s:='0 seconds';
+  if (copy(s,length(s)-1,2)=', ') then s:=copy(s,1,length(s)-2);
+  longtim:=s;
+end;
+
+function dt2r(dt:datetimerec):real;
+begin
+  with dt do
+    dt2r:=day*86400.0+hour*3600.0+min*60.0+sec;
+end;
+
+procedure r2dt(r:real; var dt:datetimerec);
+begin
+  with dt do begin
+    day:=trunc(r/86400.0); r:=r-(day*86400.0);
+    hour:=trunc(r/3600.0); r:=r-(hour*3600.0);
+    min:=trunc(r/60.0); r:=r-(min*60.0);
+    sec:=trunc(r);
+  end;
+end;
+
+procedure timediff(var dt:datetimerec; dt1,dt2:datetimerec);
+begin
+  with dt do begin
+    day:=dt2.day-dt1.day;
+    hour:=dt2.hour-dt1.hour;
+    min:=dt2.min-dt1.min;
+    sec:=dt2.sec-dt1.sec;
+
+    if (hour<0) then begin inc(hour,24); dec(day); end;
+    if (min<0) then begin inc(min,60); dec(hour); end;
+    if (sec<0) then begin inc(sec,60); dec(min); end;
+  end;
+end;
+
+procedure getdatetime(var dt:datetimerec);
+var w1,w2,w3,w4:word;
+begin
+  gettime(w1,w2,w3,w4);
+  with dt do begin
+    day:=daynum(date);
+    hour:=w1;
+    min:=w2;
+    sec:=w3;
+  end;
+end;
+
+function cstrl(li:longint):string;
+var c:string;
+begin
+  str(li,c);
+  cstrl:=c;
+end;
+
+function cstrr(rl:real; base:integer):string;
+var i:integer;
+    s:string;
+    r1,r2:real;
+begin
+  if (rl<=0.0) then cstrr:='0'
+  else begin
+    r1:=ln(rl)/ln(1.0*base);
+    r2:=exp(ln(1.0*base)*(trunc(r1)));
+    s:='';
+    while (r2>0.999) do begin
+      i:=trunc(rl/r2);
+      s:=s+copy('0123456789ABCDEF',i+1,1);
+      rl:=rl-i*r2;
+      r2:=r2/(1.0*base);
+    end;
+    cstrr:=s;
+  end;
+end;
+
+procedure loadcfilter(s:string);
+var cfilterf:file of cfilterrec;
+    os,ps,ns,es:string;
+    i:integer;
+begin
+  if ((not printingfile) or (not okansi)) then exit;
+  os:=s;
+  if (copy(s,1,1)<>'*') then begin
+    if (not exist(s)) then begin
+      fsplit(s,ps,ns,es);
+      if (exist(systat.afilepath+ns+es)) then s:=systat.afilepath+ns+es
+      else
+      if (exist(systat.gfilepath+ns+es)) then s:=systat.gfilepath+ns+es;
+    end;
+    assign(cfilterf,s);
+    {$I-} reset(cfilterf); {$I+}
+    if (ioresult=0) then begin
+      {$I-} read(cfilterf,cfilter); {$I+}
+      if (ioresult=0) then begin
+        if (not mtcolors) then begin
+          cfilteron:=TRUE;
+          cfiltertype:=0;
+        end else begin
+          pr1(^T+'c=');
+          for i:=0 to 255 do sendcom1(chr(cfilter[i]));
+          pr1(';');
+          mtcfilteron:=TRUE; cfilteron:=TRUE;
+          cfiltertype:=0;
+        end;
+      end;
+      close(cfilterf);
+    end else
+      sysoplog('Missing color filter: '+os);
+  end else begin
+    if (length(s)<3) then exit;
+    case upcase(s[2]) of
+      'C':cfiltertype:=1;
+      'R':cfiltertype:=2;
+    end;
+    s:=copy(s,3,length(s)-2);
+    cfilternum:=0;
+    while (pos(',',s)<>0) do begin
+      cfilter[cfilternum]:=value(s); inc(cfilternum);
+      s:=copy(s,pos(',',s)+1,length(s)-pos(',',s));
+    end;
+    cfilter[cfilternum]:=value(s); inc(cfilternum);
+    cfilteron:=TRUE; cfiltercount:=0;
+  end;
+end;
+
+procedure printa1(s:string; var abort,next:boolean);
+var s1,s2,ss,sss,ssss,tcode,mcix,mcixx:string;
+    i,ls,p1,p2,p3:integer;
+    c,mc:char;
+    savcurco:byte;
+    isansi,iscolor,ismci,istcode,usetcodes:boolean;
+
+  function nmci(s:string):string;
+  begin
+    nmci:='';
+    case c of
+      '1':nmci:=thisuser.name;
+      '2':nmci:=thisuser.realname;
+      '3':nmci:=thisuser.ph;
+      '4':nmci:=thisuser.citystate;
+      '5':nmci:=thisuser.street;
+      '6':nmci:=thisuser.zipcode;
+      '!':if (printingfile) then allowabort:=FALSE;
+      '#':thisuser.ac:=thisuser.ac-[pause];
+    end;
+  end;
+
+  procedure domci(c:char);
+  begin
+    case c of
+      '7':cls;
+      '8':delay(800);
+      '9':pausescr;
+    end;
+  end;
+
+  procedure dotcode(c:char; var s:string);
+  var s1,s2:string;
+  begin
+    case mc of
+      'c':if (pos(';',s)<>0) then begin
+            s1:=copy(s,1,pos(';',s)-1);
+            delete(s,1,length(s1)+1);
+            loadcfilter(s1);
+          end;
+      'C':begin
+            if (okansi) then setc(ord(s[1]));
+            delete(s,1,1);
+          end;
+    end;
+  end;
+
+  procedure sends(s:string);
+  var i:word;
+  begin
+    i:=0;
+    while (i<length(s)) do begin
+      inc(i);
+      sendcom1(s[i]);
+    end;
+  end;
+
+  procedure sendscfilter(s:string);
+  var i:integer;
+      bb:byte;
+  begin
+{    if (not (ansi in thisuser.ac)) then begin sends(s); exit; end;}
+    i:=1;
+    savcurco:=curco;
+    while (i<=length(s)) do begin
+      case cfiltertype of
+        0:bb:=cfilter[ord(s[i])];
+        1:begin
+            cfiltercount:=cfiltercount mod cfilternum+1;
+            bb:=cfilter[cfiltercount-1];
+          end;
+        2:bb:=cfilter[random(cfilternum)];
+      end;
+      if (bb<>curco) then begin
+        if ((okavatar) or (mtcolors)) then omtcolor(bb) else pr1(getc(bb));
+        curco:=bb;
+      end;
+      sendcom1(s[i]);
+      inc(i);
+    end;
+    curco:=savcurco;
+  end;
+
+  procedure locs(s:string);
+  var i:integer;
+  begin
+    i:=0;
+    while (i<length(s)) do begin
+      inc(i);
+      lpromptc(s[i]);
+{      if (s[i]=^H) then delay(systat.bsdelay);}
+    end;
+  end;
+
+  procedure locscfilter(s:string);
+  var i:integer;
+      bb:byte;
+  begin
+{    if (not (ansi in thisuser.ac)) then begin locs(s); exit; end;}
+    i:=1;
+    while (i<=length(s)) do begin
+      case cfiltertype of
+        0:bb:=cfilter[ord(s[i])];
+        1:begin
+            cfiltercount:=cfiltercount mod cfilternum+1;
+            bb:=cfilter[cfiltercount-1];
+          end;
+        2:bb:=cfilter[random(cfilternum)];
+      end;
+      if (bb<>curco) then begin textattr:=bb; curco:=bb; end;
+      lpromptc(s[i]);
+      inc(i);
+    end;
+  end;
+
+  (* Forewarning to the faint of heart programmers:
+     The following section of code contains "goto" statements.
+     I'm VERY SORRY about this, and normally would NEVER EVER EVER
+     use such pathetic coding.  ("Hey - where did this guy learn to
+     program, anyway - a BASIC class!??!?")
+  *)
+
+  procedure handlecolors;
+  label goto1;
+  begin
+      goto1:  { ack! }
+    mc:=ss[p1+1]; sss:=copy(ss,1,p1-1);
+    ss:=copy(ss,p1+2,length(ss)-(p1+1));
+
+    if (outcom) then sends(sss);
+    locs(sss);
+
+    if ((mc>=#0) and (mc<=#9)) then cl(ord(mc)) else
+      if ((mc>='0') and (mc<='9')) then cl(ord(mc)-48);
+
+    p1:=pos(#3,ss);
+    if (p1<>0) then goto goto1;
+  end;
+
+  procedure handletcodes;
+  label goto1;  { *ACK!* }
+  begin
+      goto1:
+    if ((p3<p2) and (p3<>0)) then begin
+      istcode:=TRUE;
+      p2:=p3;
+    end else
+      istcode:=FALSE;
+
+    mc:=ss[p2+1]; sss:=copy(ss,1,p2-1);
+    ss:=copy(ss,p2+2,length(ss)-(p2+1));
+
+    if (outcom) then sends(sss);
+    locs(sss);
+
+    if (not istcode) then domci(mc) else
+      dotcode(mc,ss);
+
+    p2:=pos('@',ss); p3:=pos(^T,ss);
+    if (p2+p3>0) then goto goto1;
+  end;
+
+  procedure handletcodesc;
+  label goto1;  { **ACK!!!*!*!***** }
+  begin
+      goto1:
+    if (p2<>500) then
+      if (pos(ss[p2+1],mcixx)=0) then p2:=500;
+
+    iscolor:=TRUE; istcode:=FALSE;
+    if ((p2<p1) or (p3<p1)) then
+      if ((p2<p1) and (p2<p3)) then begin p1:=p2; iscolor:=FALSE; end else
+        if (p3<p1) then begin p1:=p3; iscolor:=FALSE; istcode:=TRUE; end;
+
+    mc:=ss[p1+1]; sss:=copy(ss,1,p1-1);
+    ss:=copy(ss,p1+2,length(ss)-(p1+1));
+
+    if (outcom) then sends(sss);
+    locs(sss);
+
+    if (iscolor) then begin
+      if ((mc>=#0) and (mc<=#9)) then cl(ord(mc)) else
+        if ((mc>='0') and (mc<='9')) then cl(ord(mc)-48);
+    end else
+      if (not istcode) then domci(mc) else
+        dotcode(mc,ss);
+
+    p1:=pos(#3,ss); if (p1=0) then p1:=500;
+    p2:=pos('@',ss); if (p2=0) then p2:=500;
+    p3:=pos(^T,ss); if (p3=0) then p3:=500;
+    if (p1+p2+p3<1500) then goto goto1;
+  end;
+
+begin
+  tcode:=''; ss:='';
+  if (abort) then exit;
+  doit:=TRUE; isansi:=FALSE;
+  if (pos(^[,s)<>0) then begin
+    lil:=0;
+    isansi:=TRUE;
+  end else
+    if (s[1]='&') then begin
+      if (thisuser.sl<value(copy(s,2,4))) then doit:=FALSE;
+      s:=copy(s,5,length(s)-4);
+    end;
+(*checkhangup;*)
+  if ((hangup) or (not doit)) then begin abort:=TRUE; exit; end;
+  ss:=s; sss:=''; i:=1;
+  mcix:='123456!#'; mcixx:='789';
+  if ((not write_msg) and ((not reading_a_msg) or (read_with_mci))) then
+    if (pos('@',ss)<>0) then
+      for i:=1 to 8 do begin
+        c:=mcix[i];
+        while (pos('@'+c,ss)<>0) do ss:=substone(ss,'@'+c,nmci(c));
+      end;
+  while (pos(#29,ss)<>0) do delete(ss,pos(#29,ss),1);
+  if (not okansi) then ss:=stripcolor(ss);
+  if (trapping) then write(trapfile,ss);
+
+  {if ((isansi) and (okavatar)) then ss:=avatar(ss);}
+  if (not cfilteron) then begin
+    p1:=pos(#3,ss); if (p1=0) then p1:=500;
+    p2:=pos('@',ss); if (p2=0) then p2:=500;
+    p3:=pos(^T,ss); if (p3=0) then p3:=500;
+    if (isansi) then begin
+      p1:=500; p2:=500; p3:=500;
+    end;
+
+    if (((reading_a_msg) and (not read_with_mci)) and (p2+p3<>1000)) then
+      begin p2:=500; p3:=500; end;
+
+    if ((p2=500) and (p3=500)) then begin
+      if (p1<>500) then handlecolors;
+    end else
+      if (p1=500) then handletcodes else handletcodesc;
+    if (outcom) then sends(ss);
+    locs(ss);
+  end else begin
+    if (outcom) then if (mtcfilteron) then sends(ss) else sendscfilter(ss);
+    locscfilter(ss);
+    if (cfiltertype=0) then
+      if ((cfilter[32] and 112)<>0) then begin
+        setc(cfilter[32]);
+        if (okavatar) then pr1(^V+^G) else pr1(^['[K');
+        clreol;
+      end;
+  end;
+  wkey(abort,next);
+
+(*
+  findtcode:=FALSE; tcode:=''; ss:='';
+  if (abort) then exit;
+  doit:=TRUE;
+  if (s[1]='&') then begin
+    if (thisuser.sl<value(copy(s,2,4))) then doit:=FALSE;
+    s:=copy(s,5,length(s)-4);
+  end;
+  if ((hangup) or (not doit)) then begin abort:=TRUE; exit; end;
+  abort:=FALSE; next:=FALSE; i:=1;
+  wkey(abort,next);
+  ls:=length(s);
+  while ((i<=ls) and (not abort) and (not hangup)) do begin
+    didmci:=FALSE;
+    if (findtcode) then begin
+      tcode:=tcode+s[i];
+      if ((copy(tcode,1,1)='c') and (s[i]=';')) then begin
+        s1:=copy(tcode,2,length(tcode)-2);
+        loadcfilter(s1);
+        findtcode:=FALSE;
+      end;
+      inc(i);
+    end else begin
+      if ((s[i]='@') and (i<ls) and
+          ((not reading_a_msg) or (read_with_mci))) then
+        if (s[i+1] in ['1'..'9','!','#']) then begin
+          if ((ss<>'') and (trapping)) then write(trapfile,ss);
+          ss:='';
+          domci(s[i+1]);
+        end;
+      if (not didmci) then begin
+        case s[i] of
+          #3:if (i<ls) then begin
+               if (s[i+1] in [#0..#9]) then cl(ord(s[i+1])) else
+                 if (s[i+1] in ['0'..'9']) then cl(ord(s[i+1])-48);
+               inc(i);
+             end;
+          ^H:begin
+               if (not croff) then dec(pap);
+               delay(systat.bsdelay);
+               outkey(s[i]);
+               ss:=ss+s[i];
+             end;
+          ^T:findtcode:=TRUE;
+        else
+             begin
+               outkey(s[i]);
+               ss:=ss+s[i];
+             end;
+        end;
+        wkey(abort,next);
+        inc(i);
+      end;
+    end;
+  end;
+  if (trapping) then write(trapfile,ss);
+*)
+end;
+
+procedure printacr(s:string; var abort,next:boolean);
+var org:string;
+    p,op,rp,rop,nca:integer;
+    okdoit,sram,turnoff:boolean;
+
+  procedure doboxedtitle(s:string);
+  const B_UL=''; B_UR=''; B_LL=''; B_LR='';
+        B_TOP=''; B_BOT=''; B_LFT=''; B_RGT='';
+  var b:array[0..7] of char;
+      x,numsp:integer;
+      i:string;
+
+    function ritr(c:char; l:integer):string;
+    var s:string;
+        i:integer;
+    begin
+      s:='';
+      for i:=1 to l do s:=s+c;
+      ritr:=s;
+    end;
+
+  begin
+    i:=s;
+    if (i[length(i)]=#1) then i:=copy(i,1,length(i)-1);
+    if (okansi) then
+      for x:=0 to 7 do
+        case x of
+          0:b[x]:=B_UL;   1:b[x]:=B_UR;   2:b[x]:=B_LL;  3:b[x]:=B_LR;
+          4:b[x]:=B_TOP;  5:b[x]:=B_BOT;  6:b[x]:=B_LFT; 7:b[x]:=B_RGT;
+        end
+    else
+      for x:=0 to 7 do
+        case x of
+          0:b[x]:='.';  1:b[x]:='.';  2:b[x]:='`';  3:b[x]:='''';
+          4:b[x]:='-';  5:b[x]:='-';  6:b[x]:=':';  7:b[x]:=':';
+        end;
+    numsp:=(thisuser.linelen div 2)-((lenn(i)+4) div 2);
+    printacr(#3#4+ritr(#32,numsp)+b[0]+ritr(b[4],lenn(i)+2)+b[1],abort,next);
+    printacr(#3#4+ritr(#32,numsp)+b[6]+' '+#3#3+i+#3#4+' '+b[7],abort,next);
+    printacr(#3#4+ritr(#32,numsp)+b[2]+ritr(b[5],lenn(i)+2)+b[3]+#3#1,abort,next);
+  end;
+
+begin
+  if ((allowabort) and (abort)) then exit;
+ 
+  if (s[length(s)]=#1) then
+    if (copy(s,length(s)-1,1)<>#3) then s:=copy(s,1,length(s)-1);
+
+  okdoit:=TRUE; abort:=FALSE; nopfile:=FALSE;
+  turnoff:=(s[length(s)]=#29);
+
+  if (copy(s,1,1)='&') then begin
+    if (thisuser.sl<value(copy(s,2,4))) then exit;
+    s:=copy(s,5,length(s)-4);
+  end;
+  checkhangup;
+
+
+  if (pos(^[,s)>0) then begin
+    printa1(s,abort,next);
+    if ((not turnoff) and (not croff)) then begin
+      nl;
+      if (trapping) then writeln(trapfile);
+    end;
+    croff:=FALSE;
+    exit;
+  end else
+  if (s[1]=#2) then begin
+    printa1(centre(s),abort,next);
+    if (not turnoff) then nl;
+    croff:=FALSE; exit;
+  end else
+  if (length(s)>=3) and (copy(s,1,3)=BOXEDTITLE) then begin
+    doboxedtitle(copy(s,4,length(s)-3));
+    croff:=FALSE; exit;
+  end else begin
+{    wkey(abort,next);}
+    printa1(s,abort,next);
+    if (abort) then begin curco:=255-curco; cl(1); end;
+    if ((not nofeed) and (doit) and (not croff) and (not turnoff)) then
+      if (not abort) then nl;
+    doit:=TRUE;
+  end;
+  croff:=FALSE;
+end;
+
+procedure pfl(fn:string; var abort,next:boolean; cr:boolean);
+var fil:text;
+    ofn:string;
+    ls:string[255];
+    ps:integer;
+    c:char;
+    oldpause,oaa:boolean;
+begin
+  cfilteron:=FALSE; cfiltertype:=0; cfilternum:=0; cfiltercount:=0;
+  printingfile:=TRUE;
+  oaa:=allowabort;
+  allowabort:=TRUE;
+  abort:=FALSE; next:=FALSE;
+{  if (not allowabort) then begin
+    abort:=FALSE; next:=FALSE;
+  end;}
+  oldpause:=(pause in thisuser.ac);
+  nofile:=FALSE;
+  if (not hangup) then begin
+    assign(fil,sqoutsp(fn));
+    {$I-} reset(fil); {$I+}
+    if (ioresult<>0) then nofile:=TRUE
+    else begin
+      abort:=FALSE;
+      while ((not eof(fil)) and (not nofile) and
+             (not abort) and (not hangup)) do begin
+        ps:=0;
+        repeat
+          inc(ps);
+          read(fil,ls[ps]);
+        until ((ls[ps]=^M) or (ps=255) or (eof(fil)) or (hangup));
+        ls[0]:=chr(ps);
+        if (ls[ps]=^M) then begin
+          if (not eof(fil)) then read(fil,c);
+          ls[0]:=chr(ps-1);
+        end else
+          croff:=TRUE;
+        if (pos(^[,ls)<>0) then ctrljoff:=TRUE;
+        printacr(ls,abort,next);
+      end;
+      close(fil);
+{      if (abort) then nl;}
+    end;
+  end;
+  if (oldpause) then thisuser.ac:=thisuser.ac+[pause];
+  allowabort:=oaa;
+  if (mtcfilteron) then begin pr1(^T'c-'); mtcfilteron:=FALSE; end;
+  cfilteron:=FALSE; printingfile:=FALSE; ctrljoff:=FALSE;
+  curco:=255-curco; cl(1);
+  redrawforansi;
+end;
+
+function exist(fn:string):boolean;
+var srec:searchrec;
+begin
+  findfirst(sqoutsp(fn),anyfile,srec);
+  exist:=(doserror=0);
+end;
+
+procedure printfile(fn:string);
+var s:string;
+    year,month,day,dayofweek:word;
+    i,j:integer;
+    abort,next:boolean;
+begin
+  fn:=allcaps(fn); s:=fn;
+  if (copy(fn,length(fn)-3,4)='.ANS') then begin
+    if (exist(copy(fn,1,length(fn)-4)+'.AN1')) then
+      repeat
+        i:=random(10);
+        if (i=0) then
+          fn:=copy(fn,1,length(fn)-4)+'.ANS'
+        else
+          fn:=copy(fn,1,length(fn)-4)+'.AN'+cstr(i);
+      until (exist(fn));
+
+    getdate(year,month,day,dayofweek);
+    s:=fn; s[length(s)-1]:=chr(dayofweek+48);
+    if (exist(s)) then fn:=s;
+  end;
+  pfl(fn,abort,next,TRUE);
+end;
+
+procedure printf(fn:string);              { see if an *.ANS file is available }
+var ffn,ps,ns,es:string;                  { if you have ansi graphics invoked }
+    i,j:integer;
+begin
+  nofile:=TRUE;
+  fn:=sqoutsp(fn);
+  if (fn='') then exit;
+  if (pos('\',fn)<>0) then j:=1
+  else begin
+    j:=2;
+    fsplit(fexpand(fn),ps,ns,es);
+    if (not exist(systat.afilepath+ns+'.*')) then
+      if (not exist(systat.gfilepath+ns+'.*')) then exit;
+  end;
+  for i:=1 to j do begin
+    ffn:=fn;
+    if ((pos('\',fn)=0) and (pos(':',fn)=0)) then
+      case i of
+        1:ffn:=systat.afilepath+ffn;
+        2:ffn:=systat.gfilepath+ffn;
+      end;
+    ffn:=fexpand(ffn);
+    if (pos('.',fn)<>0) then printfile(ffn)
+    else begin
+      if ((okansi) and (not okavatar)) and (exist(ffn+'.ans')) then printfile(ffn+'.ans');
+      if (nofile) then
+        if (thisuser.linelen<80) and (exist(ffn+'.40c')) then
+          printfile(ffn+'.40c')
+        else
+          if (exist(ffn+'.msg')) then printfile(ffn+'.msg');
+    end;
+    if (not nofile) then exit;
+  end;
+end;
+
+procedure skey(c:char);   (* Global user keys *)
+var ddt,dt:datetimerec;
+    s:string;
+    savpap:integer;
+    bb:byte;
+begin
+  case c of
+   ^D,^E,^F,^R:
+      if (macok) and (buf='') then dm(' '+macros.macro[pos(c,^D^E^F^R)],c);
+   ^T:begin
+        bb:=curco;
+        savpap:=pap;
+        nl;
+        if (useron) then
+          sprint('@M'+#3+chr(systat.sysopcolor)+systat.bbsname+
+            ' ('+systat.bbsphone+')');
+        nl;
+        sprint(#3#0+'DateTime...: '+#3#9+dat);
+        if (useron) then begin
+          sprint(#3#0+'Time left..: '+#3#5+'@T');
+          getdatetime(dt);
+          timediff(ddt,timeon,dt);
+          sprint(#3#0+'Time on....: '+#3#5+longtim(ddt));
+        end;
+        nl;
+        pap:=savpap; curco:=bb; sdc;
+      end;
+ #127:c:=#8;
+  end;
+end;
+
+function verline(i:integer):string;
+var s:string;
+begin
+  case i of
+    1:begin
+        s:='Project Coyote 0.14 Alpha ';
+      end;
+    2:s:='Complied By Robert Merritt on 11-19-92';
+  end;
+  verline:=s;
+end;
+
+function aacs1(u:userrec; un:integer; s:string):boolean;
+var s1,s2:string;
+    p1,p2,i,j:integer;
+    c,c1,c2:char;
+    b:boolean;
+
+  procedure getrest;
+  begin
+    s1:=c;
+    p1:=i;
+    if ((i<>1) and (s[i-1]='!')) then begin s1:='!'+s1; dec(p1); end;
+    if (c in ['C','F','G','R','V','X']) then begin
+      s1:=s1+s[i+1];
+      inc(i);
+    end else begin
+      j:=i+1;
+      repeat
+        if (s[j] in ['0'..'9']) then begin
+          s1:=s1+s[j];
+          inc(j);
+        end;
+      until ((j>length(s)) or (not (s[j] in ['0'..'9'])));
+      i:=j-1;
+    end;
+    p2:=i;
+  end;
+
+  function argstat(s:string):boolean;
+  var vs:string;
+      year,month,day,dayofweek,hour,minute,second,sec100:word;
+      vsi:integer;
+      boolstate,res:boolean;
+  begin
+    boolstate:=(s[1]<>'!');
+    if (not boolstate) then s:=copy(s,2,length(s)-1);
+    vs:=copy(s,2,length(s)-1); vsi:=value(vs);
+    case s[1] of
+      'A':res:=(ageuser(u.bday)>=vsi);
+      'B':res:=((value(spd)>=value(vs+'00')) or (spd='KB'));
+      'C':res:=FALSE;   { conferences - not implemented yet }
+      'D':res:=(u.dsl>=vsi);
+      'F':res:=(upcase(vs[1]) in u.ar);
+      'G':res:=(u.sex=upcase(vs[1]));
+      'H':begin
+            gettime(hour,minute,second,sec100);
+            res:=(hour=vsi);
+          end;
+      'P':res:=(u.filepoints>=vsi);
+      'R':res:=(tacch(upcase(vs[1])) in u.ac);
+      'S':res:=(u.sl>=vsi);
+      'T':res:=(trunc(nsl) div 60>=vsi);
+      'U':res:=(un=vsi);
+      'V':res:=((u.sl>systat.newsl) or (u.dsl>systat.newdsl) or
+           ((systat.newsl=systat.autosl) and (systat.newdsl=systat.autodsl)));
+      'W':begin
+            getdate(year,month,day,dayofweek);
+            res:=(dayofweek=ord(s[1])-48);
+          end;
+      'Y':res:=(trunc(timer) div 60>=vsi);
+    end;
+    if (not boolstate) then res:=not res;
+    argstat:=res;
+  end;
+
+begin
+  s:=allcaps(s);
+  i:=0;
+  while (i<length(s)) do begin
+    inc(i);
+    c:=s[i];
+    if (c in ['A'..'Z']) and (i<>length(s)) then begin
+      getrest;
+      b:=argstat(s1);
+      delete(s,p1,length(s1));
+      if (b) then s2:='^' else s2:='%';
+      insert(s2,s,p1);
+      dec(i,length(s1)-1);
+    end;
+  end;
+  s:='('+s+')';
+  while (pos('&',s)<>0) do delete(s,pos('&',s),1);
+  while (pos('^^',s)<>0) do delete(s,pos('^^',s),1);
+  while (pos('(',s)<>0) do begin
+    i:=1;
+    while ((s[i]<>')') and (i<=length(s))) do begin
+      if (s[i]='(') then p1:=i;
+      inc(i);
+    end;
+    p2:=i;
+    s1:=copy(s,p1+1,(p2-p1)-1);
+    while (pos('|',s1)<>0) do begin
+      i:=pos('|',s1);
+      c1:=s1[i-1]; c2:=s1[i+1];
+      s2:='%';
+      if ((c1 in ['%','^']) and (c2 in ['%','^'])) then begin
+        if ((c1='^') or (c2='^')) then s2:='^';
+        delete(s1,i-1,3);
+        insert(s2,s1,i-1);
+      end else
+        delete(s1,i,1);
+    end;
+    while(pos('%%',s1)<>0) do delete(s1,pos('%%',s1),1);   {leave only "%"}
+    while(pos('^^',s1)<>0) do delete(s1,pos('^^',s1),1);   {leave only "^"}
+    while(pos('%^',s1)<>0) do delete(s1,pos('%^',s1)+1,1); {leave only "%"}
+    while(pos('^%',s1)<>0) do delete(s1,pos('^%',s1),1);   {leave only "%"}
+    delete(s,p1,(p2-p1)+1);
+    insert(s1,s,p1);
+  end;
+  aacs1:=(not (pos('%',s)<>0));
+end;
+
+function aacs(s:string):boolean;
+begin
+  aacs:=aacs1(thisuser,usernum,s);
+end;
+
+{ load account "i" if i<>usernum; else use "thisuser" account }
+procedure loadurec(var u:userrec; i:integer);
+var ufo:boolean;
+begin
+  ufo:=(filerec(uf).mode<>fmclosed);
+  if (not ufo) then reset(uf);
+  if (i<>usernum) then begin
+    seek(uf,i);
+    read(uf,u);
+  end else
+    u:=thisuser;
+  if (not ufo) then close(uf);
+end;
+
+{ save account "i" if i<>usernum; save data into "thisuser" account if same }
+procedure saveurec(u:userrec; i:integer);
+var ufo:boolean;
+begin
+  ufo:=(filerec(uf).mode<>fmclosed);
+  if (not ufo) then reset(uf);
+  seek(uf,i); write(uf,u);
+  if (i=usernum) then thisuser:=u;
+  if (not ufo) then close(uf);
+end;
+
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common1.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,829 @@
+{$A+,B+,D-,E+,F+,I+,L+,N-,O+,R-,S+,V-}
+unit common1;
+
+interface
+
+uses
+  crt, dos,
+  myio,
+  tmpcom;
+
+function checkpw:boolean;
+procedure newcomptables;
+procedure cline(var s:string; dd:string);
+procedure pausescr;
+procedure wait(b:boolean);
+(*procedure fix_window;*)
+procedure inittrapfile;
+procedure chatfile(b:boolean);
+procedure local_input1(var i:string; ml:integer; tf:boolean);
+procedure local_input(var i:string; ml:integer);
+procedure local_inputl(var i:string; ml:integer);
+procedure local_onek(var c:char; ch:string);
+function chinkey:char;
+procedure inli1(var s:string);
+procedure chat;
+procedure sysopshell(takeuser:boolean);
+procedure globat(i:integer);
+procedure exiterrorlevel;
+procedure showsysfunc;
+procedure readinzscan;
+procedure savezscanr;
+procedure redrawforansi;
+
+implementation
+
+uses
+  common, common2, common3;
+
+var
+  chcfilter:array[1..2] of cfilterrec;
+  chcfilteron:boolean;
+
+function checkpw:boolean;
+var s:string[20];
+    savsl,savdsl:integer;
+begin
+  checkpw:=TRUE;
+  prompt('SysOp Password: ');
+
+  savsl:=thisuser.sl; savdsl:=thisuser.dsl;
+  thisuser.sl:=realsl; thisuser.dsl:=realdsl;
+  echo:=((aacs(systat.seepw)) and (not systat.localsec));
+  thisuser.sl:=savsl; thisuser.dsl:=savdsl;
+
+  input(s,20);
+  echo:=TRUE;
+
+  if (s<>systat.sysoppw) then
+  begin
+    checkpw:=FALSE;
+    if (incom) and (s<>'') then sysoplog('*** Wrong SysOp Password = '+s+' ***');
+  end;
+end;
+
+procedure newcomptables;
+var savuboard:ulrec;
+    savboard:boardrec;
+    savreaduboard,savreadboard,i,j:integer;
+    bfo,ulfo,done:boolean;
+begin
+  for i:=0 to 1 do for j:=0 to maxuboards do ccuboards[i][j]:=j;
+  for i:=0 to 1 do for j:=1 to maxboards do ccboards[i][j]:=j;
+  if (systat.compressbases) then begin
+
+    savuboard:=memuboard; savreaduboard:=readuboard;
+    savboard:=memboard; savreadboard:=readboard;
+
+    bfo:=(filerec(bf).mode<>fmclosed);
+    ulfo:=(filerec(ulf).mode<>fmclosed);
+    if (not bfo) then reset(bf);
+    if (not ulfo) then reset(ulf);
+
+    seek(ulf,0); i:=0; j:=0; done:=FALSE;
+    while ((not done) and (i<=maxuboards)) do begin
+      {$I-} read(ulf,memuboard); {$I+}
+      done:=(ioresult<>0);
+
+
+      if (not done) then
+        if (i>maxulb) then begin
+          ccuboards[0][i]:=maxuboards+1;
+          ccuboards[1][i]:=maxuboards+1;
+        end else
+          if (aacs(memuboard.acs)) then begin
+            ccuboards[1][i]:=j; ccuboards[0][j]:=i;
+            inc(j);
+          end;
+      inc(i);
+    end;
+{    seek(ulf,loaduboard); read(ulf,memuboard);}
+    if (maxulb<maxuboards) then begin
+      ccuboards[1][maxulb+1]:=j;
+      ccuboards[0][j]:=maxulb+1;
+    end;
+
+    seek(bf,0); i:=1; j:=1; done:=FALSE;
+    while ((not done) and (i<=maxboards)) do begin
+      {$I-} read(bf,memboard); {$I+}
+      done:=(ioresult<>0);
+
+      if (not done) then
+        if (i>numboards) then begin
+          ccboards[0][i]:=maxboards+1;
+          ccboards[1][i]:=maxboards+1;
+        end else
+          if (mbaseac(i)) then begin
+            ccboards[1][i]:=j; ccboards[0][j]:=i;
+            inc(j);
+          end;
+      inc(i);
+    end;
+{    seek(bf,loadboard); read(bf,memboard);}
+    if (numboards<maxboards) then begin
+      ccboards[1][numboards+1]:=j;
+      ccboards[0][j]:=maxboards+1;
+    end;
+
+    if (not bfo) then close(bf);
+    if (not ulfo) then close(ulf);
+
+    memuboard:=savuboard; readuboard:=savreaduboard;
+    memboard:=savboard; readboard:=savreadboard;
+
+  end;
+end;
+
+procedure cline(var s:string; dd:string);
+var i,u:integer;
+    sx,sy,sz:byte;
+    b,savwindowon:boolean;
+begin
+  sx:=wherex; sy:=wherey; sz:=textattr;
+  savwindowon:=cwindowon;
+
+  if (not cwindowon) then begin
+    cwindowon:=TRUE;
+    schangewindow(TRUE,1);
+  end;
+  commandline('');
+  window(1,1,80,25);
+
+  if (systat.istopwindow) then
+    gotoxy(2,getwindysize(systat.curwindow))
+  else
+    gotoxy(2,26-getwindysize(systat.curwindow));
+  tc(15); textbackground(1); write(dd+' ');
+  tc(14); local_inputl(s,78-wherex);
+
+  inuserwindow;
+  gotoxy(sx,sy); textattr:=sz;
+  if (not savwindowon) then sclearwindow;
+end;
+
+procedure pausescr;
+var ddt,dt1,dt2:datetimerec;
+    i,x:integer;
+    s:string[3];
+    c:char;
+    bb:byte;
+begin
+  nosound;
+  bb:=curco;
+  cl(8);
+  x:=lenn(fstring.pause); sprompt(fstring.pause); lil:=0;
+
+  getkey(c);
+(*
+  getdatetime(dt1);
+  repeat
+    checkhangup; c:=inkey;
+    getdatetime(dt2);
+    timediff(ddt,dt1,dt2);
+    if ((dt2r(ddt)>systat.timeoutbell*60) and (c=#0)) then begin
+      outkey(^G); delay(100); outkey(^G);
+    end;
+    if ((systat.timeout<>-1) and (dt2r(ddt)>systat.timeout*60)) then begin
+      nl;
+      nl;
+      printf('timedout');
+      if (nofile) then
+        print('Time out has occurred.  Log off time was at '+time+'.');
+      nl; nl;
+      hangup:=TRUE;
+      sysoplog(#3#7+'!*!*! Time-out at '+time+' !*!*!');
+      exit;
+    end;
+  until ((c<>#0) or (hangup));
+*)
+
+  if ((okansi) and (not hangup)) then begin
+    s:=cstr(x);
+    if (outcom) then begin
+      if (okavatar) then pr1(^Y^H+chr(x)+^Y+' '+chr(x)+^Y^H+chr(x))
+      else begin
+        pr1(#27+'['+s+'D');
+        for i:=1 to x do pr1(' ');
+        pr1(#27+'['+s+'D');
+      end;
+    end;
+    if (wantout) then begin
+      for i:=1 to x do write(^H);
+      for i:=1 to x do write(' ');
+      for i:=1 to x do write(^H);
+    end;
+  end else begin
+    for i:=1 to x do outkey(^H);
+    for i:=1 to x do outkey(' ');
+    for i:=1 to x do outkey(^H);
+    if (trapping) then begin
+      for i:=1 to x do write(trapfile,^H);
+      for i:=1 to x do write(trapfile,' ');
+      for i:=1 to x do write(trapfile,^H);
+    end;
+  end;
+  if (not hangup) then setc(bb);
+end;
+
+procedure wait(b:boolean);
+const lastc:byte=0;
+var c,len:integer;
+begin
+  if (b) then begin
+    lastc:=curco;
+    sprompt(fstring.wait)
+  end else begin
+    len:=lenn(fstring.wait);
+    for c:=1 to len do prompt(^H);
+    for c:=1 to len do prompt(' ');
+    for c:=1 to len do prompt(^H);
+    setc(lastc);
+  end;
+end;
+
+(*procedure fix_window;
+var wind:windowrec;
+    x,y,i,z:integer;
+begin
+  if (useron) then begin
+    x:=wherex; y:=wherey;
+    if (not systat.istopwindow) then begin
+      if (systat.bwindow) then begin
+        window(1,1,80,25);
+        gotoxy(1,25);
+        if (y>=22) then for i:=1 to 4-(25-y) do writeln;
+        if (y>=22) then dec(y,4-(25-y));
+      end;
+      gotoxy(x,y);
+    end else begin
+      if (systat.bwindow) then begin
+        window(1,1,80,25);
+        savescreen(wind,1,1,80,y);
+        if (y>=22) then z:=25-y else z:=5;
+        if (z>=2) then movewindow(wind,1,z);
+        if (z<=4) then y:=(y-z)+1;
+        if (y>=22) then y:=21;
+        if (y<=0) then y:=1;
+        gotoxy(x,y);
+      end;
+    end;
+    if (systat.bwindow) then topscr;
+  end;
+end;*)
+
+procedure inittrapfile;
+begin
+  if (systat.globaltrap) or (thisuser.trapactivity) then trapping:=TRUE
+    else trapping:=FALSE;
+  if (trapping) then begin
+    if (thisuser.trapseperate) then
+      assign(trapfile,systat.trappath+'trap'+cstr(usernum)+'.msg')
+    else
+      assign(trapfile,systat.trappath+'trap.msg');
+    {$I-} append(trapfile); {$I+}
+    if (ioresult<>0) then begin
+      rewrite(trapfile);
+      writeln(trapfile);
+    end;
+    writeln(trapfile,'***** TeleGard-X User Audit - '+nam+' on at '+date+' '+time+' *****');
+  end;
+end;
+
+procedure chatfile(b:boolean);
+var bf:file of byte;
+    s:string[91];
+    cr:boolean;
+begin
+  s:='chat';
+  if (thisuser.chatseperate) then s:=s+cstr(usernum);
+  s:=systat.trappath+s+'.msg';
+  if (not b) then begin
+    if (cfo) then begin
+      commandline('Chat Capture OFF (Recorded in "'+s+'")');
+      cfo:=FALSE;
+      if (textrec(cf).mode<>fmclosed) then close(cf);
+    end;
+  end else begin
+    cfo:=TRUE;
+    if (textrec(cf).mode=fmoutput) then close(cf);
+    assign(cf,s); assign(bf,s);
+    cr:=FALSE;
+    {$I-} reset(cf); {$I+}
+    if (ioresult<>0) then
+      rewrite(cf)
+    else begin
+      close(cf);
+      append(cf);
+    end;
+    writeln(cf,^M^J^M^J+dat+^M^J+'Recorded with user: '+nam+^M^J+'------------------------------------'+^M^J);
+    commandline('Chat Capture ON ("'+s+'")');
+  end;
+end;
+
+procedure local_input1(var i:string; ml:integer; tf:boolean);
+var r:real;
+    cp:integer;
+    cc:char;
+begin
+  cp:=1;
+  repeat
+    cc:=readkey;
+    if (not tf) then cc:=upcase(cc);
+    if (cc in [#32..#255]) then
+      if (cp<=ml) then begin
+        i[cp]:=cc;
+        inc(cp);
+        write(cc);
+      end
+      else
+    else
+      case cc of
+        ^H:if (cp>1) then begin
+            cc:=^H;
+            write(^H' '^H);
+            dec(cp);
+          end;
+    ^U,^X:while (cp<>1) do begin
+            dec(cp);
+            write(^H' '^H);
+          end;
+      end;
+  until (cc in [^M,^N]);
+  i[0]:=chr(cp-1);
+  if (wherey<=hi(windmax)-hi(windmin)) then writeln;
+end;
+
+procedure local_input(var i:string; ml:integer);  (* Input uppercase only *)
+begin
+  local_input1(i,ml,FALSE);
+end;
+
+procedure local_inputl(var i:string; ml:integer);   (* Input lower & upper case *)
+begin
+  local_input1(i,ml,TRUE);
+end;
+
+procedure local_onek(var c:char; ch:string);                    (* 1 key input *)
+begin
+  repeat c:=upcase(readkey) until (pos(c,ch)>0);
+  writeln(c);
+end;
+
+function chinkey:char;
+var c:char;
+begin
+  c:=#0; chinkey:=#0;
+  if (keypressed) then begin
+    c:=readkey;
+    if (chcfilteron) then setc(chcfilter[1][ord(c)])
+      else if (not wcolor) then cl(systat.sysopcolor);
+    wcolor:=TRUE;
+    if (c=#0) then
+      if (keypressed) then begin
+        c:=readkey;
+        skey1(c);
+        if (c=#68) then c:=#1 else c:=#0;
+        if (buf<>'') then begin
+          c:=buf[1];
+          buf:=copy(buf,2,length(buf)-1);
+        end;
+      end;
+    chinkey:=c;
+  end else
+    if ((not com_rx_empty) and (incom) and (not trm)) then begin
+      c:=cinkey;
+      if (chcfilteron) then setc(chcfilter[2][ord(c)])
+        else if (wcolor) then cl(systat.usercolor);
+      wcolor:=FALSE;
+      chinkey:=c;
+    end;
+end;
+
+procedure inli1(var s:string);             (* Input routine for chat *)
+var cv,cc,cp,g,i,j:integer;
+    c,c1:char;
+begin
+  cp:=1;
+  s:='';
+  if (ll<>'') then begin
+    if (chcfilteron) then begin
+      if (wcolor) then j:=1 else j:=2;
+      for i:=1 to length(ll) do begin
+        setc(chcfilter[j][ord(ll[i])]);
+        outkey(ll[i]);
+        if (trapping) then write(trapfile,ll[i]);
+      end;
+    end else
+      prompt(ll);
+    s:=ll; ll:='';
+    cp:=length(s)+1;
+  end;
+  repeat
+    getkey(c); checkhangup;
+    case ord(c) of
+      32..255:if (cp<79) then begin
+                s[cp]:=c; pap:=cp; inc(cp);
+                outkey(c);
+                if (trapping) then write(trapfile,c);
+              end;
+      16:if okansi then begin
+           getkey(c1);
+           cl(ord(c1)-48);
+         end;
+      27:if (cp<79) then begin
+           s[cp]:=c; inc(cp);
+           outkey(c);
+           if (trapping) then write(trapfile,c);
+         end;
+      8:if (cp>1) then begin
+          dec(cp); pap:=cp;
+          prompt(^H' '^H);
+        end;
+      24:begin
+           for cv:=1 to cp-1 do prompt(^H' '^H);
+           cp:=1;
+           pap:=0;
+         end;
+       7:if (outcom) then sendcom1(^G);
+      23:if cp>1 then
+           repeat
+             dec(cp); pap:=cp;
+             prompt(^H' '^H);
+           until (cp=1) or (s[cp]=' ');
+       9:begin
+           cv:=5-(cp mod 5);
+           if (cp+cv<79) then
+             for cc:=1 to cv do begin
+               s[cp]:=' ';
+               inc(cp); pap:=cp;
+               prompt(' ');
+             end;
+         end;
+  end;
+  until ((c=^M) or (cp=79) or (hangup) or (not ch));
+  if (not ch) then begin c:=#13; ch:=FALSE; end;
+  s[0]:=chr(cp-1);
+  if (c<>^M) then begin
+    cv:=cp-1;
+    while (cv>0) and (s[cv]<>' ') and (s[cv]<>^H) do dec(cv);
+    if (cv>(cp div 2)) and (cv<>cp-1) then begin
+      ll:=copy(s,cv+1,cp-cv);
+      for cc:=cp-2 downto cv do prompt(^H);
+      for cc:=cp-2 downto cv do prompt(' ');
+      s[0]:=chr(cv-1);
+    end;
+  end;
+  if (wcolor) then j:=1 else j:=2;
+  if ((chcfilteron) and ((chcfilter[j][32] and 112)<>0)) then begin
+    setc(chcfilter[j][32]);
+    if (okavatar) then pr1(^V+^G) else pr1(^['[K');
+    clreol;
+    setc(7);
+    nl;
+    setc(chcfilter[j][32]);
+  end else
+    nl;
+end;
+
+procedure loadchcfilter(i:integer);
+var chcfilterf:file of cfilterrec;
+    s,os:string;
+    ps:string[67];
+    ns:string[8];
+    es:string[4];
+begin
+  os:=s;
+  if (i=1) then s:=systat.chatcfilter1 else s:=systat.chatcfilter2;
+
+  if (s='') then begin
+    sysoplog(aonoff((i=1),'SysOp','User')+' chat-filter set to NULL string');
+    exit;
+  end;
+
+  fsplit(s,ps,ns,es);
+  if (exist(systat.afilepath+ns+es)) then s:=systat.afilepath+ns+es
+  else
+  if (exist(systat.gfilepath+ns+es)) then s:=systat.gfilepath+ns+es;
+
+  assign(chcfilterf,s);
+  {$I-} reset(chcfilterf); {$I+}
+  if (ioresult=0) then begin
+    {$I-} read(chcfilterf,chcfilter[i]); {$I+}
+    if (ioresult=0) then chcfilteron:=TRUE;
+    close(chcfilterf);
+  end else
+    sysoplog('Missing chat color filter: "'+os+'"');
+end;
+
+procedure chat;
+var chatstart,chatend,tchatted:datetimerec;
+    s,xx:string;
+    t1:real;
+    i,savpap:integer;
+    c:char;
+    savecho,savprintingfile:boolean;
+begin
+  nosound;
+  getdatetime(chatstart);
+  dosansion:=FALSE;
+
+  savprintingfile:=printingfile;
+  savpap:=pap; ch:=TRUE; chatcall:=FALSE; savecho:=echo; echo:=TRUE;
+  if (systat.autochatopen) then chatfile(TRUE)
+     else if (thisuser.chatauto) then chatfile(TRUE);
+  nl; nl;
+  thisuser.ac:=thisuser.ac-[alert];
+
+  printf('chatinit');
+  if (nofile) then begin sprompt(#3#5+fstring.engage); nl; nl; end;
+
+  cl(systat.sysopcolor); wcolor:=TRUE;
+
+  chcfilteron:=FALSE;
+
+  if (okansi) then
+    if ((systat.chatcfilter1<>'') or (systat.chatcfilter2<>'')) then begin
+      loadchcfilter(1);
+      if (chcfilteron) then loadchcfilter(2);
+    end;
+
+  if (chatr<>'') then begin
+    commandline(chatr); print(' '); chatr:='';
+  end;
+  repeat
+    inli1(xx);
+    if (xx[1]='/') then xx:=allcaps(xx);
+    if (copy(xx,1,6)='/TYPE ') then begin
+      s:=copy(xx,7,length(xx));
+      if (s<>'') then begin
+        printfile(s);
+        if (nofile) then print('*File not found*');
+      end;
+    end
+    else if (xx='/SHELL') and (thisuser.sl=255) then begin
+      print('Shelling to DOS...');
+      sysopshell(TRUE)
+    end
+    else if (xx='/CC') then begin
+      print(syn(dosansion));
+    end
+    else if (xx='/C') then begin
+      print(syn(mtcolors));
+    end
+    else if ((xx='/HELP') or (xx='/?')) then begin
+      nl;
+      sprint('^5/TYPE d:\path\filename.ext^3: Type a file');
+      sprint('^5/BYE^3:   Hang up');
+      sprint('^5/CLS^3:   Clear the screen');
+      sprint('^5/PAGE^3:  Page the SysOp and User');
+      if (thisuser.sl=255) then
+        sprint('^5/SHELL^3: Shell to DOS with user (255 SL ^5ONLY^3)');
+      sprint('^5/Q^3:     Exit chat mode');
+      nl;
+    end
+    else if (xx='/CLS') then cls
+    else if (xx='/PAGE') then begin
+      for i:=650 to 700 do begin
+        sound(i); delay(4);
+        nosound;
+      end;
+      repeat
+        dec(i); sound(i); delay(2);
+        nosound;
+      until (i=200);
+      prompt(^G^G);
+    end
+
+    else if (xx='/ACS') then begin
+      prt('ACS:'); inputl(s,20);
+      if (aacs(s)) then print('You have access to that!')
+        else print('You DO NOT have access to that.');
+    end
+
+    else if (xx='/BYE') then begin
+      print('Hanging up...');
+      hangup:=TRUE;
+    end
+    else if (xx='/Q') then begin
+      t1:=timer;
+      while (abs(t1-timer)<0.6) and (empty) do;
+      if (empty) then begin ch:=FALSE; print('Chat Aborted...'); end;
+    end;
+    if (cfo) then writeln(cf,xx);
+  until ((not ch) or (hangup));
+
+  printf('chatend');
+  if (nofile) then begin nl; sprint(#3#5+fstring.endchat); end;
+
+  getdatetime(chatend);
+  timediff(tchatted,chatstart,chatend);
+
+  freetime:=freetime+dt2r(tchatted);
+
+  tleft;
+  s:='Chatted for '+longtim(tchatted);
+  if (cfo) then begin
+    s:=s+'  -{ Recorded in CHAT';
+    if (thisuser.chatseperate) then s:=s+cstr(usernum);
+    s:=s+'.MSG }-';
+  end;
+  sysoplog(s);
+  ch:=FALSE; echo:=savecho;
+  if ((hangup) and (cfo)) then
+  begin
+    writeln(cf);
+    writeln(cf,'NO CARRIER');
+    writeln(cf);
+    writeln(cf,'>> Carrier lost ...');
+    writeln(cf);
+  end;
+  pap:=savpap; printingfile:=savprintingfile;
+  commandline('');
+  if (cfo) then chatfile(FALSE);
+end;
+
+procedure sysopshell(takeuser:boolean);
+var wind:windowrec;
+    opath:string;
+    t:real;
+    sx,sy,ret:integer;
+    bb:byte;
+
+  procedure dosc;
+  var s:string;
+      i:integer;
+  begin
+    s:=^M^J+#27+'[0m';
+    for i:=1 to length(s) do dosansi(s[i]);
+  end;
+
+begin
+  bb:=curco;
+  getdir(0,opath);
+  t:=timer;
+  if (useron) and (incom) then begin
+    nl; nl;
+    sprompt(fstring.shelldos1);
+  end;
+  sx:=wherex; sy:=wherey;
+  setwindow(wind,1,1,80,25,7,0,0);
+  clrscr;
+  tc(11); writeln('[> Type "EXIT" to return to Project Coyote.');
+  dosc;
+  dosansion:=FALSE;
+  if (not takeuser) then shelldos(FALSE,'',ret)
+    else shelldos(FALSE,'remote.bat',ret);
+  getdatetime(tim);
+  if (useron) then com_flush_rx;
+  if (not trm) then chdir(opath);
+  clrscr;
+  removewindow(wind);
+  gotoxy(sx,sy);
+  if (useron) then begin
+    freetime:=freetime+timer-t;
+    topscr;
+    sdc;
+    if (incom) then begin
+      nl;
+      sprint(fstring.shelldos2);
+    end;
+  end;
+  setc(bb);
+end;
+
+procedure globat(i:integer);
+var wind:windowrec;
+    s:string;
+    t:real;
+    xx,yy,z,ret:integer;
+begin
+  xx:=wherex; yy:=wherey; z:=textattr;
+  getdir(0,s);
+  chdir(start_dir);
+  savescreen(wind,1,1,80,25);
+  t:=timer;
+  shelldos(FALSE,'globat'+chr(i+48),ret);
+  getdatetime(tim);
+  com_flush_rx;
+  freetime:=freetime+timer-t;
+  removewindow(wind);
+  chdir(s);
+  if (useron) then topscr;
+  gotoxy(xx,yy); textattr:=z;
+end;
+
+procedure exiterrorlevel;
+var wind:windowrec;
+    s:string;
+    xx,yy,z,ee:integer;
+    c:char;
+    re:boolean;
+begin
+  savescreen(wind,1,1,80,25);
+  xx:=wherex; yy:=wherey; z:=textattr;
+  clrscr;
+  writeln('[> Exit at ERRORLEVEL '+cstr(exiterrors)+', correct? ');
+  writeln;
+  write('[A]bort [Y]es [O]ther : ');
+  repeat c:=upcase(readkey) until (c in ['A','Y','O',^M]);
+  if (c<>^M) then write(c);
+  writeln;
+  ee:=-1;
+  case c of
+    'O':begin
+          writeln;
+          write('Enter ERRORLEVEL (-1 to abort) : ');
+          readln(s);
+          if (s<>'') then ee:=value(s);
+        end;
+    'Y':ee:=exiterrors;
+  end;
+  if (ee<>-1) then begin
+    writeln;
+    write('Generate a run-time error? [Yes] : ');
+    repeat c:=upcase(readkey) until (c in ['Y','N',^M]);
+    re:=(c<>'N');
+  end;
+  removewindow(wind);
+  if (useron) then topscr;
+  gotoxy(xx,yy); textattr:=z;
+  if (ee<>-1) then begin
+    exiterrors:=ee;
+    if (re) then runerror(0) else halt(ee);
+  end;
+end;
+
+procedure showsysfunc;
+var imagef:file of windowrec;
+    wind,swind:windowrec;
+    xx,yy,z:integer;
+    c:char;
+    badd:boolean;
+begin
+  assign(imagef,systat.gfilepath+'sysfunc.dat');
+  {$I-} reset(imagef); {$I+}
+  if (ioresult<>0) then commandline('"'+systat.gfilepath+'SYSFUNC.DAT" missing')
+  else begin
+    {$I-} read(imagef,wind); {$I+} badd:=(ioresult<>0);
+    if (badd) then commandline('Errors reading image data from SYSFUNC.DAT');
+    close(imagef);
+    if (not badd) then begin
+      savescreen(swind,1,1,80,25);
+      xx:=wherex; yy:=wherey; z:=textattr;
+      removewindow(wind);
+      cursoron(FALSE);
+      c:=readkey;
+      removewindow(swind);
+      if (useron) then topscr;
+      gotoxy(xx,yy); textattr:=z;
+      cursoron(TRUE);
+    end;
+  end;
+end;
+
+procedure readinzscan;
+var zscanf:file of zscanrec;
+    i,j:integer;
+begin
+  assign(zscanf,systat.gfilepath+'zscan.dat');
+  {$I-} reset(zscanf); {$I+} if (ioresult<>0) then rewrite(zscanf);
+  if (usernum<filesize(zscanf)) then begin
+    seek(zscanf,usernum); read(zscanf,zscanr);
+    close(zscanf);
+    exit;
+  end;
+  with zscanr do begin
+    for i:=1 to maxboards do
+      for j:=1 to 6 do mhiread[i][j]:=0;
+    mzscan:=[]; fzscan:=[];
+    for i:=1 to maxboards do mzscan:=mzscan+[i];
+    for i:=0 to maxuboards do fzscan:=fzscan+[i];
+  end;
+  seek(zscanf,filesize(zscanf));
+  repeat write(zscanf,zscanr) until (filesize(zscanf)>=usernum+1);
+  close(zscanf);
+end;
+
+procedure savezscanr;
+var zscanf:file of zscanrec;
+begin
+  assign(zscanf,systat.gfilepath+'zscan.dat');
+  {$I-} reset(zscanf); {$I+} if (ioresult<>0) then rewrite(zscanf);
+  if (usernum<filesize(zscanf)) then begin
+    seek(zscanf,usernum); write(zscanf,zscanr);
+    close(zscanf);
+    exit;
+  end;
+  close(zscanf);
+end;
+
+procedure redrawforansi;
+begin
+  if (dosansion) then begin dosansion:=FALSE; topscr; end;
+  textattr:=7; curco:=7;
+  if ((outcom) and (okansi)) then begin
+    if (okavatar) then pr1(^V+^A+#7) else pr1(#27+'[0m');
+  end;
+end;
+
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common2.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,1123 @@
+{$A+,B+,D-,E+,F+,I+,L+,N-,O+,R-,S+,V-}
+unit common2;
+
+interface
+
+uses
+  crt, dos,
+  myio,
+  tmpcom;
+
+procedure showudstats;
+procedure skey1(c:char);
+procedure savesystat;
+procedure remove_port;
+procedure openport(comport:byte; baud:longint; parity:char; databits,stopbits:byte);
+{procedure initthething;}
+procedure iport;
+procedure gameport;
+procedure sendcom1(c:char);
+function recom1(var c:char):boolean;
+procedure term_ready(ready_status:boolean);
+function getwindysize(wind:integer):integer;
+procedure inuserwindow;
+procedure commandline(s:string);
+procedure sclearwindow;
+procedure schangewindow(needcreate:boolean; newwind:integer);
+procedure topscr;
+procedure tleft;
+procedure readinmacros;
+procedure changeuserdatawindow;
+procedure saveuf;
+
+implementation
+
+uses
+  common, common1, common3;
+
+procedure cpr(c1,c2:byte; u:userrec);
+var r:uflags;
+begin
+  for r:=rlogon to rmsg do begin
+    if (r in u.ac) then textattr:=c1 else textattr:=c2;
+    write(copy('LCVBA*PEKM',ord(r)+1,1));
+  end;
+  textattr:=c2; write('/');
+  for r:=fnodlratio to fnodeletion do begin
+    if (r in u.ac) then textattr:=c1 else textattr:=c2;
+    write(copy('1234',ord(r)-19,1));
+  end;
+end;
+
+procedure showudstats;
+begin
+  commandline('U/L: '+cstr(thisuser.uploads)+'/'+cstr(trunc(thisuser.uk))+'k'+
+           '  D/L: '+cstr(thisuser.downloads)+'/'+cstr(trunc(thisuser.dk))+'k'+
+           ' File Points:' +cstr(thisuser.filepoints));
+end;
+
+procedure skey1(c:char);
+var s:string[50];
+    cz,i:integer;
+    cc:char;
+    b,savwantout:boolean;
+begin
+  case ord(c) of
+    ALT_1..ALT_9:globat((ord(c)-ALT_1)+1);
+    ALT_MINUS:begin
+      writeln;
+      writeln('Stack space left : ',sptr,' bytes');
+      writeln;
+    end;
+    ALT_EQUAL:begin doneafternext:=not doneafternext; tleft; end;
+    CTRL_PRTSC:exiterrorlevel;
+  end;
+  if (not inwfcmenu) then
+  begin
+    case ord(c) of
+      ALT_F:showsysfunc;
+      ALT_G:
+        begin
+          commandline('Log options - [T]rap activity [C]hat buffering');
+          cc:=upcase(readkey);
+          with thisuser do
+            case cc of
+              'C':begin
+                    commandline('Auto chat buffering - [O]ff [S]eperate [M]ain (CHAT.MSG)');
+                    cc:=upcase(readkey);
+                    if (cc in ['O','S','M']) then chatfile(FALSE);
+                    case cc of
+                      'O':begin chatauto:=FALSE; chatseperate:=FALSE; end;
+                      'S':begin chatauto:=TRUE; chatseperate:=TRUE; end;
+                      'M':begin chatauto:=TRUE; chatseperate:=FALSE; end;
+                    end;
+                    if (cc in ['S','M']) then chatfile(TRUE);
+                    topscr;
+                  end;
+              'T':begin
+                    commandline('Activity trapping - [O]ff [S]eperate [M]ain (TRAP.MSG)');
+                    cc:=upcase(readkey);
+                    if (cc in ['O','S','M']) then
+                      if (trapping) then begin
+                        close(trapfile);
+                        trapping:=FALSE;
+                      end;
+                    case cc of
+                      'O':begin trapactivity:=FALSE; trapseperate:=FALSE; end;
+                      'S':begin trapactivity:=TRUE; trapseperate:=TRUE; end;
+                      'M':begin trapactivity:=TRUE; trapseperate:=FALSE; end;
+                    end;
+                    if (cc in ['S','M']) then inittrapfile;
+                    topscr;
+                  end;
+            end;
+          commandline('');
+        end;
+      ALT_L:cls;
+      ALT_T:
+        if (cwindowon) then begin
+          i:=systat.curwindow;
+          sclearwindow;
+          systat.istopwindow:=not systat.istopwindow;
+          cwindowon:=TRUE;
+          schangewindow(TRUE,i);
+        end;
+      ALT_V:
+        begin
+          autovalidate(thisuser,usernum);
+          topscr; commandline('User Validated.');
+        end;
+      F1:if (useron) then begin
+          wait(TRUE);
+          changeuserdatawindow;
+          wait(FALSE);
+        end;
+      SHIFT_F1:if (useron) then changeuserdatawindow;
+      F2:
+        if (useron) then begin
+          i:=systat.curwindow;
+          if (systat.windowon) then begin
+            inc(i);
+            if (i>2) then i:=1;
+          end else
+            systat.windowon:=TRUE;
+          schangewindow(TRUE,i);
+        end;
+      SHIFT_F2:
+         if (useron) then
+           if (not systat.windowon) then begin
+             systat.windowon:=TRUE;
+             cwindowon:=TRUE;
+             schangewindow(TRUE,systat.curwindow);
+           end else begin
+             sclearwindow;
+             systat.windowon:=FALSE;
+           end;
+      F3:
+        if (not com_carrier) then commandline('No carrier detected!')
+        else begin
+          if (outcom) then
+            if (incom) then incom:=FALSE else
+              if (com_carrier) then incom:=TRUE;
+          if (incom) then commandline('User keyboard ON.')
+                     else commandline('User keyboard OFF.');
+          com_flush_rx;
+        end;
+      F4:
+        begin
+          chatcall:=FALSE; chatr:='';
+          thisuser.ac:=thisuser.ac-[alert]; tleft;
+        end;
+      F5:hangup:=TRUE;
+      F6:if (useron) then topscr;
+      F7:
+        begin
+          b:=ch; ch:=TRUE;
+          dec(thisuser.tltoday,5);
+          tleft;
+          ch:=b;
+        end;
+      F8:
+        begin
+          b:=ch; ch:=TRUE;
+          inc(thisuser.tltoday,5);
+          if (thisuser.tltoday<0) then thisuser.tltoday:=32767;
+          tleft;
+          ch:=b;
+        end;
+      F9:
+        if (useron) then
+          with thisuser do begin
+            if (sl=255) then
+              if (realsl<>255) or (realdsl<>255) then begin
+                thisuser.sl:=realsl;
+                thisuser.dsl:=realdsl;
+                if (systat.compressbases) then newcomptables;
+                topscr; commandline('Normal access restored.');
+              end else
+            else begin
+              realsl:=sl; realdsl:=dsl;
+              thisuser.sl:=255;
+              thisuser.dsl:=255;
+              if (systat.compressbases) then newcomptables;
+              topscr; commandline('Temporary SysOp access granted.');
+            end;
+          end;
+      F10:
+        if (ch) then begin
+          ch:=FALSE;
+          chatr:='';
+        end else
+          chat;
+      ARROW_HOME:
+        if (ch) then chatfile(not cfo);
+      ARROW_UP,
+      ARROW_LEFT,
+      ARROW_RIGHT,
+      ARROW_DOWN:
+        if ((ch) or (write_msg)) then begin
+          if (okavatar) then buf:=buf+^V else buf:=buf+^[+'[';
+          case ord(c) of
+            ARROW_UP:if (okavatar) then buf:=buf+^C else buf:=buf+'A';
+            ARROW_LEFT:if (okavatar) then buf:=buf+^E else buf:=buf+'D';
+            ARROW_RIGHT:if (okavatar) then buf:=buf+^F else buf:=buf+'C';
+            ARROW_DOWN:if (okavatar) then buf:=buf+^D else buf:=buf+'B';
+          end;
+        end;
+      SHIFT_F3:
+        if (outcom) then begin
+          savwantout:=wantout; wantout:=FALSE;
+          wait(TRUE);
+          wantout:=savwantout;
+          commandline('User screen OFF  User keyboard OFF');
+          outcom:=FALSE; incom:=FALSE;
+        end else
+          if (not com_carrier) then commandline('No carrier detected!')
+          else begin
+            commandline('User screen ON  User keyboard ON');
+            savwantout:=wantout; wantout:=FALSE;
+            wait(FALSE);
+            wantout:=savwantout;
+            outcom:=TRUE; incom:=TRUE;
+          end;
+      SHIFT_F5:
+        begin
+          cline(s,'Display what hangup file (HANGUPxx.*) :');
+          commandline('');
+          if (s<>'') then begin
+						nl; nl; incom:=FALSE;
+            printf('hangup'+s);
+            sysoplog('++ Displayed hangup file HANGUP'+s);
+            hangup:=TRUE;
+          end;
+        end;
+      SHIFT_F7:
+        begin
+          wait(TRUE);
+          cline(s,'Subtract from user''s time left: ');
+          commandline('');
+          if (s<>'') then begin
+            b:=ch; ch:=TRUE;
+            dec(thisuser.tltoday,value(s));
+            tleft;
+            ch:=b;
+          end;
+          wait(FALSE);
+        end;
+      SHIFT_F8:
+        begin
+          wait(TRUE);
+          cline(s,'Add to user''s time left: ');
+          commandline('');
+          if (s<>'') then begin
+            b:=ch; ch:=TRUE;
+            inc(thisuser.tltoday,value(s));
+            if (thisuser.tltoday<=0) then thisuser.tltoday:=32767;
+            tleft;
+            ch:=b;
+          end;
+          wait(FALSE);
+        end;
+      SHIFT_F10:
+        begin
+          beepend:=not beepend;
+          b:=ch; ch:=TRUE;
+          tleft; ch:=b;
+        end;
+      ALT_F3:
+        if (wantout) then begin
+          clrscr; tc(11); writeln('Text OFF');
+          wantout:=FALSE;
+          cursoron(FALSE);
+        end else begin
+          clrscr; tc(11); writeln('Text ON');
+          wantout:=TRUE;
+          cursoron(TRUE);
+        end;
+      ALT_J,
+      ALT_F4:SysopShell(FALSE);
+      ALT_F5:
+        begin
+          randomize;
+          for i:=1 to 50 do prompt(chr(random(255)));
+          hangup:=TRUE;
+        end;
+      ALT_F9:
+        begin
+          repeat
+            outkey(^G);
+            commandline('Paging user...');
+            delay(100);
+            commandline('');
+            checkhangup;
+          until ((not empty) or (hangup));
+        end;
+      ALT_F10:commandline(chatr);
+      CTRL_F4:SysopShell(TRUE);
+      CTRL_F5:
+        begin
+          randomize;
+          s:='';
+          for i:=1 to random(50) do s:=s+chr(random(255));
+          prompt(s); (* dm(' '+s,c); *)
+        end;
+    end;
+  end;
+end;
+
+procedure savesystat;
+var systatf:file of systatrec;
+begin
+  assign(systatf,start_dir+'\status.dat');
+  rewrite(systatf); write(systatf,systat); close(systatf);
+end;
+
+procedure setacch(c:char; b:boolean; var u:userrec);
+begin
+  if (b) then if (not (tacch(c) in u.ac)) then acch(c,u);
+  if (not b) then if (tacch(c) in u.ac) then acch(c,u);
+end;
+
+procedure remove_port;
+begin
+  if (not localioonly) then com_deinstall;
+end;
+
+procedure openport(comport:byte; baud:longint; parity:char;
+                   databits,stopbits:byte);
+begin
+  if (not localioonly) then begin
+    com_set_parity(com_none,stopbits);
+    com_set_speed(baud);
+  end;
+end;
+
+procedure iport;
+var anyerrors:word;
+begin
+  if (not localioonly) then begin
+    if (com_installed) then com_deinstall;
+    com_install(modemr.comport,anyerrors,systat.fossil);
+    openport(modemr.comport,modemr.waitbaud,'N',8,1);
+  end;
+end;
+
+procedure gameport;
+var speed:longint;
+begin
+  if (not localioonly) then begin
+    if (spd='KB') then speed:=modemr.waitbaud else speed:=value(spd);
+    if ((not modemr.noforcerate) or (value(spd)<9600)) then
+      openport(modemr.comport,speed,'N',8,1);
+  end;
+end;
+
+procedure sendcom1(c:char);
+begin
+  if (not localioonly) then com_tx(c);
+end;
+
+function recom1(var c:char):boolean;
+begin
+  c:=#0;
+  if (localioonly) then recom1:=TRUE else begin
+    if (not com_rx_empty) then begin
+      c:=com_rx;
+      recom1:=TRUE;
+    end else
+      recom1:=FALSE;
+  end;
+end;
+
+procedure term_ready(ready_status:boolean);
+var mcr_value:byte;
+begin
+  if (not localioonly) then
+    if (ready_status) then com_raise_dtr else com_lower_dtr;
+end;
+
+function getwindysize(wind:integer):integer;
+begin
+  case wind of
+    0:getwindysize:=0;
+    1:getwindysize:=5;
+    2:getwindysize:=11;
+  end;
+end;
+
+procedure inuserwindow;
+begin
+  if (cwindowon) then
+    if (systat.istopwindow) then
+      window(1,getwindysize(systat.curwindow)+1,80,25)
+    else
+      window(1,1,80,25-getwindysize(systat.curwindow));
+end;
+
+procedure commandline(s:string);
+var p,xx,yy:integer;
+    sx,sy,sz:byte;
+begin
+  if (not useron) then exit;
+
+  sx:=wherex; sy:=wherey; sz:=textattr;
+  p:=40-(length(s) div 2);
+
+  window(1,1,80,25);
+  xx:=4; yy:=1;
+  if (not cwindowon) then xx:=1 else
+    if (systat.istopwindow) then
+      yy:=getwindysize(systat.curwindow)
+    else
+      yy:=26-getwindysize(systat.curwindow);
+
+  gotoxy(xx,yy);
+  if (not ismono) then textattr:=$1F else textattr:=$70;
+  if (not cwindowon) then clreol else
+    write('                                                                          ');
+  gotoxy(xx,yy); write(s);
+
+  inuserwindow;
+  gotoxy(sx,sy); textattr:=sz;
+end;
+
+procedure clrline(y:integer);
+begin
+  gotoxy(1,y); clreol;
+end;
+
+procedure sclearwindow;
+var wind:windowrec;
+    i,windysize:integer;
+    x,y,z:byte;
+begin
+  if ((not cwindowon) or (not useron) or (not systat.windowon)) then exit;
+
+  x:=wherex; y:=wherey; z:=textattr;
+  windysize:=getwindysize(systat.curwindow);
+  cursoron(FALSE);
+
+  window(1,1,80,25); textattr:=7;
+  if (not systat.istopwindow) then
+    for i:=26-windysize to 25 do clrline(i)
+  else begin
+    savescreen(wind,1,windysize+1,80,25);
+    for i:=1 to windysize do clrline(i);
+    movewindow(wind,1,1);
+    for i:=26-windysize to 25 do clrline(i);
+  end;
+  cwindowon:=FALSE;
+
+  gotoxy(x,y); textattr:=z;
+  cursoron(TRUE);
+end;
+
+procedure schangewindow(needcreate:boolean; newwind:integer);
+var wind:windowrec;
+    i,j,k,windysize,z:integer;
+    sx,sy,sz:byte;
+begin
+  if (((not useron) and (not needcreate)) or (not systat.windowon)) then exit;
+
+  sx:=wherex; sy:=wherey; sz:=textattr;
+  windysize:=getwindysize(newwind);
+
+  if (not needcreate) then needcreate:=(newwind<>systat.curwindow);
+  if ((windysize<>getwindysize(systat.curwindow)) and (cwindowon)) then
+    sclearwindow;
+
+  if (not systat.istopwindow) then begin
+    cursoron(FALSE);
+    if ((needcreate) and (newwind in [1,2])) then begin
+      window(1,1,80,25);
+      gotoxy(1,25);
+      if (sy>25-windysize) then begin
+        z:=windysize-(25-sy);
+        for i:=1 to z do writeln;
+        dec(sy,z);
+      end;
+    end;
+    gotoxy(sx,sy);
+  end else begin
+    if ((needcreate) and (newwind in [1,2])) then begin
+      window(1,1,80,25);
+      savescreen(wind,1,1,80,sy);
+      if (sy<=25-windysize) then z:=windysize+1 else z:=26-sy;
+      if (z>=2) then movewindow(wind,1,z);
+      if (z<=4) then sy:=(sy-z)+1;
+
+      if (sy>25-windysize) then sy:=25-windysize;
+      if (sy<1) then sy:=1;
+    end;
+    cursoron(TRUE);
+  end;
+
+  systat.curwindow:=newwind;
+  if (systat.curwindow<>0) then cwindowon:=TRUE;
+  gotoxy(sx,sy); textattr:=sz;
+  if (systat.curwindow in [1,2]) then topscr;
+end;
+
+procedure blankzlog(var zz:zlogrec);
+var i:integer;
+begin
+  with zz do begin
+    date:=' ------ ';
+    for i:=0 to 4 do userbaud[i]:=0;
+    active:=0; calls:=0; newusers:=0; pubpost:=0; privpost:=0;
+    fback:=0; criterr:=0; uploads:=0; downloads:=0; uk:=0; dk:=0;
+  end;
+end;
+
+function mrnn(i,l:integer):string;
+begin
+  mrnn:=mrn(cstr(i),l);
+end;
+
+function ctp(t,b:longint):string;
+var s,s1:string[32];
+    n:real;
+begin
+  s:=cstr((t*100) div b);
+  if (length(s)=1) then s:=' '+s;
+  s:=s+'.';
+  if (length(s)=3) then s:=' '+s;
+  n:=t/b+0.0005;
+  s1:=cstr(trunc(n*1000) mod 10);
+  ctp:=s+s1+'%';
+end;
+
+procedure topscr;
+var zf:file of zlogrec;
+    zz:array[1..3] of zlogrec;
+    s,spe:string;
+    i,j,k,windysize:integer;
+    sx,sy,sz:byte;
+    c:char;
+begin
+  if ((usernum=0) or (not cwindowon) or (not useron)) then exit;
+
+  cursoron(FALSE);
+  sx:=wherex; sy:=wherey; sz:=textattr;
+  window(1,1,80,25); windysize:=getwindysize(systat.curwindow);
+  textbackground(0);
+
+  if (systat.istopwindow) then window(1,1,80,windysize)
+    else window(1,26-windysize,80,25);
+  for i:=1 to windysize do begin gotoxy(1,i); clreol; end;
+
+  if (systat.istopwindow) then gotoxy(1,windysize) else gotoxy(1,1);
+  tc(9); textbackground(1); clreol; textbackground(0);
+
+  if (systat.istopwindow) then window(1,1,80,windysize-1)
+    else window(1,27-windysize,80,25);
+
+  with thisuser do
+    case systat.curwindow of
+      1:begin
+          cwriteat(1,1, #3#11+nam);
+          cwriteat(36,1,#3#14+'PS:'+#3#11+mn(msgpost,6)+
+                        #3#14+'ES:'+#3#11+mn(emailsent,6)+
+                        #3#14+'FS:'+#3#11+mn(feedback,4)+
+                        #3#14+'MW:'+#3#11+mn(waiting,3));
+          cwrite(#3#14+'UL:'+#3#11+cstr(uploads)+'-'+cstr(uk)+'k');
+          cwriteat(1,2, #3#11+realname);
+          cwriteat(36,2,#3#14+'TC:'+#3#11+mn(loggedon,6)+
+                        #3#14+'TT:'+#3#11+mn(ttimeon,6)+
+                        #3#14+'CT:'+#3#11+mn(ontoday,4)+
+                        #3#14+'IL:'+#3#11+mn(illegal,3));
+          cwrite(#3#14+'DL:'+#3#11+cstr(downloads)+'-'+cstr(dk)+'k');
+          spe:=spd;
+          if (length(spe)=5) then spe:=copy(spe,1,2)+'.'+copy(spe,3,1);
+          if (spe='KB') then spe:='Keys';
+          cwriteat(1,3, #3#10+note);
+          cwriteat(36,3,#3#11+sex+mn(ageuser(bday),2)+
+                        #3#14+'('+#3#11+bday+#3#14+')  '+
+                        #3#14+'LO:('+#3#11+laston+#3#14+') '+
+                        #3#9+'['+spe+'] '+
+                        #3#14+'Pts:'+#3#11+cstr(filepoints));
+          cwriteat(1,4, #3#14+'SL:'+#3#11+mn(sl,4)+
+                        #3#14+'DSL:'+#3#11+mn(dsl,4)+
+                        #3#14+'AR:');
+          for c:='A' to 'Z' do begin
+            if (c in ar) then tc(4) else tc(7);
+            write(c);
+          end;
+          cwrite(#3#14+' AC:');
+          if (ismono) then cpr($70,$07,thisuser) else cpr(4,7,thisuser);
+        end;
+      2:begin
+          if ((aacs(systat.nodlratio)) or (fnodlratio in thisuser.ac)) then
+            s:=#3#10+'Exempt'
+          else
+            s:=#3#11+'1/'+cstr(systat.dlratio[thisuser.sl])+
+                   '-1k/'+cstr(systat.dlkratio[thisuser.sl])+'k';
+          cwriteat(1,1, #3#11+caps(name)+' ('+caps(realname)+')');
+          cwriteat(38,1,#3#11+sex+mn(ageuser(bday),2)+'('+bday+') '+
+                        #3#14+'FileRatio='+s);
+
+          if ((aacs(systat.nopostratio)) or (fnopostratio in thisuser.ac)) then
+            s:=#3#10+'Exempt'
+          else begin
+            i:=systat.postratio[thisuser.sl];
+            s:=#3#11+cstr(i div 10)+'.'+cstr(i mod 10)+' calls/1 post';
+          end;
+          cwriteat(1,2, #3#14+street);
+          cwriteat(38,2,#3#14+'FO:('+#3#11+firston+#3#14+') '+
+                        'PostRatio='+s);
+
+          cwriteat(1,3, #3#14+citystate+' '+zipcode);
+          cwriteat(38,3,#3#14+'LO:('+#3#11+laston+#3#14+') AR=');
+          for c:='A' to 'Z' do begin
+            if (c in ar) then tc(4) else tc(7);
+            write(c);
+          end;
+
+          cwriteat(1,4, #3#11+stripcolor(computer)+
+                        ' ('+cstr(linelen)+'x'+cstr(pagelen)+')');
+          cwriteat(38,4,#3#14+ph+'  AC=');
+          if (ismono) then cpr($70,$07,thisuser) else cpr(4,7,thisuser);
+
+          cwriteat(1,5, #3#10+note);
+          cwriteat(50,5,#3#14+'SL='+#3#11+mn(sl,4)+
+                        #3#14+'DSL='+#3#11+mn(dsl,3));
+
+          cwriteat(1,6, #3#9+'陳陳陳陳'+#3#11+'Mins'+
+                        #3#9+'賃陳陳堕陳陳賃'+#3#11+'#New'+
+                        #3#9+''+#3#11+'Tim/'+
+                        #3#9+''+#3#11+'Pub'+
+                        #3#9+'賃'+#3#11+'Priv'+
+                        #3#9+''+#3#11+'Feed'+
+                        #3#9+'堕陳賃陳陳陳陳陳堕陳陳陳陳賃');
+
+          cwriteat(1,7, #3#11+'  Date   Activ Call %Activ User User '+
+                              'Post Post Back Errs Uploads    Downloads');
+
+          zz[1]:=systat.todayzlog;
+
+          assign(zf,systat.gfilepath+'zlog.dat');
+          {$I-} reset(zf); {$I+}
+          if (ioresult=0) then begin
+            if (eof(zf)) then blankzlog(zz[2]) else read(zf,zz[2]);
+            if (eof(zf)) then blankzlog(zz[3]) else read(zf,zz[3]);
+            close(zf);
+          end else begin
+            blankzlog(zz[2]);
+            blankzlog(zz[3]);
+          end;
+
+          textcolor(9);
+          for i:=7 to 10 do
+            for j:=1 to 12 do begin
+              case j of
+                1:k:=9; 2:k:=15; 3:k:=20; 4:k:=27; 5:k:=32; 6:k:=37;
+                7:k:=42; 8:k:=47; 9:k:=52; 10:k:=57; 11:k:=68; 12:k:=79;
+              end;
+              gotoxy(k,i); write('');
+            end;
+
+          textcolor(14);
+          for i:=1 to 3 do begin
+            if (i=2) then textcolor(11);
+            if (i=1) then cwriteat(1,8,'Today''s')
+              else cwriteat(1,i+7,zz[i].date);
+            cwriteat(10,i+7,mrnn(zz[i].active,5));
+            cwriteat(16,i+7,mrnn(zz[i].calls,4));
+            cwriteat(21,i+7,ctp(zz[i].active,1440));
+            cwriteat(28,i+7,mrnn(zz[i].newusers,4));
+            if (zz[i].calls>0) then s:=mrnn(zz[i].active div zz[i].calls,4)
+              else s:='';
+            cwriteat(33,i+7,s);
+            cwriteat(38,i+7,mrnn(zz[i].pubpost,4));
+            cwriteat(43,i+7,mrnn(zz[i].privpost,4));
+            cwriteat(48,i+7,mrnn(zz[i].fback,4));
+            cwriteat(53,i+7,mrnn(zz[i].criterr,4));
+            cwriteat(58,i+7,mn(zz[i].uploads,3)+'-'+cstr(zz[i].uk)+'k');
+            cwriteat(69,i+7,mn(zz[i].downloads,3)+'-'+cstr(zz[i].dk)+'k');
+          end;
+        end;
+    end;
+
+(*  with thisuser do begin
+    gotoxy(2,1);
+    tc(14); write(nam+' '); tc(11); write('('+realname+')');
+    tc(14);
+    gotoxy(2,2); write('SL=     AR=');
+    gotoxy(2,3); write('DSL=    AC=');
+    tc(11);
+    gotoxy(6,2); if res[1]<>255 then write(sl) else write(res[2]);
+    gotoxy(6,3); if res[1]<>255 then write(dsl) else write(res[3]);
+    gotoxy(13,2);
+    for c:='A' to 'Z' do begin
+      if (c in ar) then tc(4) else tc(7);
+      write(c);
+    end;
+    gotoxy(13,3); cpr(7,thisuser);
+    gotoxy(28,3); write('        ');
+
+    tc(10);
+    gotoxy(40,1); write(note);
+    tc(14);
+    gotoxy(40,2); write(stripcolor(computer)+' (',linelen,'x',pagelen,')');
+    gotoxy(40,3); write(ph);
+    tc(9);
+    spe:=spd;
+    if (length(spe)=5) then spe:=copy(spe,1,2)+'.'+copy(spe,3,1);
+    if (spe='KB') then spe:='Keys';
+    gotoxy(61,3); write('['+spe+']');
+    tc(11);
+    gotoxy(76,2); write(sex,ageuser(bday));
+  end;*)
+
+  commandline(chatr);
+  textbackground(0);
+  inuserwindow;
+  gotoxy(sx,sy); textattr:=sz;
+  sde;
+  tleft;
+  cursoron(TRUE);
+end;
+
+procedure gotopx(i:integer; dy:integer);
+var y:integer;
+begin
+  if (systat.istopwindow) then y:=getwindysize(systat.curwindow)-1
+    else y:=25;
+  if (systat.curwindow=2) then dec(y,5);
+  gotoxy(i,y+dy);
+end;
+
+procedure tleft;
+var s:string[16];
+    lng:longint;
+    zz:integer;
+    sx,sy,sz:byte;
+begin
+  stsc;
+  if ((usernum<>0) and (cwindowon) and (useron)) then begin
+    cursoron(FALSE);
+    sx:=wherex; sy:=wherey; sz:=textattr;
+    window(1,1,80,25);
+    gotopx(65,0); clreol;
+    if (hangup) then cwrite(#3#21+''+#3#29+'DROP'+#3#21+'') else
+      if (doneafternext) then cwrite(#3#20+''+#3#30+'DNXT'+#3#20+'') else
+      if (beepend) then cwrite(#3#20+'<'+#3#28+'('+#3#14+'**'+#3#28+')'+#3#20+'>') else
+      if (trapping) then cwrite(#3#20+''+#3#30+'TRAP'+#3#20+'') else
+      if (alert in thisuser.ac) then cwrite(#3#20+''+#3#30+'ALRT'+#3#20+'') else
+      if (chatr<>'') then cwrite(#3#25+''+#3#27+'CHAT'+#3#25+'');
+    gotopx(72,0);
+    cwrite(#3#7+'TL='+cstrl(trunc(nsl/60)));
+    if (sysop) then cwrite(#3#15+'*');
+    if (systat.curwindow=2) then begin
+      gotopx(72,-1);
+      if (thisuser.chatauto) then s:=#3#15 else
+        if (systat.autochatopen) then s:=#3#11 else s:=#3#8;
+      s:=s+'C';
+      if (thisuser.chatseperate) then s:=s+#3#15+'S' else
+        s:=s+#3#8+'S';
+      if (thisuser.trapactivity) then s:=s+#3#15+'T' else
+        if (systat.globaltrap) then s:=s+#3#11+'T' else s:=s+#3#8+'T';
+      if (thisuser.trapseperate) then s:=s+#3#15+'S' else
+        s:=s+#3#8+'S';
+      cwrite(s);
+    end;
+    inuserwindow;
+    gotoxy(sx,sy); textattr:=sz;
+    cursoron(TRUE);
+  end;
+  if ((nsl<0) and (choptime<>0.0)) then begin
+    sysoplog('++ Logged user off in preparation for system event');
+    nl; nl;
+    sprint(#3#7+^G'Shutting down for System Event.'^G);
+    nl;
+    hangup:=TRUE;
+  end;
+  if ((not ch) and (nsl<0) and (useron) and (choptime=0.0)) then begin
+    nl; nl;
+
+    printf('notleft');
+    if (nofile) then
+      sprint(#3#7+'You have used up all your time.  Time expired.');
+
+    if (thisuser.timebank<>0) then begin
+      nl;
+      sprint(#3#5+'Your Time Bank account has '+
+             #3#3+cstr(thisuser.timebank)+#3#5+' minutes left in it.');
+      dyny:=TRUE;
+      if pynq('Withdraw from Time Bank? [Y] : ') then begin
+        prt('Withdraw how many minutes? '); inu(zz); lng:=zz;
+        if (lng>0) then begin
+          if lng>thisuser.timebank then lng:=thisuser.timebank;
+          dec(thisuser.timebankadd,lng);
+          if (thisuser.timebankadd<0) then thisuser.timebankadd:=0;
+          dec(thisuser.timebank,lng);
+          inc(thisuser.tltoday,lng);
+          sprint('^5In your account: ^3'+cstr(thisuser.timebank)+
+                  '^5   Time left online: ^3'+cstr(trunc(nsl) div 60));
+          sysoplog('TimeBank: Time expired, withdrew '+cstrl(lng)+' minutes.');
+        end;
+      end else
+        sprint(#3#7+'Hanging up.');
+    end;
+    if (nsl<0) then hangup:=TRUE;
+  end;
+  checkhangup;
+  sde;
+end;
+
+procedure gp(i,j:integer);
+var x:integer;
+begin
+  case j of
+    0:gotoxy(58,8);
+    1:gotoxy(20,7); 2:gotoxy(20,8); 3:gotoxy(20,9);
+    4:gotoxy(20,10); 5:gotoxy(36,7); 6:gotoxy(36,8);
+  end;
+  if (j in [1..4]) then x:=5 else x:=3;
+  if (i=2) then inc(x);
+  if (i>0) then gotoxy(wherex+x,wherey);
+end;
+
+procedure changeuserdatawindow;
+var wind:windowrec;
+    s:string[39];
+    oo,i,oldsl,{realsl,realdsl,}savsl,savdsl:integer;
+    c:char;
+    sx,sy,ta:byte;
+    done,done1:boolean;
+
+  procedure shd(i:integer; b:boolean);
+  var j:integer;
+      c:char;
+  begin
+    gp(0,i);
+    if (b) then textcolor(14) else textcolor(9);
+    case i of
+      1:write('SL  :'); 2:write('DSL :'); 3:write('FP  :');
+      4:write('Note:'); 5:write('AR:');   6:write('AC:');
+    end;
+    if (b) then begin textcolor(0); textbackground(7); end else textcolor(14);
+    write(' ');
+    with thisuser do
+      case i of
+        0:if (b) then write('Done')
+          else begin
+            textcolor(9); write('');
+            textcolor(11); write('Done');
+            textcolor(9); write('');
+          end;
+        1:write(mln(cstr(sl),3));
+        2:write(mln(cstr(dsl),3));
+        3:write(mln(cstrl(filepoints),5));
+        4:write(mln(note,39));
+        5:for c:='A' to 'Z' do begin
+            if (c in ar) then textcolor(4)
+              else if (b) then textcolor(0) else textcolor(7);
+            write(c);
+          end;
+        6:if (b) then cpr($07,$70,thisuser) else cpr($70,$07,thisuser);
+      end;
+    write(' ');
+    textbackground(0);
+    cursoron(i in [1..4]);
+
+    if (b) then begin
+      gotoxy(26,12); textcolor(14);
+      for j:=1 to 41 do write(' ');
+      gotoxy(26,12);
+      case i of
+        0:write('Done -  exit back to BBS');
+        1:write('Security Level (0..255)');
+        2:write('Download Security Level (0..255)');
+        3:write('File Points');
+        4:write('Special SysOp note for this user');
+        5:write('Special access flags ("!" to toggle all)');
+        6:write('Restrictions & special ("!" to clear)');
+      end;
+    end;
+  end;
+
+  procedure ddwind;
+  var i:integer;
+      c:char;
+  begin
+    cursoron(FALSE);
+    textcolor(9);
+    box(1,18,6,68,13); window(19,7,67,12); clrscr;
+    box(1,18,6,68,11); window(19,7,67,10);
+
+    window(1,1,80,25);
+    gotoxy(20,12); textcolor(9); write('Desc:');
+
+    for i:=0 to 6 do shd(i,FALSE);
+
+    shd(oo,TRUE);
+  end;
+
+  procedure ar_tog(c:char);
+  begin
+    if (c in thisuser.ar) then thisuser.ar:=thisuser.ar-[c]
+      else thisuser.ar:=thisuser.ar+[c];
+  end;
+
+begin
+  saveuf;
+{
+  if ((realsl<>-1) and (realdsl<>-1)) then begin
+    savsl:=thisuser.sl; savdsl:=thisuser.dsl;
+    thisuser.sl:=realsl; thisuser.dsl:=realdsl;
+    saveuf;
+    thisuser.sl:=savsl; thisuser.dsl:=savdsl;
+  end;}
+
+  infield_out_fgrd:=0;
+  infield_out_bkgd:=7;
+  infield_inp_fgrd:=0;
+  infield_inp_bkgd:=7;
+  infield_arrow_exit:=TRUE;
+  infield_arrow_exited:=FALSE;
+
+  sx:=wherex; sy:=wherey; ta:=textattr;
+  savescreen(wind,18,6,68,13);
+  oo:=1;
+
+  ddwind;
+  done:=FALSE;
+  repeat
+    infield_arrow_exited:=FALSE;
+    case oo of
+      0:begin
+          done1:=FALSE;
+          shd(oo,TRUE);
+          repeat
+            c:=readkey;
+            case upcase(c) of
+              ^M:begin done:=TRUE; done1:=TRUE; end;
+              #0:begin
+                   c:=readkey;
+                   case ord(c) of
+                     ARROW_DOWN,ARROW_UP:
+                       begin
+                         infield_arrow_exited:=TRUE;
+                         infield_last_arrow:=ord(c);
+                         done1:=TRUE;
+                       end;
+                   end;
+                 end;
+            end;
+          until (done1);
+        end;
+      1:begin
+          s:=cstr(thisuser.sl); infield1(26,7,s,3);
+          if (value(s)<>thisuser.sl) then begin
+            realsl:=value(s);
+            thisuser.sl:=value(s);
+            inc(thisuser.tltoday,
+                systat.timeallow[thisuser.sl]-systat.timeallow[realsl]);
+          end;
+        end;
+      2:begin
+          s:=cstr(thisuser.dsl); infield1(26,8,s,3);
+          if (value(s)<>thisuser.dsl) then begin
+            realdsl:=value(s);
+            thisuser.dsl:=value(s);
+          end;
+        end;
+      3:begin
+          s:=cstr(thisuser.filepoints); infield1(26,9,s,5);
+          thisuser.filepoints:=value(s);
+        end;
+      4:begin
+          s:=thisuser.note; infield1(26,10,s,39);
+          thisuser.note:=s;
+        end;
+      5:begin
+          done1:=FALSE;
+          repeat
+            c:=upcase(readkey);
+            case c of
+              #13:done1:=TRUE;
+              #0:begin
+                   c:=readkey;
+                   case ord(c) of
+                     ARROW_DOWN,ARROW_UP:
+                       begin
+                         infield_arrow_exited:=TRUE;
+                         infield_last_arrow:=ord(c);
+                         done1:=TRUE;
+                       end;
+                   end;
+                 end;
+              '!':begin
+                    for c:='A' to 'Z' do ar_tog(c);
+                    shd(oo,TRUE);
+                  end;
+              'A'..'Z':begin ar_tog(c); shd(oo,TRUE); end;
+            end;
+          until (done1);
+        end;
+      6:begin
+          s:='LCVBA*PEKM1234';
+          done1:=FALSE;
+          repeat
+            c:=upcase(readkey);
+            if (c=#13) then done1:=TRUE
+            else
+            if (c=#0) then begin
+              c:=readkey;
+              case ord(c) of
+                ARROW_DOWN,ARROW_UP:
+                  begin
+                    infield_arrow_exited:=TRUE;
+                    infield_last_arrow:=ord(c);
+                    done1:=TRUE;
+                  end;
+              end;
+            end
+            else
+            if (pos(c,s)<>0) then begin
+              acch(c,thisuser);
+              shd(oo,TRUE);
+            end
+            else begin
+              if (c='!') then
+                for i:=1 to length(s) do setacch(s[i],FALSE,thisuser);
+              shd(oo,TRUE);
+            end;
+          until (done1);
+        end;
+    end;
+    if (not infield_arrow_exited) then begin
+      infield_arrow_exited:=TRUE;
+      infield_last_arrow:=ARROW_DOWN;
+    end;
+    if (infield_arrow_exited) then
+      case infield_last_arrow of
+        ARROW_DOWN,ARROW_UP:begin
+          shd(oo,FALSE);
+          if (infield_last_arrow=ARROW_DOWN) then begin
+            inc(oo);
+            if (oo>6) then oo:=0;
+          end else begin
+            dec(oo);
+            if (oo<0) then oo:=6;
+          end;
+          shd(oo,TRUE);
+        end;
+      end;
+  until (done);
+
+  removewindow(wind); topscr;
+  gotoxy(sx,sy); textattr:=ta;
+  cursoron(TRUE);
+  if (systat.compressbases) then newcomptables;
+
+  saveuf;
+
+{  if ((realsl<>-1) and (realdsl<>-1)) then begin
+    savsl:=thisuser.sl; savdsl:=thisuser.dsl;
+    thisuser.sl:=realsl; thisuser.dsl:=realdsl;
+    saveuf;
+    thisuser.sl:=savsl; thisuser.dsl:=savdsl;
+  end;}
+end;
+
+procedure readinmacros;
+var macrf:file of macrorec;
+    i:integer;
+begin
+  for i:=1 to 4 do macros.macro[i]:='';
+  if (thisuser.mpointer<>-1) then begin
+    assign(macrf,systat.gfilepath+'macro.lst');
+    {$I-} reset(macrf); {$I+}
+    if (ioresult<>0) then begin
+      sysoplog('!!! "MACRO.LST" file not found.  Created.');
+      rewrite(macrf); close(macrf); reset(macrf);
+    end;
+    if (filesize(macrf)>thisuser.mpointer) then begin
+      seek(macrf,thisuser.mpointer);
+      read(macrf,macros);
+    end else
+      thisuser.mpointer:=-1;
+    close(macrf);
+  end;
+end;
+
+procedure saveuf;
+var savsl,savdsl:integer;
+    ufo:boolean;
+begin
+  if ((realsl<>-1) and (realdsl<>-1)) then begin
+    savsl:=thisuser.sl; savdsl:=thisuser.dsl;
+    thisuser.sl:=realsl; thisuser.dsl:=realdsl;
+
+    ufo:=(filerec(uf).mode<>fmclosed);
+    if (not ufo) then reset(uf);
+    seek(uf,usernum); write(uf,thisuser);
+    if (not ufo) then close(uf);
+
+    thisuser.sl:=savsl; thisuser.dsl:=savdsl;
+  end;
+end;
+
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common3.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,274 @@
+{$A+,B+,D-,E+,F+,I+,L+,N-,O+,R-,S+,V-}
+unit common3;
+
+interface
+
+uses
+  crt, dos,
+  myio,
+  tmpcom;
+
+procedure inu(var i:integer);
+procedure ini(var i:byte);
+procedure inputwn1(var v:string; l:integer; flags:string; var changed:boolean);
+procedure inputwn(var v:string; l:integer; var changed:boolean);
+procedure inputwnwc(var v:string; l:integer; var changed:boolean);
+procedure inputmain(var s:string; ml:integer; flags:string);
+procedure inputwc(var s:string; ml:integer);
+procedure input(var s:string; ml:integer);
+procedure inputl(var s:string; ml:integer);
+procedure inputcaps(var s:string; ml:integer);
+procedure mmkey(var s:string);
+
+implementation
+
+uses
+  common, common1, common2;
+
+procedure inu(var i:integer);
+var s:string[5];
+begin
+  badini:=FALSE;
+  input(s,5); i:=value(s);
+  if (s='') then badini:=TRUE;
+end;
+
+procedure ini(var i:byte);
+var s:string[3];
+begin
+  badini:=FALSE;
+  input(s,3); i:=value(s);
+  if s='' then badini:=TRUE;
+end;
+
+procedure inputwn1(var v:string; l:integer; flags:string; var changed:boolean);
+var s,os:string;
+begin
+  os:=v;
+  inputmain(s,l,flags);
+  if (s=' ') then
+    if pynq('Set to NULL string? ') then v:='' else
+	begin
+	end
+  else if (s<>'') then v:=s;
+  if (os<>v) then changed:=TRUE;
+end;
+
+procedure inputwn(var v:string; l:integer; var changed:boolean);
+begin
+  inputwn1(v,l,'',changed);
+end;
+
+procedure inputwnwc(var v:string; l:integer; var changed:boolean);
+begin
+  inputwn1(v,l,'c',changed);
+end;
+
+(* flags: "U" - Uppercase only
+          "C" - Colors allowed
+          "L" - Linefeeds OFF - no linefeed after <CR> pressed
+          "D" - Display old if no change
+          "P" - Capitalize characters ("ERIC OMAN" --> "Eric Oman")
+*)
+procedure inputmain(var s:string; ml:integer; flags:string);
+var os:string;
+    cp:integer;
+    c:char;
+    origcolor:byte;
+    xxupperonly,xxcolor,xxnolf,xxredisp,xxcaps:boolean;
+
+  procedure dobackspace;
+  var i:integer;
+      c:byte;
+  begin
+    if (cp>1) then begin
+      dec(cp);
+      if (s[cp] in [#32..#255]) then begin
+        outkey(^H); outkey(' '); outkey(^H);
+        if (trapping) then write(trapfile,^H' '^H);
+        if (pap>0) then dec(pap);
+      end else begin
+        dec(pap);
+        if (cp>1) then
+          if (not (s[cp-1] in [#32..#255])) then begin
+            dec(cp); dec(pap);
+            if (s[cp]=#3) then begin
+              c:=origcolor;
+              i:=1;
+              while (i<=cp-1) do begin
+                if (s[i]=#3) then begin
+                  c:=thisuser.cols[color in thisuser.ac][ord(s[i+1])];
+                  inc(i);
+                end;
+                inc(i);
+              end;
+              setc(c);
+            end;
+          end;
+      end;
+    end;
+  end;
+
+begin
+  flags:=allcaps(flags);
+  xxupperonly:=(pos('U',flags)<>0); xxcolor:=(pos('C',flags)<>0);
+  xxnolf:=(pos('L',flags)<>0); xxredisp:=(pos('D',flags)<>0);
+  xxcaps:=(pos('P',flags)<>0);
+  origcolor:=curco; os:=s;
+
+  checkhangup;
+  if (hangup) then exit;
+  cp:=1;
+  repeat
+    getkey(c);
+    if (xxupperonly) then c:=upcase(c);
+    if (xxcaps) then
+      if (cp>1) then begin
+        if (c in ['A'..'Z','a'..'z']) then
+          if (s[cp-1] in ['A'..'Z','a'..'z']) then begin
+            if (c in ['A'..'Z']) then c:=chr(ord(c)+32);
+          end else
+            if (c in ['a'..'z']) then c:=chr(ord(c)-32);
+      end else
+        c:=upcase(c);
+    if (c in [#32..#255]) then
+      if (cp<=ml) then begin
+        s[cp]:=c; inc(cp); inc(pap); outkey(c);
+        if (trapping) then write(trapfile,c);
+      end else
+	  begin
+	  end
+    else case c of
+      ^H:dobackspace;
+      ^P:if ((xxcolor) and (cp<=ml-1)) then begin
+           getkey(c);
+           if (c in ['0'..'9']) then begin
+             cl(ord(c)-48);
+             s[cp]:=#3; s[cp+1]:=chr(ord(c)-48);
+             inc(cp,2);
+           end;
+         end;
+      ^X:while (cp<>1) do dobackspace;
+    end;
+  until ((c=^M) or (c=^N) or (hangup));
+  s[0]:=chr(cp-1);
+  if ((xxredisp) and (s='')) then begin
+    s:=os;
+    prompt(s);
+  end;
+  if (not xxnolf) then nl;
+end;
+
+procedure inputwc(var s:string; ml:integer);
+  begin inputmain(s,ml,'c'); end;
+
+procedure input(var s:string; ml:integer);
+  begin inputmain(s,ml,'u'); end;
+
+procedure inputl(var s:string; ml:integer);
+  begin inputmain(s,ml,''); end;
+
+procedure inputcaps(var s:string; ml:integer);
+  begin inputmain(s,ml,'p'); end;
+
+procedure mmkey(var s:string);
+var s1:string;
+    i,newarea:integer;
+    c,cc:char;
+    achange,bb:boolean;
+begin
+  s:='';
+  if (buf<>'') then
+    if (copy(buf,1,1)='`') then begin
+      buf:=copy(buf,2,length(buf)-1);
+      i:=pos('`',buf);
+      if (i<>0) then begin
+        s:=allcaps(copy(buf,1,i-1));
+        buf:=copy(buf,i+1,length(buf)-i);
+        nl;
+        exit;
+      end;
+    end;
+
+  if (not (onekey in thisuser.ac)) then
+    input(s,60)
+  else
+    repeat
+      achange:=FALSE;
+      repeat
+        getkey(c); c:=upcase(c);
+      until ((c in [^H,^M,#32..#255]) or (hangup));
+      if (c<>^H) then begin
+        outkey(c);
+        if (trapping) then write(trapfile,c);
+        inc(pap);
+      end;
+      if (c='/') then begin
+        s:=c;
+        repeat
+          getkey(c); c:=upcase(c);
+        until (c in [^H,^M,#32..#255]) or (hangup);
+        if (c<>^M) then begin
+          case c of
+            #225:bb:=bb; {* do nothing *}
+          else
+               begin
+                 outkey(c);
+                 if (trapping) then write(trapfile,c);
+               end;
+          end;
+          inc(pap);
+        end else
+          nl;
+        if (c in [^H,#127]) then prompt(' '+c);
+        if (c in ['/',#225]) then begin
+          bb:=systat.localsec;
+          cc:=fstring.echoc;
+          if (c=#225) then begin
+            systat.localsec:=TRUE;
+            fstring.echoc:=' ';
+            echo:=FALSE;
+          end;
+          cl(6); input(s,60);
+          systat.localsec:=bb;
+          fstring.echoc:=cc;
+          echo:=TRUE;
+        end else
+          if (not (c in [^H,#127,^M])) then begin s:=s+c; nl; end;
+      end else
+      if (c=';') then begin
+        input(s,60);
+        s:=c+s;
+      end else
+      if (c in ['0'..'9']) and ((fqarea) or (mqarea)) then begin
+        s:=c; getkey(c);
+        if (c in ['0'..'9']) then begin
+          print(c);
+          s:=s+c;
+        end;
+        if (c=^M) then nl;
+        if (c in [^H,#127]) then prompt(c+' '+c);
+      end else
+        if (c=^M) then nl
+        else
+        if (c<>^H) then begin
+          s:=c;
+          nl;
+        end;
+    until (not (c in [^H,#127])) or (hangup);
+  if (pos(';',s)<>0) then                 {* "command macros" *}
+    if (copy(s,1,2)<>'\\') then begin
+      if (onekey in thisuser.ac) then begin
+        s1:=copy(s,2,length(s)-1);
+         if (copy(s1,1,1)='/') then s:=copy(s1,1,2) else s:=copy(s1,1,1);
+         s1:=copy(s1,length(s)+1,length(s1)-length(s));
+      end else begin
+        s1:=copy(s,pos(';',s)+1,length(s)-pos(';',s));
+        s:=copy(s,1,pos(';',s)-1);
+      end;
+      while (pos(';',s1)<>0) do s1[pos(';',s1)]:=^M;
+      dm(' '+s1,c);
+    end;
+end;
+
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/conv17a.pas	Sat Nov 18 00:33:00 2000 +0000
@@ -0,0 +1,969 @@
+{$B+}                   { Boolean complete evaluation on }
+{$F+}                   { Far calls on }
+{$I+}                   { I/O checking off }
+{$N-}                   { No numeric coprocessor }
+{$R-}                   { Range checking off }
+{$S+}                   { Stack checking off }
+{$V-}                   { Var-checking off }
+
+{$M 50000,0,90000}      { Declared here suffices for all Units as well! }
+
+uses
+  crt,dos,
+  myio;
+
+const
+  needconv = 'S';
+
+{rcg11172000 hmm...don't have this file...}
+{I rcc16e2.pas}
+
+{$I rec17a.pas}
+{$I rcc17a.pas}
+
+var
+  a,b,lastss,mp,gp,sp:astr;
+  h,i,j,k,savx,savy:integer;
+  c:char;
+  aw:boolean;  { author working }
+  back:boolean;  { converting BACK TO PREVIOUS VERSION ! .. }
+  found:boolean;
+  dirinfo:searchrec;
+  ptsforisrequest,ptsfornotval:integer;
+  wind:windowrec;
+  didit:boolean;
+  needs:longint;
+
+  artable:astr;
+
+  systatf1:file of systatrec1;
+  systat1:systatrec1;
+  systatf0:file of systatrec;
+  systat0:systatrec;
+  systatf:file of systatrec;
+  systat:systatrec;
+
+  sf1:file of smalrec1;
+  sr1:smalrec1;
+  sf:file of smalrec;
+  sr:smalrec;
+
+  uf1:file of userrec1;
+  user1:userrec1;        {**}
+  uf0:file of userrec;
+  user0:userrec;
+  uf:file of userrec;
+  user:userrec;          {**}
+
+  bf1:file of boardrec1;
+  brd1:boardrec1;
+  bf:file of boardrec;
+  brd:boardrec;
+
+  mailfile1:file of mailrec1;
+  mail1:mailrec1;              {**}
+  mailfile:file of mailrec;
+  mail:mailrec;                {**}
+
+  ulf1:file of ulrec1;
+  ubrd1:ulrec1;
+  ulf:file of ulrec;
+  ubrd:ulrec;
+
+  ulff1:file of ulfrec1;
+  uld1:ulfrec1;
+  ulff:file of ulfrec;
+  uld:ulfrec;
+
+{  slf1:file of slr1;
+  seclev1:array[0..255] of slr1;
+  slf:file of seclevrec;
+  seclev:seclevrec;}
+
+  gfilef1:file of gft1;   {**}
+  gfile1:gft1;            {**}
+  gfilef:file of gft;     {**}
+  gfile:gft;              {**}
+
+  smf1:file of smr1;
+  sm1:smr1;
+  smf:file of smr;
+  sm:smr;
+
+  ztf1:file of zlogt1;    {**}
+  zt1:zlogt1;             {**}
+  ztf:file of zlogt;      {**}
+  zt:zlogt;               {**}
+
+  vdf1:file of vdatar1;   {**}
+  vd1:vdatar1;            {**}
+  vdf:file of vdatar;     {**}
+  vd:vdatar;              {**}
+
+  macrf:file of macrorec;
+  macr:macrorec;
+
+  xp1:file of expro1;
+  xp:file of expro;
+  xpr1:expro1;
+  xpr:expro;
+
+  ff:file;
+
+  {**} (* NOT defined globally in COMMON.PAS .... *)
+
+function value(I:astr):integer;
+var n,n1:integer;
+begin