<< T P B B S >> Turbo Pascal Bulletin Board System by James Whorton - OBBS sysop Eddie H. Curlin - BOS sysop Note: TPBBS has been placed into the public domain by the authors. Feel free to use and modify this program in any way. TPBBS, as its name implies, is a bulletin board system written wholly in Turbo Pascal (c). Turbo Pascal is a copyright of Borland International, Scotts Valley, CA. Turbo Pascal was chosen as the programming language because it is inexpensive and easy to use. For these reasons, we feel that TP is going to come on strong in the microcomputer world. With this in mind, TPBBS was written to help show what TP is capable of. (Note: we realize that this system is not anywhere near perfection, or rather what we're aiming for, so rest assured that there will be more versions on the way. JW) TPBBS is distributed as a library of files. As currently set up, there are eight (8) files in the TPBBS10.LBR. All of these are required by the TPBBS system. The included files are as follows: TPBBS10.DOC > Document file for TPBBS ver 1.0 TPINIT10.PAS > BBS initialization for ver 1.0 TPUTIL10.PAS > sysop's utility program TPBBS10.PAS > main program of BBS ver 1.0 TPMESG10.PAS > message subsystem ver 1.0 TPFUNC10.INC > common functions used in both TPBBS and TPMESG TPMENU > BBS main menu file This documentation will lead you, step-by-step, through the necessary changes to customize the TPBBS to your own system. All of these changes are cosmetic, the system will run without making any changes. TPBBS is a full-featured bulletin board system written in Turbo Pascal. Turbo Pascal (TP) is a highly structured programming language by Borland International. Using TP required that the TPBBS be written in a modular form. The various modules make updating and upgrading the system easier. If you want to add a function, you only need to make the change in a couple of 1 modules and then re-compile the program. First a short explanation of the items you will need to change to personalize the BBS system to your own individual BBS. TPINIT10.PAS ------------ This file sets up various files that the BBS expects to find on your disk. (ie USER, COUNTERS, COMMENTS, CALLER). TP has its own format for writing random access files to disk. You cannot set these up using a normal text editor. Therefore, you MUST run TPINIT in order to start the files. Failing to do this will cause the TPBBS to abort with an error message. TPINIT contains some information that must be changed to your own parameters. In the constant definition area (beginning of file) there is a provision for allowing sysop to add an .EXT to his file names. Change (EXT:='') to a period followed by whatever three-character extension you wish to use. (i.e. '.EXT') A few lines farther down there are some identifiers for your system. These are really used as data for setting up the user file. Change (Name:='Whatever your system name is') Change (Address:='Your City, Your State') Change (Lastdate:='Startup date for your system') TPBBS10.PAS ----------- In the declaration section of this file and RBBSMESG there are several options which should be set according to your wishes. label description ------------- ------------------------------------ system Your system name. drive1 Drive that BYE, or other sign-off program, is on. drive2 Drive that contains WELCOME, BULLETIN, COUNTERS, USER, etc. drive3 Drive that contains the message system files (SUMMARY, MESSAGES, etc.). ext An optional extension for your system files, such as '.EXT'. syspass1 Qwik CP/M access logon code. syspass2 Sysop's password. opencpm CP/M access switch, true=unlimited access, false=queried access. (To keep out twits). query CP/M access query. answer CP/M access query answer. clock If you don't have a real-time clock, set this to false, else set to true and install your routines to get the time and date in the getdate and get- time procedures in TPFUNC.INC. 2 NOTE: the ENTIRE declaration section in TPBBS and TPMESG must be kept EXACTLY the same, else you will experience wierd results as the variables fail to pass on chaining from one to the other. THE SYSTEM SOFTWARE ------------------- The TPBBS system is written in a modular form. The next section is a description of how each module fits into the system. (suggestion : have a printout of the files as you read through this so you may follow along as each procedure is explained.) TPFUNC.INC This file contains general purpose routines that are common to both TPBBS and TPMESG programs. If you wish to add functions, you should add them into this set of common routines. STUPCASE -This is a function that will change the string input as an argument into all UPPERCASE characters. Format for entering this function is: STUPCASE(nstring) where nstring is any string to be converted. MAKENUM -This procedure converts the string in to an integer and returns it in . If the procedure detects an error it will set x=30000. You do not pass any parameters when calling this procedure. PAD -procedure will 'pad' a string with spaces and return that string in . Format for use is PAD(input,padlength), where input is the string to be padded and padlength is the finished length of the string. This procedure maintains a standard length on all message input and comments input. PPROMPT -This procedure will prompt user for a Yes or No answer and places their reply in
. This procedure is used by the paginating function of the BBS. (keeps text files from scrolling off screen before user can read them). Pass no parameters when calling. GTLN -restricts the users input to prompts and messages to a maximum size. (currently set at 62 char per line) Used by the getstring procedure. PRINTSTRING -prints the string assigned to or . If using will print a carriage return, line feed after its output, but on will not print carriage return or line feed. This allows printing text using and questions or prompts using (users response on same line). GETSTRING -all user input is channeled through this procedure. It allows chaining commands at the prompts and it accepts input for messages and comments. You pass no parameters during calls to this procedure. BYEBYE -this procedure is the one called when the user enters a 'G' command to leave the system. BYEBYE prints a message and then clears the jump at address 00Hex and immediately runs BYE.COM GETCPM -is executed if the user has requested CPM and then entered the correct password. GETCPM prints a 'help' file if located on disk and then 3 resets the jump at address 00Hex. GETCPM then performs a warm boot to take the user to CPM. ENTR_COMMENT -is executed if user types either 'G' or 'C' (goodbye or CPM). It allows the user to enter private comments to the sysop of the system. Procedure ENTR_COMMENT allows a max of 15 lines of 62 characters to be entered and stored to disk. After giving the user an opportunity to enter comments, the procedure will branch to either the BYEBYE or GETCPM procedures, depending on the condition of 'flag'. GOODBYE -executed on 'G' command. Makes the choice of entering comments or not. EXIT_TO_CPM -If opencpm=false, asks query and gives the user 3 chances to reply correctly. If unable to do so, logs him off the system. (I implemented this to discourage non-CP/M users from tying up the system for an afternoon trying to gain access, as it is assumed that the query will relate to some command or aspect of CP/M.) If the right reply is given, asks for comments, allows entry if any, then calls GETCPM. If opencpm=true, skips the query and continues as above. PRNTUSER -list the current user file. Will list only the Name, Address and Last date on-line to the users CRT. PRNTUSER preserves the integrity of the users passwords located in USER file. TPBBS.PAS It contains most of the routines used, with the exception of the message file. The first portion of this file contains the various definitions of the variables and constants used throughout the program. The balance of the file contains the necessary procedures to run the TPBBS. PRNTTEXT -procedure to print out on screen any ASCII type file. Will print the normal files such as 'BULLETIN', 'WELCOME', 'NEWUSER' or other as assigned by the sysop. LIST_STATS -this procedure is called by command 'L' or by the sign-on module. It will list the last date that the user was on-line, with the last high message, plus it lists the current information for number of messages, high message number, and the caller number. DO_COMMAND -this is a simple procedure to take the command entered in 'GET_COMMAND' and pass the program control to the appropriate area. Some commands are handled internal to DO_COMMAND, while some (such as the message system) branch outside this procedure. This is where modifications must go to use a new command. GET_COMMAND -Prints a 'Function: ' prompt and if not set at EXPERT level will add the menu choices. The user then enters his choice, and GET_COMMAND will act to validate the command. If it does not recognize the input as a valid command, it gives the user a message telling him so. LOGIN -does the initial user log-in. If clock=false then gets the current date from the user, else gets the current time and date and logs the call to disk. Previous user information is retained in memory. Procedure then 4 logs the callers name to the CALLER file on disk and proceeds to check for messages to the caller. If messages found for this caller, he is informed of such and the message number, with a request to delete after he reads it. NEWUSER -If caller has not been previously entered in the USER file, he is transferred to NEWUSER where he is requested to enter the city and state he is calling from and then chooses a password. After validating the password, the procedure prints a file titled "NEWUSER" if on the disk. It then calls the LOGIN procedure to complete the sign-on. SIGNON -This procedure will get the users first name and last name. Checks to see if a current user and if he is, then requests his password. If password is incorrect according to the user file, after three (3) tries, the caller is disconnected. If the password was entered correctly, the program continues by going to LOGIN procedure and proceeds from that point. Following the SIGNON procedure is the main body of the program. First, the CTRL-C is killed, making it impossible for the user to break out of the program without the proper sequence of events. Then some basic user parameters are set, along with the passwords selected by the sysop. Finally, the program starts communicating with the remote computer bye making an introduction then printing a text file called "WELCOME". Then the SIGNON procedure takes over and gets the names, etc, and turns control over to GET_COMMAND. From there, it is just a series of loops around the GET_COMMAND and DO_COMMAND procedures until the user decides to get out by BYEBYE or GETCPM. TPMESG.PAS This is the messaging subsystem for the TPBBS version 1.0. This file contains all the necessary procedures for handling the message commands. The beginning of TPMESG.PAS, again, has all the definitions for variables and constants. After the definitions, you will find the various procedures. MSGPROMPT -This is the prompt for messages to be acted upon by one of the commands (Scan, Qwikscan, Kill, or Read). It simply prompts the user to enter a message number. ENTRMSG -Allows entry of a new message. Gets the header information and checks to see if the WHOTO is a valid user of the system. If not a current user, procedure will ask the user to verify the name. (Quick and dirty spelling checker). Also allows for password protection of the message (ie only sender and designated receiver may kill Private messages (of course, Sysop can, also). Allows entry of 15 lines of 62 characters. At completion of the message (ie. two C/R's), the user has the option of Listing, Editing, Aborting, Continuing, or Saving the message. A Save will update the counters file, summary file, and the message file. An Abort will cause nothing to be written to the disk. READMSG -This procedure will allow the user to enter the number of a message to be read. If the message is private, it will not be read and the user will be informed that it is a private message. If the number is not an existing message number, the user will be informed of that fact, also. 5 This procedure will loop onto itself until the user enters a response that it takes to be '0' or that it does not understand. SUMMINIT -Called by both Summary and Qwiksummary, this procedure accepts the user's input for a message number to begin the summary. It then attempts to validate that message number. Upon validation, it sets the file-pointer to the beginning of the message number requested by the user. SUMMARIZE -This procedure will give the user a complete summary of the message headers from the message number requested to the end of the file. QWIK_SUMMARY -The same as SUMMARIZE above, except it returns only message number and Subject to the user. KILLMSG -Allows the user to 'kill' a message after he has read it. It validates the attempt before completing the kill operation. Only the user who originally entered a message, or the designated recipient are allowed to kill the message. (of course, the sysop retains the ability to kill any message left on his BBS). The killing of a message will update the following files: summary, message, and counters. GET_COMMAND -this one is tailored to the message subsystem. Basically it is the same as GET_COMMAND in the TPBBS.PAS file except this one relates to the message system. DO_COMMAND -again, this one is much the same as in the TPBBS.PAS file, but it relates to the message subsystem only. The main program body follows these procedures. It is only 6 lines long. This is simply a loop construction to keep going from GET_COMMAND to DO_COMMAND until the user enters an 'A' to abort back to the main program. TPINIT.PAS This program simply initializes all the files used by the system. Turbo Pascal random-access files are different from those you may be used to with BASIC. Because of this, Turbo Pascal cannot read the text editor created files as a random file. In order to have true random capability, we had to generate dummy files using TPINIT.PAS. TPINIT will create the following files: USER ----- using dummy information from the sysops input of a system name and address and a date of creation. COUNTERS - setting all fields to '0' CALLERS -- setting caller to '1' and the rest to null strings. COMMENTS - setting first record to '1' TPUTIL.PAS This is the sysop's utility file. It will allow the system operator to have complete control over his BBS. Using TPUTIL, the sysop can update his message and summary files. This removes deleted messages, making room for new messages to be entered to the board. 6 INSTALLATION OF TPBBS --------------------- In order to run TPBBS, you must first compile the programs into the necessary command files which your computer can execute. To compile programs, you must have a working Turbo Pascal program for your system. TPBBS.PAS First you must compile the TPBBS.PAS file into a .COM file. Put a copy of Turbo Pascal into drive , and load it. Put a copy of your TPBBS.PAS, TPFUNC.INC and TPMISC.PAS into drive . Now log onto drive , enter the main file name as TPBBS. Choose the Options and set the parameter to .Com file, End address to 8000Hex and Quit. Now enter C to compile the program. After the program is compiled, you will have a command file that will run on your system. But you must now compile the message system,TPMESG.PAS TPMESG.PAS While Turbo Pascal is still in drive , put a copy of TPMESG.PAS, TPFUNC.INC, and TPMISC.PAS into drive . Enter the main file name as TPMESG and, again, choose the Options menu. This time set .cHn for a chain file and set the end address at 8000Hex. Quit to the main menu, and enter C to compile this program. After TPMESG has been compiled, you will have a file on your disk named TPMESG.CHN. When you run TPBBS, it will chain to the message system anytime you enter an 'M' command. You still aren't ready to run the BBS yet. If you tried, the program would abort giving you an error message, meaning it couldn't find the USER file. TPINIT.PAS You must now compile the TPINIT.PAS into a .COM file. Put TPINIT.PAS into drive and set the main file name to TPINIT. At the options menu, select the .Com file and Quit to the main menu. (no need to set the end address). Enter C to compile the program, and you will have the initialization command file on your disk. Now, put a blank disk into drive and TPINIT.COM into drive . Type B:TPINIT and the files; user, callers, counters, comments, will be opened on the blank disk in drive . Put copies of TPBBS.COM and TPMESG.CHN on to the disk in drive (with the newly created files) and you are ready to run. Suggestion: change the name that BYE searches for to TPBBS.COM in order not to have any conflict with RBBS.COM. (you could change the name of TPBBS to RBBS, but then you would not know which program you really had, and you would need to make internal changes to TPMESG.CHN; it searches for TPBBS when user aborts back the main program) Much of this program is simply converted from the RBBS.BAS program. The 7 various people that have kept RBBS.BAS updated have kept it available to the public domain. Without that, TPBBS.PAS would probably never have been written. Thanks to the following for RBBS.BAS. Bruce Ratoff, Howard Moulton, Ron Fowler, Tim Nicholas, David Kozinn, and others. BUGS ---------------------------- There are two bugs still in this system, but we have decided to go ahead and release the first version and fix them in the near future. They are: 1. The file PASSWORD, used to supply the SYSOP's password and such, does not read properly into memory. So if you wish to change the info. you will have to recompile the system. 2. Sometimes when first trying to access the system after a cold boot, the SYSOP will experience errors. These may be because of my machine, and they never seem to last beyond 2 login attempts, so they're not fatal. Ed Curlin -- MASTERMIND James Whorton -- MINDLESS