home *** CD-ROM | disk | FTP | other *** search
- {----------------------------------------------------------------------}
- { }
- { Library: DOORLOGR.INC }
- { Purpose: RBBS-PC DOORS Application Program Usage Logging Library }
- { Language: Borland Turbo Pascal Version 3.00 }
- { }
- { Author: Richard L. Tremmel, GTE/Florida }
- { General Service - Electronic Operations Support }
- { 610 Zack St. MC-20, Tampa, FL 33601 Voice: 813-224-7127 }
- { GTE Telenet: GTFL.EOS or contact me on the following: }
- { SUNSHINE RBBS 813-887-3984 or TAMIAMI RBBS 813-793-2392 }
- { }
- { Notice: This library is placed in the public domain and may be }
- { freely used by anyone for any purpose. When using this }
- { code, please give credit to the original author and to }
- { anyone who has subsequently improved or modified it. }
- { }
- { History: Version 1.00, 08/30/85 - Original by Richard L. Tremmel }
- { }
- { Narrative: This Turbo Pascal include library provides a means of }
- { logging the usage and activity of RBBS-PC "Doors" }
- { application programs. Generalized logon and logoff pro- }
- { cedures are included along with a routine to log any }
- { messages passed from the application program to the log }
- { file. }
- { }
- { Required: The DOORLOGR.INC library requires the DOORIO.INC and }
- { DATETIME.INC libraries to be previously "included". }
- { }
- { The DOORLOGR.INC library requires the following type }
- { definition: }
- { }
- { STRING60 : string[60]; (used for log file messages) }
- { }
- { The DOORLOG.INC library requires the following variables }
- { or constants to be defined: }
- { }
- { PNAM : string (application program name) }
- { }
- { PVER : string (application program version) }
- { }
- { PORTN : integer (async port number to use) }
- { }
- { TIMELIMIT : integer (input time-out in seconds) }
- { }
- {----------------------------------------------------------------------}
-
- const
- RBBSNAME = 'System-SIX'; {RBBS-PC Name }
- LOGFILENAME = 'C:\SIX\DOORS\RBBSDOOR.LOG'; {Door log file name}
- MESSAGESFILENAME = 'C:\SIX\MESSAGES'; {RBBS-PC MESSAGES }
- {file name }
-
- {.PA}
- {This procedure is used internally by the DOORLOGR.INC library to get }
- {the name of the last logged on user and the status of the printer. }
- {NOTE - this routine assumes only a single user RBBS system (only one }
- {node. I will leave it up to someone else to hassle with multiple }
- {node RBBS's. }
-
- procedure GETDOORUSER(var DOORUSER:STRING60; var PRINTER:boolean);
-
- type
- MESSAGESTYPE = array [1..128] of char;
-
- var
- MESSAGESFILE : file of MESSAGESTYPE;
- MESSAGESREC : MESSAGESTYPE;
-
- begin {GETDOORUSER}
-
- assign(MESSAGESFILE,MESSAGESFILENAME);
- {$I-} reset(MESSAGESFILE); {$I+}
- {$I-} seek(MESSAGESFILE,1); {$I+} {skip checkpoint record}
- {$I-} read(MESSAGESFILE,MESSAGESREC); {$I+} {get node record #1}
- PRINTER := false;
- if ioresult = 0
- then
- begin
- if copy(MESSAGESREC,38,2) = '-1'
- then
- PRINTER := true;
- DOORUSER := MESSAGESREC;
- DOORUSER[0] := chr(31) {force string length to 31}
- end
- else
- DOORUSER := 'Error Reading '+MESSAGESFILENAME;
- close(MESSAGESFILE)
- end; {GETDOORUSER}
- {.PA}
- {This procedure will write a 'LOGINFO' message along with date and time}
- {stamp to the door log file and also echo the message to the line }
- {printer if it is on-line per RBBS (LPT flag). If the Door log file }
- {does not exist, it will be created. }
-
- procedure LOGDOOR(LOGINFO:STRING60);
-
- const
- LOGGEDIN : boolean = false;
- PRINTERON : boolean = false;
-
- var
- LOGFILE : text;
- DATE,TIME : STRING8;
- DOORUSER : STRING60;
-
- begin {LOGDOOR}
- DATETIME(DATE,TIME);
- if not LOGGEDIN
- then
- GETDOORUSER(DOORUSER,PRINTERON);
- assign(LOGFILE,LOGFILENAME);
- {$I-} append(LOGFILE); {$I+}
- if ioresult <> 0
- then
- begin
- rewrite(LOGFILE);
- write (LOGFILE,DATE,' @ ',TIME);
- writeln(LOGFILE,' Log File ',LOGFILENAME,' Initialized');
- if PRINTERON
- then
- writeln(lst,' ':8,'Log File ',LOGFILENAME,' Initialized')
- end;
- if not LOGGEDIN
- then
- begin
- write (LOGFILE,DATE,' @ ',TIME,' ',PNAM,' ',PVER);
- writeln(LOGFILE,' run by ',DOORUSER);
- LOGGEDIN := true;
- if PRINTERON
- then
- writeln(lst,' ':8,PNAM,' ',PVER,' run by ',DOORUSER)
- end;
- if length(LOGINFO) > 0
- then
- begin
- writeln(LOGFILE,' ':11,TIME,' ',LOGINFO);
- if PRINTERON
- then
- writeln(lst,' ':8,LOGINFO)
- end;
- close(LOGFILE)
- end; {LOGDOOR}
- {.PA}
- {This procedure is a simple Door application logon routine to issue an }
- {initial welcome message to the user and write a message to the log }
- {file indicating the name, version, and time the application program }
- {started running. It also provides the user with some basic program }
- {information. }
-
- procedure LOGON(LOGINFO:STRING60);
-
- var
- LOGONTEMP : string[2];
-
- begin {LOGON}
- LOGDOOR('');
- COLN('');
- COLN(PNAM+' '+PVER);
- str(TIMELIMIT div 60:2,LOGONTEMP);
- COLN('');
- COLN('Input time-out set to '+LOGONTEMP+' minutes.');
- COLN('Hit BackSpace to delete previous character.');
- COLN('Hit Control-X to cancel current input line.');
- if ABORTABLE
- then
- COLN('Hit Control-C to abort program.');
- COLN('');
- COLN(LOGINFO)
- end; {LOGON}
- {.PA}
- {This procedure is a simple Door application logoff routine to issue a }
- {message to the log file to indicate the program has terminated and }
- {additionally will force a line disconnect or return to the RBBS at the}
- {user's option. }
-
- procedure LOGOFF;
-
- const
- COM_RESET_MASK = $04; {reset modem }
- COM_ENABLE_MASK = $01; {enable modem }
- COM_MCR : array [1..2] of integer = ($03FC,$02FC); {modem control }
-
- var
- LOGOFFTEMP : LINETYPE;
-
- begin {LOGOFF}
- COLN('');
- COLN(PNAM+' Done.');
- COLN('');
- COL ('Do you want to return to '+RBBSNAME+' (Y/N) ? ');
- CILN(LOGOFFTEMP);
- COLN('');
- if upcase(LOGOFFTEMP[1]) <> 'Y'
- then
- begin
- COLN('Good-bye.');
- COLN('');
- port[COM_MCR[PORTN]] := $04; {reset Smartmodem - drop data link}
- delay(1000); {wait 1 second}
- port[COM_MCR[PORTN]] := $01; {enable Smartmodem}
- LOGDOOR('Normal Program Termination - User Logged Off');
- halt
- end;
- COLN('Returning to '+RBBSNAME+', please wait...');
- COLN('');
- LOGDOOR('Normal Program Termination - Returned to '+RBBSNAME)
- end; {LOGOFF}
-