home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / BBS / RBBS_PC / 173_BAS.ZIP / RBBSSUB1.BAS < prev    next >
Encoding:
BASIC Source File  |  1990-02-10  |  52.2 KB  |  1,662 lines

  1. ' $linesize:132
  2. ' $title: 'RBBS-SUB1.BAS CPC17.3, Copyright 1986-90 by D. Thomas Mack'
  3. '  Copyright 1990 by D. Thomas Mack, all rights reserved.
  4. '  Name ...............: RBBSSUB1.BAS
  5. '  First Released .....: February 11, 1990
  6. '  Subsequent Releases.:
  7. '  Copyright ..........: 1986-1990
  8. '  Purpose.............:
  9. '     Subprorams that require error trapping are incorporated
  10. '     within RBBSSUB1.BAS as separately callable subroutines
  11. '     in order to free up as much code as possible within
  12. '     the 64WasK code segment used by RBBS-PC.BAS.
  13. '  Parameters..........: Most parameters are passed via a COMMON statement.
  14. '
  15. ' Subroutine  Line               Function of Subroutine
  16. '   Name     Number
  17. '  ChangeDir   20101   Change subdirectory
  18. '  CheckInt    58360   Check input is valid integer
  19. '  CommPut     59275   Write string to communications port
  20. '  FindFile    59790   Determine whether a file exists without opening it
  21. '  FindFree    51098   Find amount of space on the upload disk drive
  22. '  FindItX     20219   Find if a file exists on a device
  23. '  FindUser    12598   Find a user in the USERS file
  24. '  FlushCom    20308   Read all characters in the communications port
  25. '  GetCom       1418   Read a character from the communications port
  26. '  GetPassword 58280   Read RBBS-PC's "PASSWORD" file
  27. '  GETWRK      58330   Read record from file number 2
  28. '  KillWork    58258   Delete a RBBS-PC "WORK" file
  29. '  NetBIOS     20898   Lock/Unlock NetBIOS semaphore files
  30. '  OpenCom       200   Open communications port (number 3)
  31. '  OpenFMS     58188   Open the upload management system directory
  32. '  OpenOutW    28218   Open RBBS-PC's "WORK" file (number 2) for output
  33. '  OpenRSeq     1479   Open a sequential file (number 2) for random I/O
  34. '  OpenUser     9398   Open the USER file (number 5)
  35. '  OpenWork    57978   Open RBBS-PC's work file (number 2)
  36. '  OpenWorkA   58340   Open RBBS-PC's "WORK" file (number 2) for append
  37. '  Printit     13673   Print line on the local PC printer
  38. '  PrintWork   58320   Print string to file #2 w/o CR/LF
  39. '  PrintWorkA  58350   Print string to file #2 with CR/LF
  40. '  PutCom      59650   Write to the communications port
  41. '  PutWork     59660   Write to work file randomly
  42. '  RBBSPlay    59680   Plays a musical string
  43. '  ReadAny     58310   Read file number 2 into ZOutTxt$
  44. '  ReadDef       112   Read configuration file
  45. '  ReadDir     58290   Read entire lines
  46. '  ReadParms   58300   Read certain number of parameters from file 2
  47. '  Talk        59700   RBBS-PC Voice synthesizer support for sight impaired
  48. '  SetCall       108   Find where next callers record is
  49. '  UpdateC     43048   Update the caller's file with elasped session time
  50. '  UpdtCalr    13661   Update to the caller's file
  51. '
  52. '  $INCLUDE: 'RBBS-VAR.BAS'
  53. '
  54. 108 ' $SUBTITLE: 'SetCall - subroutine to find last callers rec'
  55. ' $PAGE
  56. '
  57. '  NAME    -- SetCall
  58. '
  59. '  INPUTS  --     PARAMETER                    MEANING
  60. '
  61. '  OUTPUTS --  ZCallersFileIndex!
  62. '
  63. '  PURPOSE --  To find where to leave off on callers file
  64. '
  65.     SUB SetCall STATIC
  66.     ON ERROR GOTO 65000
  67.     IF PrevCaller$ = ZCallersFile$ OR ZCallersFilePrefix$ = "" THEN _
  68.        EXIT SUB
  69.     PrevCaller$ = ZCallersFile$
  70.     ZCallersFileIndex! = 1
  71.     CLOSE 2
  72.     CLOSE 4
  73.     IF ZShareIt THEN _
  74.        OPEN ZCallersFile$ FOR RANDOM SHARED AS #4 LEN=64 _
  75.     ELSE OPEN "R",4,ZCallersFile$,64
  76.     FIELD 4,64 AS ZCallersRecord$
  77.     IF LOF(4) > 0 THEN _
  78.        ZCallersFileIndex! = LOF(4) / 64
  79.     IF ZCallersFileIndex! < 1 THEN _
  80.        ZCallersFileIndex! = 0
  81.     ZUserIn$ = STRING$(13,0)
  82. 110 GET 4,ZCallersFileIndex!
  83.     IF ZErrCode > 0 THEN _
  84.        ZErrCode = 0 : _
  85.        ZCallersFileIndex! = 0 : _
  86.        EXIT SUB
  87.     IF LEFT$(ZCallersRecord$,13) = ZUserIn$ THEN _
  88.        ZCallersFileIndex! = ZCallersFileIndex! - 1 : _
  89.        GOTO 110
  90.     END SUB
  91.  
  92. 112 ' $SUBTITLE: 'ReadDef - subroutine to read RBBS-PC.DEF file'
  93. ' $PAGE
  94. '
  95. '  NAME    -- ReadDef
  96. '
  97. '  INPUTS  --     PARAMETER                    MEANING
  98. '                ZConfigFileName$            NAME OF RBBS-PC.DEF FILE
  99. '                ZSubParm = -62              ONLY READ THE .DEF FILE
  100. '
  101. '  OUTPUTS --  ALL THE RBBS-PC.DEF PARAMETERS
  102. '
  103. '  PURPOSE --  TO READ THE PARAMETERS FROM THE RBBS-PC.DEF FILE
  104. '
  105.      SUB ReadDef (ConfigFile$) STATIC
  106.      ON ERROR GOTO 65000
  107. '
  108. ' **** OPEN AND READ RBBS-PC CONFIGURATION DEFINITIONS ***
  109. '
  110. 117 IF ZSubParm <> -62 THEN _
  111.        IF PrevRead$ = ConfigFile$ THEN _
  112.           EXIT SUB _
  113.        ELSE PrevRead$ = ConfigFile$
  114.     CLOSE 2
  115.     ZBulletinSave$ = ZBulletinMenu$
  116.     CALL OpenWork (2,ConfigFile$)
  117.     ZCurDef$ = ConfigFile$
  118.     INPUT #2,ZWasDF$, _
  119.              ZDnldDrives$, _
  120.              ZSysopPswd1$, _
  121.              ZSysopPswd2$, _
  122.              ZSysopFirstName$, _
  123.              ZSysopLastName$, _
  124.              ZRequiredRings, _
  125.              ZStartOfficeHours, _
  126.              ZEndOfficeHours, _
  127.              ZMinsPerSession, _
  128.              ZWasDF, _
  129.              ZWasDF, _
  130.              ZUpldDir$, _
  131.              ZExpertUserDef, _
  132.              ZActiveBulletins, _
  133.              ZPromptBellDef, _
  134.              ZWasDF, _
  135.              ZMenusCanPause, _
  136.              ZMenu$(1), _
  137.              ZMenu$(2), _
  138.              ZMenu$(3), _
  139.              ZMenu$(4), _
  140.              ZMenu$(5), _
  141.              ZMenu$(6), _
  142.              ZConfMenu$, _
  143.              ZWasDF, _
  144.              ZWelcomeInterruptable, _
  145.              ZRemindFileXfers, _
  146.              ZPageLengthDef, _
  147.              ZMaxMsgLinesDef, _
  148.              ZDoorsAvail, _
  149.              ZWasDF$, _
  150.              ZMainMsgFile$, _
  151.              ZMainMsgBackup$
  152.     INPUT #2, WasX$, _
  153.               ZCmntsFile$, _
  154.               ZMainUserFile$, _
  155.               ZWelcomeFile$, _
  156.               ZNewUserFile$, _
  157.               ZMainDirExtension$
  158.     CALL BreakFileName (WasX$,ZWasY$,ZWasDF$,ZWasZ$,ZFalse)
  159.     IF ZWasDF$ <> "" THEN _
  160.        ZCallersFile$ = WasX$
  161.     INPUT #2, ZWasDF$
  162.     IF ZComPort$ <> "COM0" THEN _
  163.        IF NOT ZConfMode THEN _
  164.           ZComPort$ = ZWasDF$
  165.     INPUT #2, ZBulletinsOptional, _
  166.               ZModemInitCmd$, _
  167.               ZRTS$, _
  168.               ZWasDF, _
  169.               ZFG, _
  170.               ZBG, _
  171.               ZBorder
  172.     IF ZConfMode THEN _
  173.        INPUT #2, ZWasDF$, _
  174.                  ZWasDF$ _
  175.     ELSE INPUT #2, ZRBBSBat$ , _
  176.                    ZRCTTYBat$
  177.     INPUT #2,ZOmitMainDir$, _
  178.              ZFirstNamePrompt$, _
  179.              ZHelp$(3), _
  180.              ZHelp$(4), _
  181.              ZHelp$(7), _
  182.              ZHelp$(9), _
  183.              ZBulletinMenu$, _
  184.              ZBulletinPrefix$, _
  185.              ZWasDF$, _
  186.              ZMsgReminder, _
  187.              ZRequireNonASCII, _
  188.              ZAskExtendedDesc, _
  189.              ZMaxNodes, _
  190.              ZNetworkType
  191.     IF ZConfMode THEN _
  192.          INPUT #2, ZwasDF _
  193.     ELSE INPUT #2, ZRecycleToDos
  194.     INPUT #2,ZWasDF, _
  195.              ZWasDF, _
  196.              ZTrashcanFile$
  197.     INPUT #2,ZMinLogonSec, _
  198.              ZDefaultSecLevel, _
  199.              ZSysopSecLevel, _
  200.              ZFileSecFile$, _
  201.              ZSysopMenuSecLevel, _
  202.              ZConfMailList$, _
  203.              ZMaxViolations, _
  204.              ZOptSec(50), _   ' SECURITY FOR ZSysop COMMANDS 1
  205.              ZOptSec(51), _
  206.              ZOptSec(52), _
  207.              ZOptSec(53), _
  208.              ZOptSec(54), _
  209.              ZOptSec(55), _
  210.              ZOptSec(56), _   ' ZSysop 7
  211.              ZPswdFile$, _
  212.              ZMaxPswdChanges, _
  213.              ZMinSecForTempPswd, _
  214.              ZOverWriteSecLevel, _
  215.              ZDoorsTermType, _
  216.              ZMaxPerDay
  217.     INPUT #2,ZOptSec(1), _   ' SECURITY FOR MAIN MENU COMMANDS 1
  218.              ZOptSec(2), _
  219.              ZOptSec(3), _
  220.              ZOptSec(4), _
  221.              ZOptSec(5), _
  222.              ZOptSec(6), _
  223.              ZOptSec(7), _
  224.              ZOptSec(8), _
  225.              ZOptSec(9), _
  226.              ZOptSec(10), _
  227.              ZOptSec(11), _
  228.              ZOptSec(12), _
  229.              ZOptSec(13), _
  230.              ZOptSec(14), _
  231.              ZOptSec(15), _
  232.              ZOptSec(16), _
  233.              ZOptSec(17), _
  234.              ZOptSec(18), _   ' MAIN COMMAND 18
  235.              ZMinNewCallerBaud, _
  236.              ZWaitBeforeDisconnect
  237.     INPUT #2,ZOptSec(19), _      ' Security for FILE COMMANDS 1
  238.              ZOptSec(20), _
  239.              ZOptSec(21), _
  240.              ZOptSec(22), _
  241.              ZOptSec(23), _
  242.              ZOptSec(24), _
  243.              ZOptSec(25), _
  244.              ZOptSec(26), _      ' FILE COMMAND 8
  245.              ZOptSec(27), _      ' SECURITY FOR UTILITY COMMANDS 1
  246.              ZOptSec(28), _
  247.              ZOptSec(29), _
  248.              ZOptSec(30), _
  249.              ZOptSec(31), _
  250.              ZOptSec(32), _
  251.              ZOptSec(33), _
  252.              ZOptSec(34), _
  253.              ZOptSec(35), _
  254.              ZOptSec(36), _
  255.              ZOptSec(37), _
  256.              ZOptSec(38), _   ' UTIL COMMAND 12
  257.              ZOptSec(46), _   ' SECURITY FOR GLOBAL COMMANDS 1
  258.              ZOptSec(47), _
  259.              ZOptSec(48), _
  260.              ZOptSec(49), _
  261.              ZUpldTimeFactor!, _
  262.              ZComputerType, _
  263.              ZRemindProfile, _
  264.              ZRBBSName$, _
  265.              ZCmdsBetweenRings, _
  266.              ZMNPSupport, _
  267.              ZPagingPtrSupport$
  268.     IF ZConfMode THEN _
  269.          INPUT #2, ZwasDF _
  270.     ELSE INPUT #2, ZModemInitBaud$
  271.              IF ZErrCode > 0 THEN _
  272.                 EXIT SUB
  273. 118 INPUT #2, ZTurnPrinterOff,_    ' Turn printer off each recycle
  274.               ZDirPath$, _    ' Where dir files are stored
  275.               ZMinSecToView, _
  276.               ZLimitSearchToFMS, _
  277.               ZDefaultCatCode$, _
  278.               ZDirCatFile$, _
  279.               ZNewFilesCheck, _
  280.               ZMaxDescLen, _
  281.               ZShowSection, _
  282.               ZCmndsInPrompt, _
  283.               ZNewUserSetsDefaults, _
  284.               ZHelpPath$, _
  285.               ZHelpExtension$, _
  286.               ZMainCmds$, _
  287.               ZFileCmd$, _
  288.               ZUtilCmds$, _
  289.               ZGlobalCmnds$, _
  290.               ZSysopCmds$
  291.     INPUT #2, ZRecycleWait, _
  292.               ZOptSec(39), _       ' SECURITY FOR Library COMMANDS 1
  293.               ZOptSec(40), _
  294.               ZOptSec(41), _
  295.               ZOptSec(42), _
  296.               ZOptSec(43), _
  297.               ZOptSec(44), _
  298.               ZOptSec(45), _       ' Library COMMANDS 7
  299.               ZLibDrive$, _
  300.               ZLibDirPath$, _
  301.               ZLibDirExtension$, _
  302.               ZLibWorkDiskPath$, _
  303.               ZLibMaxDisk, _
  304.               ZLibMaxDir, _
  305.               ZLibMaxSubdir, _
  306.               ZLibSubdirPrefix$, _
  307.               ZLibArcPath$, _
  308.               ZLibArcProgram$, _
  309.               ZLibCmds$
  310. '
  311. ' *****  ESTABLISH COMMUNICATION PORT REGISTERS AND COMMANDS   ***
  312. ' *****     GET DOS SUB-DIRECTORY RBBS-PC OPTIONS              ***
  313. '
  314.     INPUT #2, ZUpldPath$, _              ' Where upl dir goes
  315.               ZMainFMSDir$, _       ' Shared dir in FMS
  316.               ZAnsMenu$, _
  317.               ZReqQues$,_
  318.               ZRememberNewUsers,_
  319.               ZSurviveNoUserRoom,_
  320.               ZPromptHash$,_
  321.               ZStartHash,_
  322.               ZLenHash,_
  323.               ZPromptIndiv$,_
  324.               ZStartIndiv,_
  325.               ZLenIndiv
  326.     INPUT #2, ZBypassMsgs, _
  327.               ZMusic, _
  328.               ZRestrictByDate, _
  329.               ZDaysToWarn, _
  330.               ZDaysInRegPeriod, _
  331.               ZVoiceType, _
  332.               ZRestrictValidCmds, _
  333.               ZNewUserDefaultMode, _
  334.               ZNewUserLineFeeds, _
  335.               ZNewUserNulls, _
  336.               ZFastFileList$, _
  337.               ZFastFileLocator$, _
  338.               ZMsgsCanGrow, _
  339.               ZWrapCallersFile$, _
  340.               ZRedirectIOMethod, _
  341.               ZAutoUpgradeSec, _
  342.               ZHaltOnError, _
  343.               ZNewPublicMsgsSec, _
  344.               ZNewPrivateMsgsSec, _
  345.               SecNeededToChangeMsgs, _
  346.               ZSLCategorizeUplds, _
  347.               ZBaudot, _
  348.               ZHourMinToDropToDos, _
  349.               ZExpiredSec, _
  350.               ZDTRDropDelay, _
  351.               ZAskID, _
  352.               ZMaxRegSec, _
  353.               ZBufferSize, _
  354.               ZMLCom, _
  355.               ZNoDoorProtect, _
  356.               ZDefaultExtension$, _
  357.               ZNewUserDefaultProtocol$, _
  358.               ZNewUserGraphics$, _
  359.               ZNetMail$, _
  360.               ZMasterDirName$, _
  361.               ZProtoDef$, _
  362.               ZUpcatHelp$, _
  363.               ZAllwaysStrewTo$, _
  364.               ZLastNamePrompt$
  365. 119 INPUT #2, ZPersonalDrvPath$, _
  366.               ZPersonalDir$, _
  367.               ZPersonalBegin, _
  368.               ZPersonalLen, _
  369.               ZPersonalProtocol$, _
  370.               ZPersonalConcat , _
  371.               ZPrivateReadSec, _
  372.               ZPublicReadSec, _
  373.               ZSecChangeMsg
  374.     IF ZConfMode THEN _
  375.          INPUT #2, ZwasDF _
  376.     ELSE INPUT #2, ZKeepInitBaud
  377.     INPUT #2, ZMainPUI$
  378.     IF ZConfMode THEN _
  379.        INPUT #2, ZWasDF$,ZWasDF$,ZWasDF$ _
  380.     ELSE INPUT #2, ZDefaultEchoer$, _
  381.                    ZHostEchoOn$, _
  382.                    ZHostEchoOff$
  383.     INPUT #2, ZSwitchBack, _
  384.               ZDefaultLineACK$, _
  385.               ZAltdirExtension$, _
  386.               ZDirPrefix$
  387.     IF ZConfMode THEN _
  388.        INPUT #2, ZWasDF, _
  389.                  ZWasDF, _
  390.                  ZWasDF _
  391.     ELSE INPUT #2, ZWasDF,_
  392.                    ZModemInitWaitTime, _
  393.                    ZModemCmdDelayTime
  394.     INPUT #2, ZTurboRBBS, _
  395.               ZSubDirCount, _
  396.               ZWasDF, _
  397.               ZUpldToSubdir, _
  398.               ZWasDF, _
  399.               ZUpldSubdir$, _
  400.               ZMinOldCallerBaud, _
  401.               ZMaxWorkVar, _
  402.               ZDiskFullGoOffline, _
  403.               ZExtendedLogging
  404.      IF ZConfMode THEN _
  405.         INPUT #2, ZWasDF$, _
  406.                   ZWasDF$, _
  407.                   ZWasDF$, _
  408.                   ZWasDF$ _
  409.      ELSE INPUT #2, ZModemResetCmd$, _
  410.                     ZModemCountRingsCmd$, _
  411.                     ZModemAnswerCmd$, _
  412.                     ZModemGoOffHookCmd$
  413.      INPUT #2,ZDiskForDos$, _
  414.               ZDumbModem, _
  415.               ZCmntsAsMsgs
  416.      IF ZConfMode THEN _
  417.         INPUT #2, ZWasDF, _
  418.                   ZWasDF, _
  419.                   ZWasDF, _
  420.                   ZWasDF, _
  421.                   ZWasDF, _
  422.                   ZWasDF _
  423.      ELSE INPUT #2, ZLSB,_
  424.                     ZMSB,_
  425.                     ZLineCntlReg,_
  426.                     ZModemCntlReg,_
  427.                     ZLineStatusReg,_
  428.                     ZModemStatusReg
  429.      INPUT #2,ZKeepTimeCredits, _
  430.               ZXOnXOff, _
  431.               ZAllowCallerTurbo, _
  432.               ZUseDeviceDriver$, _
  433.               ZPreLog$, _
  434.               ZNewUserQuestionnaire$, _
  435.               ZEpilog$, _
  436.               ZRegProgram$, _
  437.               ZQuesPath$, _
  438.               ZUserLocation$, _
  439.               ZWasDF$, _
  440.               ZWasDF$, _
  441.               ZWasDF$, _
  442.               ZEnforceRatios, _
  443.               ZSizeOfStack, _
  444.               ZSecExemptFromEpilog, _
  445.               ZUseBASICWrites, _
  446.               ZDosANSI, _
  447.               ZEscapeInsecure, _
  448.               ZUseDirOrder, _
  449.               ZAddDirSecurity, _
  450.               ZMaxExtendedLines, _
  451.               ZOrigCommands$
  452.      INPUT #2,ZLogonMailLevel$, _
  453.               ZMacroDrvPath$, _
  454.               ZMacroExtension$, _
  455.               ZEmphasizeOnDef$, _
  456.               ZEmphasizeOffDef$, _
  457.               ZFG1Def$, _
  458.               ZFG2Def$, _
  459.               ZFG3Def$, _
  460.               ZFG4Def$, _
  461.               ZSecVioHelp$
  462.      IF ZConfMode THEN _
  463.         INPUT #2,ZWasDF _
  464.      ELSE INPUT #2,ZFossil
  465.      INPUT #2,ZMaxCarrierWait, _
  466.               ZWasDF, _
  467.               ZSmartTextCode, _
  468.               ZTimeLock, _
  469.               ZWriteBufDef, _
  470.               ZSecKillAny, _
  471.               ZDoorsDef$, _
  472.               ZScreenOutMsg$, _
  473.               ZAutoPageDef$
  474.      IF ZErrCode > 0 THEN _
  475.         EXIT SUB
  476.      ZConfigFileName$ = ConfigFile$
  477.      CALL EditDef
  478.      END SUB
  479. 200 ' $SUBTITLE: 'OpenCom - subroutine to open the communications port'
  480. ' $PAGE
  481. '
  482. '  NAME    -- OpenCom
  483. '
  484. '  INPUTS  --     PARAMETER                    MEANING
  485. '                BaudRate$                  BAUD TO OPEN MODEM
  486. '                Parity$                    PARITY TO OPEN MODEM
  487. '
  488. '  OUTPUTS -- BaudTest!                     BAUD RATE TO SET RS232 AT
  489. '
  490. '  PURPOSE -- To open the communications port.
  491. '
  492.     SUB OpenCom (BaudRate$,Parity$) STATIC
  493.     ON ERROR GOTO 65000
  494.     IF ZFossil THEN _
  495.        IF ZRTS$ = "YES" THEN _
  496.           ZFlowControl = ZTrue : _
  497.           Flow = &H00F2 : _
  498.           CALL FosFlowCtl(ZComPort,Flow)
  499.     IF INSTR(Parity$,"N") THEN _
  500.        Parity = 2 : _                                     ' No PARITY
  501.        DataBits = 3 : _                                   ' 8 DATA BITS
  502.        StopBits = 0 _                                     ' 1 STOP BIT
  503.     ELSE Parity = 3 : _                                   ' EVEN PARITY
  504.          DataBits = 2 : _                                 ' 7 DATA BITS
  505.          StopBits = 0                                     ' 1 STOP BIT
  506.     IF NOT ZFossil THEN _
  507.        GOTO 202
  508.     IF Baudrate$ = "38400" THEN _
  509.        ComSpeed = &H9600 _
  510.     ELSE ComSpeed = VAL(BaudRate$)
  511.     CALL FosSpeed(ZComPort,ComSpeed,Parity,DataBits,StopBits)
  512.     EXIT SUB
  513. 202 CLOSE 3
  514.     IF ZRTS$ = "YES" THEN _
  515.        ZFlowControl = ZTrue : _
  516.        WasX$ = ",CS26600,CD,DS" _
  517.     ELSE WasX$ = ",RS,CD,DS"
  518.     WasX = (VAL(BaudRate$) > 19200)
  519.     IF WasX THEN _
  520.        ZWasY$ = "19200" _
  521.     ELSE ZWasY$ = BaudRate$
  522.     OPEN ZComPort$ + ":" + ZWasY$ + Parity$ + WasX$ AS #3
  523. '
  524. ' ****************************************************************************
  525. ' *  RAISE THE RTS SIGNAL IF THE MODEM USES RTS FOR MODEM FLOW CONTROL (ONCE
  526. ' *  IT IS RAISED, IT WILL STAY UP UNTIL THE REGISTER IS CLEARED OUT).
  527. ' ****************************************************************************
  528. '
  529.     END SUB
  530. 1418 ' $SUBTITLE: 'GetCom -- subroutine reads a char. from  comm. port'
  531. ' $PAGE
  532. '
  533. '  NAME    -- GetCom
  534. '
  535. '  INPUTS  --   PARAMETER     MEANING
  536. '                 Strng$       STRING TO READ A CHARACTER INTO FROM
  537. '                              THE COMMUNICATIONS PORT (FILE #3)
  538. '
  539. '  OUTPUTS --   Strng$
  540. '
  541. '  PURPOSE -- Reads a character from the communications port.
  542. '
  543.      SUB GetCom (Strng$) STATIC
  544.      ON ERROR GOTO 65000
  545. 1420 IF ZFOSSIL THEN _
  546.         CALL FOSRXChar(ZComPort,Char) : _
  547.         Strng$ = CHR$(Char) _
  548.      ELSE Strng$ = INPUT$(1,3)
  549. 1421 IF ZErrCode = 57 THEN _
  550.         LineStatus = INP(ZLineStatusReg) : _
  551.         ZErrCode = 0 : _
  552.         GOTO 1420
  553.      END SUB
  554. 1479 ' $SUBTITLE: 'OpenRSeq  - open sequential file randomly'
  555. ' $PAGE
  556. '
  557. '  NAME    -- OpenRSeq
  558. '
  559. '  INPUTS  -- PARAMETER             MEANING
  560. '             FilName$      NAME OF SEQUENTIAL FILE TO OPEN AS #2
  561. '
  562. '  OUTPUTS -- NumRecs      NUMBER OF 128-BYTE RECORDS IN THE FILE
  563. '             LenLastRec   NUMBER OF BYTES IN THE LAST RECORD (IT
  564. '                          MAY BE LESS THAN OR EQUAL TO 128).
  565. '
  566. '  PURPOSE -- Open a sequential file as file #2 and read it randomly
  567. '
  568.      SUB OpenRSeq (FilName$,NumRecs,LenLastRec,RecLen) STATIC
  569.      ON ERROR GOTO 65000
  570.      CLOSE 2
  571. 1480 ZErrCode = 0
  572. 1481 IF ZShareIt THEN _
  573.         OPEN FilName$ FOR RANDOM SHARED AS #2 LEN=RecLen _
  574.      ELSE OPEN "R",2,FilName$,RecLen
  575.      IF ZErrCode = 52 THEN _
  576.         GOTO 1480
  577.      FIELD #2, RecLen AS ZDnldRecord$
  578.      WasI# = LOF(2)
  579.      NumRecs = FIX(WasI#/RecLen)
  580.      LenLastRec = WasI# - CDBL(NumRecs) * RecLen
  581.      IF LenLastRec > 0 THEN _
  582.         NumRecs = NumRecs + 1 _
  583.      ELSE LenLastRec = RecLen
  584.      END SUB
  585. 9398 ' $SUBTITLE: 'OpenUser - subroutine to open users file as #5'
  586. ' $PAGE
  587. '
  588. '  NAME    -- OpenUser
  589. '
  590. '  INPUTS  --     PARAMETER                    MEANING
  591. '                 ZShareIt
  592. '
  593. '  OUTPUTS -- ZActiveUserFile$
  594. '             ZCityState$
  595. '             ZElapsedTime$
  596. '             ZLastDateTimeOn$
  597. '             LastRec                # OF Last RECORD IN USERS FILE
  598. '             ZListNewDate$
  599. '             ZPswd$
  600. '             ZSecLevel$
  601. '             ZUserDnlds$
  602. '             ZUserName$
  603. '             ZUserOption$
  604. '             ZUserRecord$
  605. '             ZUserUplds$
  606. '
  607. '  PURPOSE -- Open the user file as file #5
  608. '
  609.       SUB OpenUser (LastRec) STATIC
  610.       ON ERROR GOTO 65000
  611. '
  612. ' ****  OPEN AND DEFINE USER FILE RECORD VARIABLES  ****
  613. '
  614. 9400 CLOSE 5
  615.      IF ZShareIt THEN _
  616.         OPEN ZActiveUserFile$ FOR RANDOM SHARED AS #5 LEN=128 _
  617.      ELSE OPEN "R",5,ZActiveUserFile$,128
  618.      WasI# = LOF(5)
  619.      LastRec = FIX(WasI#/128)
  620.      FIELD 5,31 AS ZUserName$, _
  621.              15 AS ZPswd$, _
  622.               2 AS ZSecLevel$, _
  623.              14 AS ZUserOption$,  _
  624.              24 AS ZCityState$, _
  625.               3 AS MachineType$, _
  626.               4 AS ZTodayDl$, _
  627.               4 AS ZTodayBytes$, _
  628.               4 AS ZDlBytes$, _
  629.               4 AS ZULBytes$, _
  630.              14 AS ZLastDateTimeOn$, _
  631.               3 AS ZListNewDate$, _
  632.               2 AS ZUserDnlds$, _
  633.               2 AS ZUserUplds$, _
  634.               2 AS ZElapsedTime$
  635.      FIELD 5,128 AS ZUserRecord$
  636.      END SUB
  637. 12598 ' $SUBTITLE: 'FindUser - subroutine to search users file for a name'
  638. ' $PAGE
  639. '
  640. '  NAME    -- FindUser
  641. '
  642. '  INPUTS  --     PARAMETER                    MEANING
  643. '             HashToLookFor$        STRING TO SEARCH FOR IN USERS
  644. '             IndivToLookFor$       STRING TO USE TO INDIVIDUATE
  645. '                                   USERS WITH SAME HASH
  646. '             StartHashPos          WHERE HASH FIELD STARTS IN THE
  647. '                                  "USERS" FILE
  648. '             LenHashField          LENGTH OF THE HASH FIELD
  649. '             StartIndivPos         WHERE THE FIELD TO DISTINGUISH
  650. '                                   AMONG USERS (I.E. WITH THE SAME
  651. '                                   NAME) STARTS IN THE "USERS" FILE
  652. '                                   (SET TO 0 IF NONE TO BE USED)
  653. '             LenIndivField         LENGTH OF FIELD TO DISTINGUISH
  654. '                                   AMONG USERS
  655. '             MaxPosition           HIGHEST RECORD TO SEARCH OR USE
  656. '
  657. '  NOTE: THIS SUBROUTINE ASSUMES THE "USERS" FILE IS OPEN AS FILE 2.
  658. '
  659. '  OUTPUTS -- WhetherFound          SET TO "TRUE" IF USER WAS Found
  660. '                                   OTHERWISE IT IS "FALSE"
  661. '             PosToUse              NUMBER OF THE "USERS" RECORD THAT
  662. '                                   BELONGS TO THE USER (IF Found) OR
  663. '                                   TO USE FOR THE USER (IF THE USER
  664. '                                   WASN'T Found)
  665. '             PosToReclaim          SET TO 0 IF THE RECORD NUMBER
  666. '                                   SELECTED FOR THIS USER HAS NEVER
  667. '                                   BEEN USED.
  668. '
  669. '  PURPOSE -- To search the "USERS" file and determine the record
  670. '             number to use for the caller in the "USERS" file.
  671. '
  672.       SUB FindUser (HashToLookFor$,IndivToLookFor$,StartHashPos,_
  673.                     LenHashField,StartIndivPos,LenIndivField,_
  674.                     MaxPosition,WhetherFound,_
  675.                     PosToUse,PosToReclaim) STATIC
  676.       ON ERROR GOTO 65000
  677.       ZErrCode = 0
  678.       WhetherFound = 0
  679.       IF HashToLookFor$ = SPACE$(LEN(HashToLookFor$)) THEN _
  680.          EXIT SUB
  681.       EmptyRec$ = SPACE$(LenHashField)
  682.       EmptyIndiv$ = SPACE$(LenIndivField)
  683.       NewUser$ = LEFT$("NEWUSER  ",LenHashField + 2)
  684.       FIELD 5, 128 AS Filler$
  685.       WasX$ = HashToLookFor$ + SPACE$(LenHashField - LEN(HashToLookFor$))
  686.       CALL HashRBBS (HashToLookFor$,MaxPosition,PosToUse,ZWasDF)
  687. 12600 ZWasY$ = IndivToLookFor$ + SPACE$(LenIndivField - LEN(IndivToLookFor$))
  688.       PosToReclaim = 0
  689. 12610 GET 5,PosToUse
  690.       IF ZErrCode > 0 THEN _
  691.          IF ZErrCode = 63 THEN _
  692.             ZErrCode = 0 : _
  693.             GOTO 12621 _
  694.          ELSE ZErrCode = 0 : _
  695.          GOTO 12620
  696.       HashValue$ = MID$(Filler$,StartHashPos,LenHashField)
  697.       IF WasX$ = HashValue$ THEN _
  698.          IF StartIndivPos < 1 THEN _
  699.            WhetherFound = ZTrue : _
  700.            GOTO 12622 _
  701.          ELSE IndivValue$ = MID$(Filler$,StartIndivPos,LenIndivField) : _
  702.               IF ZWasY$ = IndivValue$ OR IndivValue$ = EmptyIndiv$ THEN _
  703.                  WhetherFound = ZTrue : _
  704.                  GOTO 12622
  705.       IF HashValue$ = EmptyRec$ THEN _
  706.          PosToUse = PosToReclaim - (PosToReclaim = 0) * PosToUse : _
  707.          WhetherFound = ZFalse : _
  708.          GOTO 12622
  709.       IF ASC(HashValue$) = 0 OR INSTR(HashValue$,NewUser$) = 1 THEN _
  710.          IF PosToReclaim = 0 THEN _
  711.             PosToReclaim = PosToUse
  712. 12620 PosToUse = PosToUse + ZWasDF
  713.       IF PosToUse > MaxPosition - 1 THEN _
  714.          PosToUse = PosToUse - MaxPosition
  715.       GOTO 12610
  716. 12621 IF PosToReclaim = 0 THEN _
  717.          PosToReclaim = PosToUse
  718.       GOTO 12620
  719. 12622 END SUB
  720. 13661 ' $SUBTITLE: 'UpdtCalr - subroutine to write to CALLERS file'
  721. ' $PAGE
  722. '
  723. '  NAME    -- UpdtCalr
  724. '
  725. '  INPUTS  --     PARAMETER                    MEANING
  726. '                 ErrMsg$                   MESSAGE TO GO IN CALLER LOG
  727. '                 EXTLog               = 1  CHECK FOR EXTENDED LOGGING
  728. '                                           BEFORE UPDATING.
  729. '                                      = 2  UPDATE CALLER LOG WITH ZWasZ$
  730. '
  731. '  OUTPUTS -- ZCurDate$           CURRENT DATE (MM-DD-YY)
  732. '             ZTime$                    CURRENT TIME (I.E. 1:13 PM)
  733. '             TIME.LOGGEND.ON$        TIME USER LOGGED ON (HH:MM:SS)
  734. '
  735. '  PURPOSE -- To update the caller's file and/or print on the
  736. '             local printer if it is enabled
  737. '
  738.       SUB UpdtCalr (ErrMsg$,EXTLog) STATIC
  739.       ON ERROR GOTO 65000
  740.       IF ZCallersFilePrefix$ = "" OR (ZLocalUser AND ZSysop) THEN _
  741.          EXIT SUB
  742.       WasX$ = "     " + ErrMsg$
  743. 13663 ZErrCode = 0
  744.       FIELD 4, 64 AS ZCallersRecord$
  745.       IF ZErrCode > 0 THEN _
  746.          CALL QuickTPut1 ("Caller's file:  error"+STR$(ZErrCode)) : _
  747.          ZErrCode = 0 : _
  748.          EXIT SUB
  749.       ON EXTLog GOTO 13665,13670
  750. '
  751. ' ****  EXTENDED LOGGING ENTRY  ***
  752. '
  753. 13665 IF NOT ZExtendedLogging THEN _
  754.          EXIT SUB
  755.       CALL AMorPM
  756.       WasX$ = WasX$ + " at " + ZTime$
  757. '
  758. ' ****  UPDATE CALLERS FILE WITH USER ACTIVITY  ****
  759. '
  760. 13670 LSET ZCallersRecord$ = WasX$
  761.       CALL Printit (ZCallersRecord$)
  762.       IF ZLocalUser AND ZPrinter THEN _
  763.          EXIT SUB
  764.       ZCallersFileIndex! = ZCallersFileIndex! + 1
  765. 13672 PUT 4,ZCallersFileIndex!
  766.       END SUB
  767. 13673 ' $SUBTITLE: 'Printit - subroutine to print on the local printer'
  768. ' $PAGE
  769. '
  770. '  NAME    -- Printit
  771. '
  772. '  INPUTS  --     PARAMETER                    MEANING
  773. '                 Strng$              STRING TO WRITE TO THE Printer
  774. '
  775. '  OUTPUTS -- NONE
  776. '
  777. '  PURPOSE -- To write to the printer attached to the pc running
  778. '             RBBS-PC and toggle the printer switch off whenever
  779. '             the printer is/becomes unavailable
  780. '
  781.       SUB Printit (Strng$) STATIC
  782.       ON ERROR GOTO 65000
  783. 13674 IF ZPrinter THEN _
  784.          LPRINT Strng$
  785.       END SUB
  786. 20101 ' $SUBTITLE: 'ChangeDir - subroutine to change subdirectories'
  787. ' $PAGE
  788. '
  789. '  NAME    -- ChangeDir
  790. '
  791. '  INPUTS  -- PARAMETER                    MEANING
  792. '             NewDir$                      NAME OF SUBDIRECTORY
  793. '
  794. '  OUTPUTS -- ZOK                           TRUE IF CHDIR SUCCESSFUL
  795. '             ZErrCode                      ERROR CODE
  796. '
  797. '  PURPOSE -- Change subdirectory
  798. '
  799.       SUB ChangeDir (NewDir$) STATIC
  800.       ON ERROR GOTO 65000
  801.       ZErrCode = 0
  802.       ZOK = ZTrue
  803. 20103 CHDIR NewDir$
  804.       END SUB
  805. 20219 ' $SUBTITLE: 'FINDITX - subroutine to find if a file exists'
  806. ' $PAGE
  807. '
  808. '  NAME    -- FINDITX
  809. '
  810. '  INPUTS  -- PARAMETER                    MEANING
  811. '             FilName$                 NAME OF FILE TO FIND
  812. '             FileNum                  # TO OPEN FILE AS
  813. '
  814. '  OUTPUTS -- ZOK                      TRUE IF FILE EXISTS
  815. '             ZErrCode                 ERROR CODE
  816. '
  817. '  PURPOSE -- Determine whether a file exists
  818. '
  819.       SUB FindItX (FilName$,FileNum) STATIC
  820.       ON ERROR GOTO 65000
  821.       ZErrCode = 0
  822.       ZOK = ZFalse
  823.       IF LEN(FilName$) < 1 THEN _
  824.          EXIT SUB
  825.       IF ZTurboRBBS THEN _
  826.          CALL FindFile (FilName$,ZOK) : _
  827.          IF ZOK THEN _
  828.             GOTO 20222 _
  829.          ELSE EXIT SUB
  830. 20221 CALL BadFileChar (FilName$,ZOK)
  831.       IF NOT ZOK THEN _
  832.          EXIT SUB
  833.       ZOK = ZFalse
  834.       NAME FilName$ AS FilName$
  835.       IF ZErrCode = 53 THEN _
  836.          ZErrCode = 0 : _
  837.          EXIT SUB
  838. 20222 CLOSE FileNum
  839. 20223 CALL OpenWork (FileNum,FilName$)
  840.       IF ZErrCode = 64 OR ZErrCode = 76 THEN _
  841.          ZOK = ZFalse : _
  842.          EXIT SUB
  843.       ZOK = ZTrue
  844.       END SUB
  845. 20308 ' $SUBTITLE: 'FlushCom -- subroutine reads all char. from  comm. port'
  846. ' $PAGE
  847. '
  848. '  NAME -- FlushCom
  849. '
  850. '  INPUTS --   PARAMETER     MEANING
  851. '              STrng$       STRING TO READ CHARACTERS INTO FROM
  852. '                           THE COMMUNICATIONS PORT (FILE #3)
  853. '
  854. '  OUTPUTS --   Strng$
  855. '
  856. '  PURPOSE -- Reads all characters from the communications port.
  857. '
  858.       SUB FlushCom (Strng$) STATIC
  859.       ON ERROR GOTO 65000
  860.       IF ZLocalUser THEN _
  861.          EXIT SUB
  862.       Strng$ = ""
  863.       IF NOT ZFossil THEN _
  864.          GOTO 20311
  865. 20310 CALL FosReadAhead(ZComPort,Char)
  866.       IF Char <> -1 THEN _
  867.          CALL FOSRXChar(ZComPort,Char) : _
  868.          Strng$ = Strng$ + CHR$(Char) : _
  869.          GOTO 20310
  870.       EXIT SUB
  871. 20311 Strng$ = INPUT$(LOC(3),3)                     ' FLUSH THE COMM BUFFER
  872. 20312 IF ZErrCode = 57 THEN _
  873.          LineStatus = INP(ZLineStatusReg) : _
  874.          ZErrCode = 0 : _
  875.          GOTO 20311
  876.       END SUB
  877. 20898 ' $SUBTITLE: 'NetBIOS - subroutine to lock/unlock using NetBIOS'
  878. ' $PAGE
  879. '
  880. '  NAME    -- NetBIOS   (WRITTEN BY DOUG AZZARITO)
  881. '
  882. '  INPUTS  -- IBMLockCmd       = 1-LOCK, 0-UNLOCK
  883. '             IBMFileLock      = 5 USERS FILE
  884. '                              = 6 SEMAPHORE FILE
  885. '             IBMRecLock       = RECORD NUMBER TO LOCK
  886. '
  887. '  OUTPUTS -- NONE
  888. '
  889. '  PURPOSE -- Lock and unlock files using NetBIOS commands.
  890. '             If lock fails, this routine tries forever.
  891. '
  892.       SUB NetBIOS (IBMLockCmd,IBMFileLock,IBMRecLock) STATIC
  893.       STATIC IBMCount
  894.       ON ERROR GOTO 65000
  895. 29900 ON IBMLockCmd + 1 GOTO 29920, 29910
  896.       EXIT SUB
  897. '
  898. ' *****  LOCK LOOP   ****
  899. '
  900. 29910 ZErrCode = 0
  901.       IF IBMFileLock = 6 AND IBMRecLock = 3 THEN _
  902.          IBMCount = IBMCount + 1 : _
  903.          IF IBMCount > 1 THEN _
  904.             EXIT SUB
  905.       LOCK IBMFileLock, IBMRecLock TO IBMRecLock
  906.       IF ZErrCode <> 0 THEN _
  907.          GOTO 29910
  908.       EXIT SUB
  909. 29920 ZErrCode = 0
  910.       IF IBMFileLock = 6 AND IBMRecLock = 3 THEN _
  911.          IBMCount = IBMCount - 1 : _
  912.          IF IBMCount > 0 THEN _
  913.             EXIT SUB _
  914.          ELSE IBMCount = 0
  915.       UNLOCK IBMFileLock, IBMRecLock TO IBMRecLock
  916.       IF ZErrCode <> 0 THEN _
  917.          GOTO 29920
  918.       END SUB
  919. 43048 ' $SUBTITLE: 'UpdateC - update of callers log on exiting'
  920. ' $PAGE
  921. '
  922. '  NAME    -- UpdateC
  923. '
  924. '  INPUTS  --     PARAMETER                    MEANING
  925. '             ZCallersFileIndex!
  926. '             ZFirstName$
  927. '             ZWasHHH
  928. '             ZLastName$
  929. '             ZWasMMM
  930. '             ZWasNG$
  931. '             ZWasSSS
  932. '             ZSysopFirstName$
  933. '             ZSysopLastName$
  934. '
  935. '  OUTPUTS -- ZCallersRecord$
  936. '             ZCallersFileIndex!
  937. '             ZSysop
  938. '
  939. '  PURPOSE -- Update the callers file at logoff so that the number
  940. '             of hours, minutes, and seconds for the session are
  941. '             recorded as the last 9 characters of the 64-character
  942. '             callers file record
  943. '
  944.       SUB UpdateC STATIC
  945.       ON ERROR GOTO 65000
  946.       IF ZCallersFilePrefix$ = "" THEN _
  947.          EXIT SUB
  948. '
  949. ' ****  UPDATE CALLERS FILE AT LOGOFF  ***
  950. '
  951. 43050 FIELD 4,55 AS ZCallersRecord$,3 AS Hours$,3 AS Minutes$,3 AS Seconds$
  952.       LSET ZCallersRecord$ = MID$(ZWasNG$,65,55)
  953.       LSET Hours$ = STR$(ZSessionHour)
  954.       LSET Minutes$ = STR$(ZSessionMin)
  955.       LSET Seconds$ = STR$(ZSessionSec)
  956.       ZCallersFileIndex! = ZCallersFileIndex! + 1
  957.       PUT 4,ZCallersFileIndex!
  958.       FIELD 4,64 AS ZCallersRecord$
  959.       LSET ZCallersRecord$ = LEFT$(ZWasNG$,64)
  960.       ZCallersFileIndex! = ZCallersFileIndex! + 1
  961.       PUT 4,ZCallersFileIndex!
  962. 43060 LSET ZCallersRecord$ = STRING$(64,CHR$(0))
  963.       ZCallersFileIndex! = ZCallersFileIndex! + 1
  964.       PUT 4,ZCallersFileIndex!
  965.       ZCallersFileIndex! = ZCallersFileIndex! + 1
  966.       PUT 4,ZCallersFileIndex!
  967.       IF ZOrigCallers$ <> ZCallersFile$ THEN _
  968.          ZCallersFile$ = ZOrigCallers$ : _
  969.          CALL SetCall : _
  970.          GOTO 43050
  971.       END SUB
  972. 51098 ' $SUBTITLE: 'FindFree - subroutine to find space on a device'
  973. ' $PAGE
  974. '
  975. '  NAME    -- FindFree
  976. '
  977. '  INPUTS  --     PARAMETER                    MEANING
  978. '                 ZWasZ$                       NAME OF FILE TO FIND
  979. '
  980. '  OUTPUTS -- ZFreeSpace$                      NUMBER OF BYTES FREE
  981. '
  982. '  PURPOSE -- To determine amount of free space on a device
  983. '
  984.       SUB FindFree STATIC
  985.       ON ERROR GOTO 65000
  986.       ZErrCode = 0
  987. 52000 IF ZTurboRBBS THEN _
  988.          GOTO 52003
  989.       ZFreeSpace$ = ""
  990.       CLS
  991.       ZErrCode = 0
  992. 52001 FILES ZWasZ$
  993.       IF ZErrCode = 53 AND (ZWasZ$ = ZCmntsFile$ OR ZWasZ$ = ZUpldDriveFile$ ) THEN _
  994.          CALL OpenOutW (ZWasZ$) : _
  995.          GOTO 52000
  996.       IF ZErrCode = 53 AND ZWasZ$ = ZUpldDir$ THEN _
  997.          ZOutTxt$ = "Upload directory missing.  Tell SYSOP" : _
  998.          ZSubParm = 6 : _
  999.          CALL TPut : _
  1000.          GOTO 52002
  1001.       FOR WasX = 1 TO 25
  1002.          ZFreeSpace$ = ZFreeSpace$ + CHR$(SCREEN (3,WasX))
  1003.       NEXT
  1004. 52002 ZSubParm = 1
  1005.       CALL Line25
  1006.       EXIT SUB
  1007. 52003 WasAX = 0
  1008.       WasBX = 0
  1009.       WasCX = 0
  1010.       WasDX = 0
  1011.       IF MID$(ZWasZ$,2,1) = ":" THEN _
  1012.          WasAX = ASC(ZWasZ$) - ASC("A") + 1
  1013.       CALL RBBSFree (WasAX,WasBX,WasCX,WasDX)
  1014.       WasI# = CDBL(WasAX) * (WasBX + 65536! * (-(WasBX < 0)))
  1015.       WasI# = WasI# * WasCX
  1016.       ZFreeSpace$ = STR$(WasI#) + _
  1017.                     " bytes free"
  1018.       END SUB
  1019. 57978 ' $SUBTITLE: 'OpenWork - subroutine to open RBBS-PC's work file (2)'
  1020. ' $PAGE
  1021. '
  1022. '  NAME   -- OpenWork
  1023. '
  1024. '  INPUTS --     PARAMETER                    MEANING
  1025. '                FileNum                    # OF FILE TO OPEN AS
  1026. '                FilName$                   NAME OF FILE TO FIND
  1027. '                ZShareIt                   USE DOS' "SHARE" FACILITIES
  1028. '
  1029. '  OUTPUTS -- ZErrCode                        ERROR CODE
  1030. '
  1031. '  PURPOSE -- To open RBBS-PC's "work" file (number 2)
  1032. '
  1033.       SUB OpenWork (FileNum,FilName$) STATIC
  1034.       ON ERROR GOTO 65000
  1035. 58000 CLOSE FileNum
  1036. 58010 ZErrCode = 0
  1037. 58020 IF ZShareIt THEN _
  1038.          OPEN FilName$ FOR INPUT SHARED AS #FileNum _
  1039.       ELSE OPEN "I",FileNum,FilName$
  1040.       IF ZErrCode = 52 THEN _
  1041.          GOTO 58010
  1042. 58030 END SUB
  1043. 58190 ' $SUBTITLE: 'OpenFMS - subroutine to open the FMS directory'
  1044. ' $PAGE
  1045. '
  1046. '  NAME    -- OpenFMS
  1047. '
  1048. '  INPUTS  -- PARAMETER                      MEANING
  1049. '             ZShareIt                DOS SHARING FLAG
  1050. '             ZFMSDirectory$          NAME OF FMS DIRECTORY
  1051. '
  1052. '  OUTPUTS -- LastRec                NUMBER OF THE Last
  1053. '                                    RECORD IN THE FILE
  1054. '
  1055. '  PURPOSE -- To open the upload directory as a random file and find
  1056. '             the number of the last record in the file.
  1057. '
  1058.       SUB OpenFMS (LastRec) STATIC
  1059.       ON ERROR GOTO 65000
  1060.       FileLength = 38 + ZMaxDescLen
  1061.       CLOSE 2
  1062.       IF ZActiveFMSDir$ = "" THEN _
  1063.          IF ZMenuIndex = 6 THEN _
  1064.             ZActiveFMSDir$ = ZLibDir$ _
  1065.          ELSE ZActiveFMSDir$ = ZFMSDirectory$
  1066.       IF ZShareIt THEN _
  1067.          OPEN ZActiveFMSDir$ FOR RANDOM SHARED AS #2 LEN=FileLength _
  1068.       ELSE OPEN "R",2,ZActiveFMSDir$,FileLength
  1069.       IF ZErrCode > 0 THEN _
  1070.          CALL QuickTPut1 ("Drive/path does not exist or bad name for FMS dir " + _
  1071.                      ZActiveFMSDir$) : _
  1072.          END
  1073.       LastRec = LOF(2)/FileLength
  1074.       IF ZActiveFMSDir$ = PrevFMS$ THEN _
  1075.          EXIT SUB
  1076.       PrevFMS$ = ZActiveFMSDir$
  1077.       FIELD 2, FileLength AS FMSRec$
  1078.       GET #2,1
  1079.       ZWasA = (LEFT$(FMSRec$,4) <> "\FMS")
  1080.       ZUpInc = 2*(INSTR(FMSRec$," TOP ") = 0 OR ZWasA) + 1
  1081.       ZDateOrderedFMS = ZWasA OR (INSTR(FMSRec$," NOSORT") = 0)
  1082.       ZWasDF = INSTR(FMSRec$,"CH(")
  1083.       ZChainedDir$ = ""
  1084.       IF ZWasDF > 0 AND (NOT ZWasA) THEN _
  1085.          WasX = INSTR(ZWasDF,FMSRec$,")") : _
  1086.          IF WasX > 0 THEN _
  1087.             ZChainedDir$ = MID$(FMSRec$,ZWasDF+3,WasX-ZWasDF-3) : _
  1088.             CALL FindFile (ZChainedDir$,ZOK) : _
  1089.             IF NOT ZOK THEN _
  1090.                ZChainedDir$ = ""
  1091.       END SUB
  1092. 58220 ' $SUBTITLE: 'OpenOutW - sub to open output work file (2)'
  1093. ' $PAGE
  1094. '
  1095. '  NAME    -- OpenOutW
  1096. '
  1097. '  INPUTS  --     PARAMETER                 MEANING
  1098. '                 ZFileName$            NAME OF FILE TO FIND
  1099. '                 ZShareIt              USE DOS' "SHARE" FACILITIES
  1100. '
  1101. '  OUTPUTS -- ZErrCode                        ERROR CODE
  1102. '
  1103. '  PURPOSE -- To open RBBS-PC's "work" file (number 2) for output
  1104. '
  1105.       SUB OpenOutW (FilName$) STATIC
  1106.       ON ERROR GOTO 65000
  1107.       CLOSE 2
  1108. 58225 ZErrCode = 0
  1109. 58230 IF ZShareIt THEN _
  1110.          OPEN FilName$ FOR OUTPUT SHARED AS #2 _
  1111.       ELSE OPEN "O",2,FilName$
  1112. 58235 END SUB
  1113. 58260 ' $SUBTITLE: 'KillWork - subroutine to delete a "work" file'
  1114. ' $PAGE
  1115. '
  1116. '  NAME    -- KillWork
  1117. '
  1118. '  INPUTS  --     PARAMETER                    MEANING
  1119. '                 FilName$                  NAME OF FILE TO DELETE
  1120. '
  1121. '  OUTPUTS -- ZErrCode                        ERROR CODE
  1122. '
  1123. '  SUBROUTINE PURPOSE -- To delete a RBBS-PC "work" file
  1124. '
  1125.       SUB KillWork (FilName$) STATIC
  1126.       ON ERROR GOTO 65000
  1127.       CLOSE 2
  1128.       ZErrCode = 0
  1129. 58270 KILL FilName$
  1130. 58275 END SUB
  1131. 58280 ' $SUBTITLE: 'GetPassword - sub to read the "passwords" file'
  1132. ' $PAGE
  1133. '
  1134. '  NAME    -- GetPassword
  1135. '
  1136. '                          PARAMETER             MEANING
  1137. '  INPUTS  -- FILE # 2 OPENED
  1138. '
  1139. '  OUTPUTS -- ZTempPassword$
  1140. '             ZTempSecLevel
  1141. '             ZTempTimeAllowed
  1142. '             ZTempRegPeriod
  1143. '             ZTempMaxPerDay
  1144. '
  1145. '  PURPOSE -- To read the RBBS-PC "PASSWORDS" file
  1146. '
  1147.       SUB GetPassword STATIC
  1148.       ON ERROR GOTO 65000
  1149.       ZErrCode = 0
  1150.       INPUT #2,ZTempPassword$,     ZTempSecLevel, _
  1151.                ZTempTimeAllowed,  ZTempMaxPerDay, _
  1152.                ZTempRegPeriod,    ZStartTime, _
  1153.                ZEndTime,           ZByteMethod, _
  1154.                ZRatioRestrict#, ZInitialCredit#, _
  1155.                ZTempTimeLock
  1156. 58285 END SUB
  1157. 58290 ' $SUBTITLE: 'ReadDir - subroutine to read the "DIR" files'
  1158. ' $PAGE
  1159. '
  1160. '  NAME    -- ReadDir
  1161. '
  1162. '             PARAMETER                MEANING
  1163. '  INPUTS  -- FileNum                  WHICH # FILE TO READ
  1164. '             WhichLine                HOW MANY LINES TO ADVANCE
  1165. '
  1166. '  OUTPUTS -- ZOutTxt$
  1167. '
  1168. '  PURPOSE -- To read possible "DIR" files
  1169. '
  1170.       SUB ReadDir (FileNum,WhichLine) STATIC
  1171.       ON ERROR GOTO 65000
  1172.       ZErrCode = 0
  1173.       FOR WasI = 1 TO WhichLine
  1174.          LINE INPUT #FileNum,ZOutTxt$
  1175.       NEXT
  1176. 58295 END SUB
  1177. 58300 ' $SUBTITLE: 'ReadParms - subroutine to read parameter values'
  1178. ' $PAGE
  1179. '
  1180. '  NAME    -- ReadParms
  1181. '
  1182. '               PARAMETER             MEANING
  1183. '  INPUTS  -- FILE # 2 OPENED
  1184. '             NumParms               # parameters to read
  1185. '             WhichLine              Which set of parms to return
  1186. '  OUTPUTS -- ARA.TO.USER$           Array of string values
  1187. '             FILE.SECURITY
  1188. '             FilePswd$
  1189. '
  1190. '  PURPOSE -- To read different values, where values are
  1191. '             separated by a comma or carriage-return-line-feed.
  1192. '
  1193.       SUB ReadParms (AraToUse$(1),NumParms,WhichLine) STATIC
  1194.       ON ERROR GOTO 65000
  1195.       ZErrCode = 0
  1196.       FOR WasJ = 1 TO WhichLine
  1197.          FOR WasI = 1 TO NumParms
  1198.             INPUT #2,AraToUse$(WasI)
  1199.          NEXT
  1200.       NEXT
  1201. 58305 END SUB
  1202. 58310 ' $SUBTITLE: 'ReadAny - subroutine to read file 2 into ZOutTxt$'
  1203. ' $PAGE
  1204. '
  1205. '  NAME    -- ReadAny
  1206. '
  1207. '               PARAMETER             MEANING
  1208. '  INPUTS  -- FILE # 2 OPENED
  1209. '
  1210. '  OUTPUTS -- ZOutTxt$
  1211. '
  1212. '  PURPOSE -- To read file #2 into ZOutTxt$
  1213. '
  1214.       SUB ReadAny STATIC
  1215.       ON ERROR GOTO 65000
  1216.       ZErrCode = 0
  1217.       INPUT #2,ZOutTxt$
  1218. 58315 END SUB
  1219. 58320 ' $SUBTITLE: 'PrintWork - subroutine to print to file 2'
  1220. ' $PAGE
  1221. '
  1222. '  NAME    -- PrintWork
  1223. '
  1224. '               PARAMETER             MEANING
  1225. '  INPUTS  -- FILE # 2 OPENED
  1226. '             STRING TO WRITE OUT
  1227. '
  1228. '  OUTPUTS -- NONE
  1229. '
  1230. '  PURPOSE -- To print a string to file #2
  1231. '
  1232.       SUB PrintWork (Strng$) STATIC
  1233.       ON ERROR GOTO 65000
  1234.       ZErrCode = 0
  1235.       PRINT #2,Strng$;
  1236. 58325 END SUB
  1237. 58330 ' $SUBTITLE: 'GetWork - subroutine to read file 2'
  1238. ' $PAGE
  1239. '
  1240. '  NAME    -- GetWork
  1241. '
  1242. '               PARAMETER             MEANING
  1243. '  INPUTS  -- RecLen            Length of record
  1244. '
  1245. '  OUTPUTS -- NONE
  1246. '
  1247. '  PURPOSE -- To read a record from file #2
  1248. '
  1249.       SUB GetWork (RecLen) STATIC
  1250.       ON ERROR GOTO 65000
  1251.       ZErrCode = 0
  1252.       FIELD 2, RecLen AS ZDnldRecord$
  1253.       GET 2,(LOC(2)+1)
  1254. 58335 END SUB
  1255. 58340 ' $SUBTITLE: 'OpenWorkA - subroutine to open output work file (2)'
  1256. ' $PAGE
  1257. '
  1258. '  NAME    -- OpenWorkA
  1259. '
  1260. '  INPUTS  --     PARAMETER                    MEANING
  1261. '              FilName$                  NAME OF FILE TO FIND
  1262. '              ZShareIt                  USE DOS' "SHARE" FACILITIES
  1263. '
  1264. '  OUTPUTS -- ZErrCode                        ERROR CODE
  1265. '
  1266. '  PURPOSE -- To open RBBS-PC's "work" file (number 2) for appended output
  1267. '
  1268.       SUB OpenWorkA (FilName$) STATIC
  1269.       ON ERROR GOTO 65000
  1270.       CLOSE 2
  1271.       ZErrCode = 0
  1272.       IF ZShareIt THEN _
  1273.          OPEN FilName$ FOR APPEND SHARED AS #2 _
  1274.       ELSE OPEN "A",2,FilName$
  1275. 58345 END SUB
  1276. 58350 ' $SUBTITLE: 'PrintWorkA - subroutine to print to file 2 with CR'
  1277. ' $PAGE
  1278. '
  1279. '  NAME    -- PrintWorkA
  1280. '
  1281. '                          PARAMETER             MEANING
  1282. '  INPUTS  --            FILE # 2 OPENED
  1283. '                        STRING TO WRITE OUT
  1284. '
  1285. '  OUTPUTS -- NONE
  1286. '
  1287. '  PURPOSE -- To print a string to file #2 followed by a carriage return
  1288. '
  1289.       SUB PrintWorkA (Strng$) STATIC
  1290.       ON ERROR GOTO 65000
  1291.       ZErrCode = 0
  1292.       PRINT #2,Strng$
  1293. 58355 END SUB
  1294. 58360 ' $SUBTITLE: 'CheckInt - subroutine to check input is an integer'
  1295. ' $PAGE
  1296. '
  1297. '  NAME    -- CheckInt
  1298. '
  1299. '             PARAMETER             MEANING
  1300. '  INPUTS  -- Strng$         STRING TO VERIFY CAN BE AN INTEGER
  1301. '
  1302. '  OUTPUTS -- ZErrCode             = 0 MEANS IT IS AN INTEGER VALUE
  1303. '                                 <> 0 MEANS IT IS NOT AN INTEGER VALUE
  1304. '             ZTestedIntValue  Integer value of expression
  1305. '
  1306. '  PURPOSE -- To validate that a string represents an integer
  1307. '
  1308.       SUB CheckInt (Strng$) STATIC
  1309.       ON ERROR GOTO 65000
  1310.       ZErrCode = 0
  1311.       WasX$ = Strng$
  1312.       CALL Trim (WasX$)
  1313.       ZTestedIntValue = VAL(LEFT$(WasX$,INSTR(WasX$+" "," ")-1))
  1314. 58365 END SUB
  1315. 59650 ' $SUBTITLE: 'PutCom -- subroutine to write to communications port'
  1316. ' $PAGE
  1317. '
  1318. '  NAME    --  PutCom
  1319. '
  1320. '  INPUTS  --   PARAMETER     MEANING
  1321. '                STNG$       STRING TO PRINT TO COMM PORT
  1322. '              ZFlowControl  WHETHER USING CLEAR TO SEND FOR FLOW
  1323. '                            CONTROL BETWEEN THE PC AND THE MODEM
  1324. '
  1325. '  OUTPUTS --
  1326. '
  1327. '  PURPOSE -- Checks for carrier drop and flow control (xon/xoff)
  1328. '             before writing to the communications port.
  1329. '
  1330.       SUB PutCom (Strng$) STATIC
  1331.       ON ERROR GOTO 65000
  1332.       IF ZLocalUser THEN _
  1333.          EXIT SUB
  1334.       CALL CheckCarrier
  1335.       IF ZSubParm = -1 THEN _
  1336.          EXIT SUB
  1337.       IF NOT ZXOffEd THEN _
  1338.          GOTO 59652
  1339.       ZSubParm = 1
  1340.       CALL Line25
  1341.       ZWasY$ = ZXOff$
  1342.       XOffTimeout! = TIMER + ZWaitBeforeDisconnect
  1343.       WHILE ZWasY$ = ZXOff$ AND ZSubParm <> -1
  1344.          Char = -1
  1345.          WHILE Char = -1 AND ZSubParm <> -1
  1346.             GOSUB 59654
  1347.          WEND
  1348.          IF Char <> -1 THEN _
  1349.             CALL GetCom(ZWasY$) : _
  1350.             IF ZXOnXOff AND ZWasY$ <> ZXOn$ THEN _
  1351.                ZWasY$ = ZXOff$
  1352.       WEND
  1353.       ZXOffEd = ZFalse
  1354.       ZSubParm = 1
  1355.       CALL Line25
  1356. 59652 ZNotCTS = ZFalse
  1357.       IF NOT ZFossil THEN _
  1358.          PRINT #3,Strng$; : _
  1359.          EXIT SUB
  1360.       IF Strng$ = "" THEN _
  1361.          EXIT SUB
  1362.       FOR WasN = 1 TO LEN(Strng$)
  1363.           Char = ASC(MID$(Strng$,WasN,1))
  1364. 59653     CALL FosTXChar(ZComPort,Char,Result)
  1365.           IF Result = 0 THEN _
  1366.              GOTO 59653
  1367.       NEXT
  1368.       EXIT SUB
  1369. 59654 CALL EofComm (Char)
  1370.       CALL GoIdle
  1371.       CALL CheckCarrier
  1372.       CALL CheckTime(XOffTimeout!, TempElapsed!,1)
  1373.       IF ZSubParm = 2 THEN _
  1374.          ZSubParm = -1
  1375.       RETURN
  1376.       END SUB
  1377. 59660 ' $SUBTITLE: 'PutWork -- subroutine to write to upload files'
  1378. ' $PAGE
  1379. '
  1380. '  NAME    -- PutWork
  1381. '
  1382. '  INPUTS  --   PARAMETER     MEANING
  1383. '                STNG$       STRING TO WRITE TO FILE
  1384. '                RecNum      RECORD NUMBER TO WRITE
  1385. '                RecLen      LENGTH OF RECORD TO WRITE
  1386. '
  1387. '  OUTPUTS --
  1388. '
  1389. '  PURPOSE -- Writes uploaded file records to work file
  1390. '
  1391.       SUB PutWork (Strng$,RecNum,RecLen) STATIC
  1392.       ON ERROR GOTO 65000
  1393.       FIELD #2,RecLen AS ZUpldRec$
  1394.       LSET ZUpldRec$ = Strng$
  1395.       RecNum = RecNum + 1
  1396.       PUT #2,RecNum
  1397.       END SUB
  1398. 59680 ' $SUBTITLE: 'RBBSPlay -- subroutine to play music'
  1399. ' $PAGE
  1400. '
  1401. '  NAME    -- RBBSPlay
  1402. '
  1403. '  INPUTS  --   PARAMETER     MEANING
  1404. '               Strng$      STRING TO PLAY
  1405. '
  1406. '  OUTPUTS --
  1407. '
  1408. '  PURPOSE -- Play music.  Skip if get an error.
  1409. '
  1410.       SUB RBBSPlay (StringToPlay$) STATIC
  1411.       PLAY StringToPlay$
  1412.       ZErrCode = 0
  1413.       END SUB
  1414. 59700 ' $SUBTITLE: 'Talk -- subroutine for voice response'
  1415. ' $PAGE
  1416. '
  1417. '  NAME    -- Talk
  1418. '
  1419. '  INPUTS  --   PARAMETER     MEANING
  1420. '               ZVoiceType    TYPE OF VOICE SYNTHESIZER
  1421. '               VoiceRecord   RECORD NUMBER TO RETRIEVE
  1422. '
  1423. '  OUTPUTS --
  1424. '
  1425. '  PURPOSE -- Retrieve voice record and send to voice synthesizer
  1426. '
  1427.       SUB Talk (VoiceRecord,StringWork$) STATIC
  1428.       IF ZVoiceType = 0 THEN _
  1429.          EXIT SUB
  1430.       IF VoiceRecord > 0 THEN _
  1431.          GOTO 59720
  1432.       CLOSE 7,8
  1433.       IF ZVoiceType = 1 THEN _
  1434.          OPEN "COM2:2400,E,7,1,CS65535" AS #7 : _
  1435.          LPRINT "OPENED COM PORT"
  1436.       IF ZShareIt THEN _
  1437.          OPEN "RBBSTALK.DEF" FOR RANDOM SHARED AS #8 LEN=32 _
  1438.       ELSE OPEN "R",8,"RBBSTALK.DEF",32
  1439.       FIELD 8,30 AS TalkRecord$,2 AS Dummy$
  1440.       EXIT SUB
  1441. 59720 IF NOT ZSnoop THEN _
  1442.          EXIT SUB
  1443.       IF VoiceRecord < 65 THEN _
  1444.          GET 8,VoiceRecord : _
  1445.          StringWork$ = TalkRecord$ : _
  1446.          CALL Trim (StringWork$)
  1447. 59721 IF ZSmartTextCode THEN _
  1448.          CALL SmartText (StringWork$, CRFound,ZFalse)
  1449. 59722 IF ZVoiceType = 1 THEN _
  1450.          PRINT #7,StringWork$
  1451. 59723 IF ZVoiceType = 2 THEN _
  1452.          CALL RBBSHS (CHR$(LEN(StringWork$)+1)+StringWork$+CHR$(13))
  1453.       END SUB
  1454. 59725 ' $SUBTITLE: 'CommPut -- Writes to communications port'
  1455. ' $PAGE
  1456. '
  1457. '  NAME    -- CommPut
  1458. '
  1459. '  INPUTS  --   PARAMETER     MEANING
  1460. '               Strng$        String to write
  1461. '               ZFossil       Whether using Fossil driver
  1462. '
  1463. '  OUTPUTS --
  1464. '
  1465. '  PURPOSE -- Send string to comm port.  Recovers from errors.
  1466. '
  1467.       SUB CommPut (Strng$) STATIC
  1468.       ON ERROR GOTO 65000
  1469.       IF ZFossil THEN _
  1470.          Bytes = LEN(Strng$) : _
  1471.          CALL FosWrite(ZComPort,Bytes,Strng$) _
  1472.       ELSE PRINT #3,Strng$;
  1473.       END SUB
  1474. 59790 ' $SUBTITLE: 'FindFile -- subroutine to find a file'
  1475. ' $PAGE
  1476. '
  1477. '  NAME    --  FindFile
  1478. '
  1479. '  INPUTS  --  PARAMETER         MENANING
  1480. '               FilName$         NAME OF FILE TO LOOK FOR
  1481. '               FExists          WHETHER FILE EXISTS
  1482. '
  1483. '  OUTPUTS --  RETURNED.VALUE    VALUE RETURNED
  1484. '                                TRUE  = FILE EXISTS
  1485. '                                TRUE = FILE DOES NOT EXIST
  1486. '
  1487. '  PURPOSE --  Determine whether passed file FilName$ exists
  1488. '              Unlike, FindIt, this routine does not open any
  1489. '              file and, hence, does not create one in determining
  1490. '              whether a file exists.
  1491. '
  1492.       SUB FindFile (FilName$,FExists) STATIC
  1493.       CALL BadFileChar (FilName$,FExists)
  1494. 59791 IF FExists THEN _
  1495.          IOErrorCount = 0 : _
  1496.          CALL RBBSFind (FilName$,WasZ,WasY,WasM,WasD) : _
  1497.          FExists = (WasZ = 0)
  1498.       END SUB
  1499. '  $SUBTITLE: 'Error Handling for separately compiled subroutines'
  1500. '  $PAGE
  1501. '
  1502. '
  1503. ' Error handling for the separately compiled subroutines of RBBS-PC
  1504. '
  1505. '
  1506. 65000 IF ZDebug THEN _
  1507.          ZOutTxt$ = "RBBSSUB1 DEBUG Error Trap Entry ERL=" + _
  1508.               STR$(ERL) + _
  1509.               " ERR=" + _
  1510.               STR$(ERR) : _
  1511.          IF ZPrinter THEN _
  1512.             CALL Printit(ZOutTxt$) _
  1513.          ELSE CALL LPrnt(ZOutTxt$,1)
  1514.       ZErrCode = ERR
  1515. '
  1516. '     SetCall
  1517. '
  1518.       IF ERL = 110 THEN _
  1519.           RESUME NEXT
  1520. '
  1521. '     OPEN CONFIG FILE
  1522. '
  1523.        IF ERL => 117 AND ERL <= 119 THEN _
  1524.           RESUME NEXT
  1525. '
  1526. '     OPEN COM PORT ERROR HANDLING
  1527. '
  1528.       IF ERL = 200 THEN _
  1529.          CLS : _
  1530.          CALL PScrn (ZComPort$ + " does not exist/not responding- Error" + STR$(ERR)) : _
  1531.          STOP
  1532. '
  1533. '     GetCom ERROR HANDLING
  1534. '
  1535.        IF ERL = 1420 AND ERR = 57 THEN _
  1536.           RESUME NEXT
  1537.        IF ERL = 1420 AND ERR = 69 THEN _
  1538.           ZSubParm = -1 :_
  1539.           RESUME NEXT
  1540. '
  1541. '      OPENRESEQ ERROR HANDLING
  1542. '
  1543.        IF ERL = 1481 THEN _
  1544.            ZErrCode = ERR : _
  1545.            RESUME NEXT
  1546. '
  1547. '      OpenUser ERROR HANDLING
  1548. '
  1549.        IF ERL = 9400 AND ERR = 75 AND ZShareIt THEN _
  1550.           CALL DelayTime (30) : _
  1551.           RESUME
  1552. '
  1553. '      FindUser ERROR HANDLING
  1554. '
  1555.        IF ERL = 12610 THEN _
  1556.           RESUME NEXT
  1557. '
  1558. '     UpdtCalr ERROR HANDLING
  1559. '
  1560.        IF ERL = 13663 THEN _
  1561.           RESUME NEXT
  1562.        IF ERL = 13672 AND ERR = 61 THEN _
  1563.           CALL QuickTPut1 ("Disk Full") : _
  1564.           IF ZDiskFullGoOffline THEN _
  1565.              GOTO 65010 _
  1566.           ELSE RESUME NEXT
  1567.        IF ERL = 13672 THEN _
  1568.           ZCallersFileIndex! = ZCallersFileIndex! - 1 : _
  1569.           RESUME NEXT
  1570. '
  1571. '     ZPrinter ERROR HANDLING
  1572. '
  1573.        IF ERL = 13674 THEN _
  1574.           ZPrinter = ZFalse : _
  1575.           RESUME
  1576. '
  1577. '      ChangeDir ERROR HANDLING
  1578. '
  1579.        IF ERL = 20103 THEN _
  1580.           ZOK = ZFalse : _
  1581.           RESUME NEXT
  1582. '
  1583. '     FindIt ERROR HANDLING
  1584. '
  1585.        IF ERL = 20221 THEN _
  1586.           RESUME NEXT
  1587.        IF ERL = 20223 AND ZErrCode = 58 THEN _
  1588.           ZErrCode = 64 : _
  1589.           ZOK = ZFalse : _
  1590.           RESUME NEXT
  1591.        IF ERL = 20223 AND ZErrCode = 76 THEN _
  1592.           CALL LPrnt("Bad path.  File name is " + FilName$,1) : _
  1593.           ZErrCode = 76 : _
  1594.           ZOK = ZFalse : _
  1595.           RESUME NEXT
  1596.        IF ERL => 20221 AND ERL <= 20223 AND ZErrCode = 70 _
  1597.           AND ZNetworkType = 6 THEN _
  1598.              ZErrCode = 0 : _
  1599.              RESUME NEXT
  1600.        IF ERL => 20221 AND ERL <= 20223 THEN _
  1601.           RESUME
  1602. '
  1603. '     FlushCom ERROR HANDLING
  1604. '
  1605.        IF ERL = 20311 AND ERR = 57 THEN _
  1606.           RESUME NEXT
  1607.        IF ERL = 20311 AND ERR = 69 THEN _
  1608.           ZAbort = ZTrue : _
  1609.           ZSubParm = -1 : _
  1610.           RESUME NEXT
  1611. '
  1612. '     NetBIOS ERROR HANDLING
  1613. '
  1614.        IF ERL => 29900 AND ERL <= 29920 THEN _
  1615.           RESUME NEXT
  1616. '
  1617. '     UpdateC ERROR HANDLING
  1618. '
  1619.       IF ERL => 43050 AND ERL <= 43060 AND ERR = 61 THEN _
  1620.          ZOutTxt$ = "* Disk full - terminating *" : _
  1621.          ZSubParm =2 : _
  1622.          CALL TPut : _
  1623.          IF ZDiskFullGoOffline THEN _
  1624.            GOTO 65010 _
  1625.          ELSE SYSTEM
  1626. '
  1627. '     CheckInt ERROR HANDLING
  1628. '
  1629.        IF (ERL = 59652 OR ERL = 59727) AND ERR = 24 THEN _
  1630.           ZNotCTS = ZTrue : _
  1631.           CALL Line25 : _
  1632.           ZErrCode = 0 : _
  1633.           RESUME
  1634.        IF ERL => 52000 AND ERL <= 59725 THEN _
  1635.           RESUME NEXT
  1636. '
  1637. '     FindFile ERROR HANDLING
  1638. '
  1639.        IF ERL = 59791 THEN _
  1640.           IF ERR = 57 THEN _
  1641.              CALL DelayTime (1) : _
  1642.              CALL UpdtCalr ("SLOW I/O ERROR",1) : _
  1643.              IOErrorCount = IOErrorCount + 1 : _
  1644.              IF IOErrorCount < 11 THEN _
  1645.                 RESUME
  1646. '
  1647. '     CATCH ALL OTHER ERRORS
  1648. '
  1649.        ZOutTxt$ = "RBBS-SUB1 Untrapped Error" + _
  1650.             STR$(ERR) + _
  1651.             " in line" + _
  1652.             STR$(ERL)
  1653.        CALL QuickTPut1 (ZOutTxt$)
  1654.        CALL UpdtCalr (ZOutTxt$,2)
  1655.        RESUME NEXT
  1656. '     SHARED ROUTINE FOR GOING OFF LINE WHEN DISK FULL
  1657. 65010  CALL OpenCom(ZModemInitBaud$,",N,8,1")
  1658.        CALL TakeOffHook
  1659.        IF ZFossil THEN _
  1660.           CALL FOSExit(ZComPort)
  1661.        SYSTEM
  1662.