;************************************************************************** ;# # ;# HOST.ASP (C) 1990 DATASTORM TECHNOLOGIES, INC. # ;# # ;# # ;# - - - - - - - - - - - - - PURPOSE - - - - - - - - - - - - - - - - # ;# # ;# This script can be used to consistently setup and initialize # ;# PROCOMM PLUS' host mode. It also adds, to host mode, the ability # ;# to call users back. The callback feature can be used to enhance # ;# security or reverse phone charges. # ;# # ;# # ;# - - - - - - - - - - - - - TO USE - - - - - - - - - - - - - - - - # ;# # ;# 1. For each user you wish to call back, add "CALLBACK[xxx-xxxx]" # ;# after their priviledge level in the user file. For example, # ;# to indicate that John Doe can be called back at 555-1234, # ;# modify his entry in PCPLUS.USR to look like: # ;# # ;# ... # ;# DOE;JOHN;SALLY;1; CALLBACK[555-1234] # ;# ... # ;# # ;# # ;# 2. Configure the user defines (found below) to match your system. # ;# A define, USERCHANGED is set to FALSE. Please make it TRUE # ;# when you have adjusted the defines and globals for your needs. # ;# # ;# 3. Add any necessary modem initialization commands to the modem # ;# initialization function: "SetupModem" # ;# # ;# 4. Compile by entering: # ;# # ;# ASPCOMP /w1 HOST # ;# # ;# (If you compile without the /w1 option, the compiler generates # ;# warnings about unused functions as it skips them. This is OK.) # ;# # ;# # ;# - - - - - - - - - - - - - - NOTES - - - - - - - - - - - - - - - - # ;# # ;# - Callback does not make sense for direct connections. # ;# # ;# # ;# - - - - - - - - - - - - SECTIONS IN FILE - - - - - - - - - - - - - # ;# # ;# A. User defines # ;# B. Internal defines # ;# C. Global data # ;# D. MAIN # ;# E. Setup routines # ;# F. Callback routines # ;# G. High level I/O routines # ;# H. Miscellaneous routines # ;# I. Debug routines # ;# # ;# # ;########################################################################## ;########################################################################## ;# # ;# ΙΝΝΝ» # ;# Ί A.Ί USER defines # ;# ΘΝΝΝΌ # ;# # ;########################################################################## ;-------------------------------------------------------------------- ; ; This script runs in one of three modes: ; ; 1. CB_ONLY is defined. All users must be called back before gaining ; access to host mode. ; 2. CB_TOO is defined. Users with callback rights can optionally be ; called back after selecting G)oodbye. ; 3. Neither is defined. There are no callback features and this is ; primarily a host mode setup script. ; ; define CB_ONLY ; CB_ONLY for extra security. ;define CB_TOO ; CB_TOO to allow selective call back. ;-------------------------------------------------------------------- define DEBUG ; Uncomment for debugging ;-------------------------------------------------------------------- define HOSTUSRFILE "C:\PCPLUS\PCPLUS.USR" ; User data file define HOSTDLDIR "C:\PCPLUS\HOST_DN\" ; Host user accessable files define HOSTULDIR "C:\PCPLUS\HOST_UP\" ; Where files uploaded to host go define HOSTWELCOM "" ; String to send as user connects define HOSTPORT COM1 ; (COM1-COM8) COM port to use. define HOSTBAUD 19200 ; (300-115200) Highest baud rate. define HOSTCALLOG ON ; (ON | OFF) Log callbacks? define HOSTCDXFER YES ; (YES | NO) Monitor CD during transfers? define HOSTUSEDTR YES ; (YES | NO) Use DTR to hangup? define HOSTHFLOW OFF ; (ON | OFF) define HOSTSFLOW OFF ; (ON | OFF) define HOSTAUTOBD ON ; (ON | OFF) Automatically adjust baud rate? define HOSTCONTYP MODEM ; (MODEM | DIRECT) Using a modem or a cable? define HOSTMAXDIAL 3 ; (0-999) Number of times to try callback. define HOSTNEWUSR 0 ; (0 | 1) Let new users transfer files? define HOSTREMCMD OFF ; (ON | OFF) Allow remote commands? define HOSTSYSTYP CLOSED; (OPEN | CLOSED) Should system allow new users? define HOSTSHELCD ON ; (ON | OFF) Monitor CD during Shell? define HOSTTIMOUT 5 ; (0-999) Minutes inactive before hangup. ;-------------------------------------------------------------------- ;########################################################################## ;# # ;# ΙΝΝΝ» # ;# Ί B.Ί INTERNAL DEFINES # ;# ΘΝΝΝΌ # ;# # ;########################################################################## define FALSE 0 define TRUE 1 define NAMEMAX 30 define PSWDMAX 8 define DISP 1 define HIDE 0 define FLD_SEP 59 ; semi-colon ; Field separator define BOXMSG call _BoxMsg with define BOXVARI call _BoxVarI with define BOXVARS call _BoxVarS with define COPYSFLD call _CopySFld with define HOSTGETC call _HostGetC with define HOSTGETS call _HostGetS with define HOSTGETYN call _HostGetYN define HOSTGOODBYE call _HostGoodbye define HOSTHANGUP call _HostHangup define HOSTPUTS call _HostPutS with define ID call _ID with define QPAUSE call _QPause define SETFAILURE call _SetFailure define SETSUCCESS call _SetSuccess define XKEYGET call _XKeyGet with define TX transmit define USERNOTCHANGED FALSE ; <<<<====== Change to true after adjustment ; to your system's needs. ;########################################################################## ;# # ;# ΙΝΝΝ» # ;# Ί C.Ί GLOBAL DATA # ;# ΘΝΝΝΌ # ;# # ;########################################################################## string urec,uname,ufirst,ulast,upassword,uaccess,ucomment string cbnumber integer tempkey ;########################################################################## ;# # ;# ΙΝΝΝ» # ;# Ί D.Ί MAIN # ;# ΘΝΝΝΌ # ;# # ;########################################################################## proc main if USERNOTCHANGED == FALSE call warning exit else call setup ; Setup port, modem, and variables endif ;-------------------------------------------------------------------------; $ifdef CB_TOO ; Compiled if system calls back after logon ;-------------------------------------------------------------------------; while forever ;---- TOP OF loop host ; Execute host mode if not success ; If ESC key or Abort command exitwhile ; exit loop and script endif ; if null $H_NAME ; If no successful login loopwhile ; loop to restart host endif ; ; uname = $H_NAME ; uname = "firstname lastname" call ParseUsrRec ; Find and parse user record if success ; If found and parsed: call CallBackRights ; See if user has call back rights if success ; If he does: call WantsCB ; See if he wants to be called if success ; If he does: call CallBack ; Call him back endif ; loopwhile ; loop to reenter host mode endif ; endif ; hosthangup ; If not parsed or no rights, hangup endwhile ;---- end loop ;-------------------------------------------------------------------------; $elseif CB_ONLY ; Compiled if system is callback only ; ;-------------------------------------------------------------------------; while forever ;---- TOP OF loop call GetUser ; Wait for someone to login if success ; If user logged on, call CallBack ; Call him back if not connected ; loopwhile ; endif ; host ; Execute host mode if not success ; If ESC key or Abort command exitwhile ; exit loop and script endif ; else ; else ESC key pressed exitwhile ; endif ; endwhile ;---- end loop ;-------------------------------------------------------------------------; ; $else ; Compiled if system is shell around host ; ;-------------------------------------------------------------------------; host ;--------------------------; $endif ; ;--------------------------; endproc ;########################################################################## ;# # ;# ΙΝΝΝ» # ;# Ί E.Ί SETUP ROUTINES # ;# ΘΝΝΝΌ # ;# # ;# (1) Setup # ;# (2) SetupPort # ;# (3) SetupVars # ;# (4) SetupModem # ;# # ;########################################################################## ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: Setup ;* ;* Purpose: Initialize procOMM PLUS 2.0 for use as a BBS ;* ;* Input: None ;* ;* Return: None ;* ;* Preconditions: None ;* ;* Postconditions: The port, modem, and variables are initialized. ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc setup call SetupPort call SetupVars call SetupModem endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: SetupPort ;* ;* Purpose: Initialize the communications port ;* ;* Input: None ;* ;* Return: None ;* ;* Preconditions: None ;* ;* Postconditions: The port baud rate and line settings are initialized. ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc SetupPort set port hostport set baud hostbaud set parity none set databits 8 set stopbits 1 endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: SetupVars ;* ;* Purpose: Initialize sytem variables ;* ;* Input: None ;* ;* Return: None ;* ;* Preconditions: None ;* ;* Postconditions: System variables are inialized. ;* ;* Notes: Many variables are considered to be 'permanent'. ;* Consequently, they are assumed to be setup correctly ;* and are not set again here. For example, the modem ;* command strings, the modem connect strings, and the ;* options related to dialing must all be configured ;* permanently before running this script. ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc SetupVars ; Make sure both mutually exclusive $ifdef CB_ONLY ; defines aren't both defined. $ifdef CB_TOO errormsg "ERROR: Both CB_ONLY and CB_TOO are defined" exit $endif $endif set host autobaud HOSTAUTOBD ; Setup host variables using their set host connection HOSTCONTYP ; definitions at the top of this file set host dldir HOSTDLDIR set host message HOSTWELCOM set host newuserlvl HOSTNEWUSR set host systype HOSTSYSTYP set host timeout HOSTTIMOUT set host uldir HOSTULDIR set host shellboot HOSTSHELCD set callog HOSTCALLOG ; Setup miscellaneous variables using set cdinxfer HOSTCDXFER ; their definitions at the top set dropdtr HOSTUSEDTR set hardflow HOSTHFLOW set modem maxdial HOSTMAXDIAL set remotecmd HOSTREMCMD set softflow HOSTSFLOW $ifdef CB_TOO ; set goodbye action based on defined set host goodbye exit ; callback mode $elseif CB_ONLY set host goodbye hangup $else set host goodbye recycle $endif $ifdef DEBUG ; set some variables if debugging: set aspdebug on ; Put offsets in error messages set rangechk on ; Perform range checking $endif set keys on ; We do all keys set rxdata on ; We do all incoming data set kermit blockcheck 3 ; Use "3 byte CRC" set kermit filetype binary ; Use binary kermit set kermit packsize 1024 ; Negotiate up to maximum packet size set zmodem errdetect crc32 ; Use 32-bit CRC set zmodem recvcrash protect ; Don't let users overwrite files set zmodem sendcrash negotiate ; Let user recover his downloads set zmodem timestamp off ; Stamp files with system date/time set zmodem txmethod streaming ; Use fastest transmit method endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: SetupModem ;* ;* Purpose: Initialize the modem for use as a host answerer ;* ;* Input: None ;* ;* Return: None ;* ;* Preconditions: The port is setup to communicate with the modem ;* ;* Postconditions: The modem is ready to be used by host mode. ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc SetupModem integer i, savetxpace fetch txpace savetxpace fetch termnorm i set txpace 150 atsay 0 0 i "Initializing MODEM." locate 0 19 TX "ATZ^M" ; reset to defaults QPAUSE TX "ATV1^M~" ; use verbal result codes QPAUSE TX "ATQ0^M~" ; use verbal result codes QPAUSE TX "ATS7=60^M" ; wait 60 seconds for CD QPAUSE $ifdef CB_ONLY TX "ATS0=1^M" QPAUSE $endif ; ... ; ... ; ... (Insert other modem settings here) ; ... ; ... set txpace savetxpace endproc ;########################################################################## ;# # ;# ΙΝΝΝ» # ;# Ί F.Ί CALLBACK ROUTINES # ;# ΘΝΝΝΌ # ;# # ;# (1) CallBack # ;# (2) CallBackRights # ;# (3) WantsCB # ;# # ;########################################################################## ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: CallBack ;* ;* Purpose: hangup and dial the callback number. ;* ;* Input: ('cbnumber' contains the number to dial) ;* ;* Return: Nothing ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc CallBack string title if connected HOSTPUTS "`r`n`r`n hangup now and make sure your modem is set to answer." HOSTPUTS "`r`n You will be called back momentarily....`r`n`r`n" HOSTHANGUP if connected return endif endif strfmt title "Calling: %s" uname mdial cbnumber title endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: CallBackRights ;* ;* Purpose: Check .USR comment field for special callBACK string ;* ;* Input: None ;* ;* return: success if user has call back rights and 'cbnumber' ;* set to the number to be dialed. ;* FAILURE if user can't be called back. ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc CallBackRights integer idx find ucomment "CALLBACK[" idx if found idx = idx + 9 substr cbnumber ucomment idx 79 find cbnumber "]" idx if found strpoke cbnumber idx 0 SETSUCCESS return endif endif SETFAILURE endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: WantsCB ;* ;* Purpose: Ask user if he wants to be called back. ;* ;* Input: None ;* ;* return: success if user wants to be called back ;* FAILURE otherwise ;* ;* Notes: If the user chooses hangup, the disconnect is done here. ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc WantsCB string response HOSTPUTS "`r`n`r`n Would you like to be called back at " HOSTPUTS cbnumber HOSTPUTS "?`r`n" HOSTPUTS " Your choice (Y=Yes, H=hangup now, C=cancel)? " while forever ; loop until we break out HOSTGETC &response ; Get a character if not success ; (If connection lost, exitwhile ; break with FAILURE set) endif ; SETFAILURE ; Assume not calling back strupr response ; Convert to upper case switch response ; What do you want user? case "Y" ; If 'Y' SETSUCCESS ; change assumption exitwhile ; and break endcase ; case "H" ; If 'H' HOSTGOODBYE ; Say goodbye and hangup exitwhile ; break endcase ; case "C" ; If 'C' or dropped thru from 'H' exitwhile ; break endcase ; endswitch endwhile endproc ;########################################################################## ;# # ;# ΙΝΝΝ» # ;# Ί G.Ί HIGH LEVEL I/O ROUTINES # ;# ΘΝΝΝΌ # ;# # ;# (1) GetUser # ;# (2) GetUserName # ;# (3) GetUserPswd # ;# (4) _HOSTGETs # ;# (5) _HOSTGETYN # ;# (6) _HOSTGETC # ;# (7) _HOSTPUTS # ;# # ;########################################################################## ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: GetUser ;* ;* Purpose: Wait for user to connect and login. ;* ;* Input: None ;* ;* return: Script aborts if ESC pressed. Otherwise, the function ;* won't return without a user. ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc GetUser statmsg "Waiting for connection (ESC aborts)..." while forever if hitkey ; Allow ESC key to exit loop XKEYGET &tempkey endif ; The logic here is slightly different than the host mode login code. ; Since security is utmost, we won't let hackers know why they are ; being disconnected (because of an unknown name or an invalid ; password). if connected ; Wait for Carrier Detect clear statrest call GetUserName ; Get the users name if success call GetUserPswd ; Get the users password if success call ParseUsrRec ; Find and parse user record if success ; If found and parsed: call CallBackRights ; See if user has call back rights if success ; If he does: exitwhile ; return success endif endif endif endif HOSTHANGUP clear statmsg "Waiting for connection (ESC aborts)..." endif endwhile endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: GetUserName ;* ;* Purpose: Input a user name ;* ;* Input: None ;* ;* return: success if user name obtained ;* FAILURE if user not obtained ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc GetUserName integer i, len, tries tries = 0 if connected pause 1 rflush endif while tries < 3 tries++ HOSTPUTS "`r`n`r`nFirst name: " HOSTGETS &ufirst NAMEMAX DISP ; Get first (and optionally last) if not success ; return FAILURE if CD drops exitwhile endif strlen ufirst len ; len = length of first name if len == 0 ; If length is zero loopwhile ; go to top of loop endif find ufirst " " i ; Is there a last name? (SPACE) if not found find ufirst ";" i ; (Look for SEMICOLON if no SPACE) endif if found ; YES, there is a last name: strpoke ufirst i 0 ; terminate the first name i++ ; i -> 1st character in last name substr ulast ufirst i 80 ; ulast is last name else HOSTPUTS "`r`n Last name: " HOSTGETS &ulast NAMEMAX DISP ; Get last name if not success ; return FAILURE if CD drops exitwhile endif strlen ulast len if len == 0 loopwhile endif endif strupr ufirst strupr ulast uname = ufirst strcat uname " " strcat uname ulast HOSTPUTS "`r`n" HOSTPUTS uname HOSTPUTS "`r`nIs this correct (Y/N)? " HOSTGETYN if success || ! connected return else ; if user says NO tries-- ; don't count it as a try endif endwhile HOSTHANGUP SETFAILURE endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: GetUserPswd ;* ;* Purpose: Input a user password ;* ;* Input: None ;* ;* return: success if user password obtained ;* FAILURE if password not obtained ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc GetUserPswd integer i, tries tries = 0 HOSTPUTS "`r`n" while tries < 3 HOSTPUTS "`r`nPassword: " HOSTGETS &upassword PSWDMAX HIDE ; Get password if not success exitwhile endif strlen upassword i if i > 0 strupr upassword SETSUCCESS return endif tries++ endwhile HOSTHANGUP SETFAILURE endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _HostGetS ;* ;* Purpose: Input a character string from the port or local keyboard ;* ;* Input: string parameter for return value ;* ;* return: If success, string variable contains the string ;* FAILURE if connection lost ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _HostGetS strparm s intparm max, dodisp integer i string response strpoke s 0 0 i = 0 while forever HOSTGETC &response if not success exitwhile endif switch response case "`r" SETSUCCESS exitwhile endcase case "`b" if i != 0 HOSTPUTS response i-- strpoke s i 0 endif endcase case " " ; This SPACE case must immediately if i == 0 ; precede the default so it will loopwhile ; fall through endif default if i < max if dodisp HOSTPUTS response else HOSTPUTS "*" endif strcat s response i++ endif endcase endswitch endwhile endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _HostGetYN ;* ;* Purpose: Input a "Y" or a "N" response ;* ;* Input: None ;* ;* return: success if Yes ;* FAILURE if No or connection lost ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _HostGetYN string response while forever HOSTGETC &response if not success return endif strupr response switch response case "Y" SETSUCCESS exitwhile endcase case "N" SETFAILURE exitwhile endcase endswitch endwhile HOSTPUTS response endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _HostGetC ;* ;* Purpose: Input a character from the port or local keyboard ;* ;* Input: string parameter for return value ;* ;* return: If success, string variable contains the character. ;* FAILURE is returned if the connection is lost. ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _HostGetC strparm c integer i = -1 while i == -1 if hitkey ; If a key is pressed XKEYGET &i ; get the key endif if comdata ; If data available at port comgetc i ; get the next character endif if not connected ; If carrier drops SETFAILURE ; set error return code return ; and return to caller endif endwhile key2ascii i c SETSUCCESS endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _HostPutS ;* ;* Purpose: Output a string to the port and the local screen ;* ;* Input: string to output ;* ;* return: None ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _HostPutS strparm s integer c,idx transmit s idx = 0 strpeek s idx c while c writec c idx++ strpeek s idx c endwhile endproc ;########################################################################## ;# # ;# ΙΝΝΝ» # ;# Ί H.Ί MISCELLANEOUS ROUTINES # ;# ΘΝΝΝΌ # ;# # ;# (1) ParseUsrRec # ;# (2) _BoxMsg # ;# (3) _CopySFld # ;# (4) _HostHangup # ;# (5) _Hostgoodbye # ;# (6) _QPause # ;# (7) _SetFailure # ;# (8) _SetSuccess # ;# (9) _XKeyGet # ;# # ;########################################################################## ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: ParseUsrRec ;* ;* Purpose: Lookup user in .USR file and parse record into globals ;* ;* Input: uname is the name of the user to lookup ;* ;* return: success if user found and parsed. ;* FAILURE if user not found or error parsing record. ;* ;* Notes: These variables are initialized: ;* uaccess - User's access level ("0", "1", or "2") ;* ucomment - User's comment field ;* ufirst - User's first name ;* ulast - User's last name ;* uname - User's full name (first and last) ;* upassword - User's password ;* urec - Raw record (terminated with a line feed) ;* ;* .USR record: ;* lastname;firstname;password;n;comment....... ;* (n is the access level {'0','1',or '2'}) ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc ParseUsrRec integer i string tmp find uname " " i ; i = index of blank name separator strcpy ufirst uname i ; copy first name i++ ; i = index of last name substr ulast uname i 79 ; extract last name strfmt tmp "%s;%s;" ulast ufirst ; 'tmp' is what we're looking for strlen tmp i ; i = length of name part fopen 1 HOSTUSRFILE "rt" ; Try to open user file if success ; If opened while not EOF 1 ; loop until end of file fgets 1 urec ; Get record strcmp urec tmp i ; Scan record for user if success ; If this is our guy, COPYSFLD &upassword urec &i FLD_SEP ; Copy password COPYSFLD &uaccess urec &i FLD_SEP ; Copy access level COPYSFLD &ucomment urec &i FLD_SEP ; Copy comment SETSUCCESS ; set return code to TRUE return ; exit endif endwhile else BOXMSG "Error opening user file." endif SETFAILURE endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _BoxMsg ;* ;* Purpose: Display a string in a box, wait for a key, restore screen ;* ;* Input: The string to display ;* ;* return: Nothing ;* ;* Notes: This routine can easily be modified to support multiple ;* line messages. ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * define COLOR 112 ; Box color define TOPLINE 2 ; Row for top of box define HPAD 3 ; Extra space around string (horizontal padding) define VPAD 1 ; Extra lines above and below string proc _BoxMsg strparm s integer len,toprow,botrow,leftcol,rightcol strlen s len if len < 18 len = 18 ; Make sure we have room for Press any key msg endif vidsave 0 toprow = TOPLINE botrow = toprow + 2 + 2*VPAD leftcol = (80-len)/2 - (HPAD+1) rightcol = leftcol+len+2*HPAD+1 box toprow leftcol botrow rightcol COLOR toprow = toprow + VPAD + 1 leftcol = leftcol + HPAD + 1 atsay toprow leftcol COLOR s atsay botrow leftcol COLOR " Press any key... " leftcol = leftcol + 17 locate botrow leftcol XKEYGET &tempkey ; get a key vidrest 0 endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _CopySFld ;* ;* Purpose: Copy a string field (SFLD) from any position within ;* the source string, to the destination string. Also, ;* increment the index by the length of the field copied. ;* ;* Input: (&destination,source,&index,field_separator) ;* ;* return: destination and int are updated. ;* ;* Notes: Terminates when a field_separator or line feed is encountered. ;* (If neither is encountered, the rest of the field is copied.) ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _CopySFld strparm dst strparm src intparm index intparm fldsep integer newidx string endstr,tmp substr endstr src index 79 ; copy end of string to local var key2ascii fldsep tmp ; tmp = field separator as a string find endstr tmp newidx ; see if a separator is in the string if not found ; If separator not found: find endstr "\n" newidx ; is a line feed in the string? if not found ; If not: strlen endstr newidx ; use the whole string endif ; endif ; strcpy dst endstr newidx ; copy field index = index + newidx + 1 ; set caller's index endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _HostHangup ;* ;* Purpose: hangup the modem (try several times) ;* ;* Input: ('cbnumber' contains the number to dial) ;* ;* return: Nothing ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _HostHangup integer hanguptries=3 if not connected return endif while hanguptries-- pause 1 hangup if not connected exitwhile endif endwhile if connected HOSTPUTS "`r`n`r`nERROR: Unable to hangup.`r`n" endif endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _HostGoodbye ;* ;* Purpose: Give goodbye message, pause, and hangup line ;* ;* Input: None ;* ;* return: None ;* ;* Notes: ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _HostGoodbye HOSTPUTS "`r`n`r`n`r`ngoodbye " HOSTPUTS $H_NAME HOSTPUTS ".`r`n`r`nThanks for calling!`r`n`r`n" HOSTPUTS "(Please hangup now)`r`n`r`n`r`n" pause 1 HOSTHANGUP endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _QPause ;* ;* Purpose: Pause a little and display a progress dot. ;* ;* Input: None ;* ;* return: None ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _QPause termwrt '.' mspause 400 endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _SetFailure ;* ;* Purpose: set FAILURE to TRUE (same as success not TRUE) ;* ;* Input: None ;* ;* return: None ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _SetFailure strcmp "X" "" endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _SetSuccess ;* ;* Purpose: set success to TRUE (same as FAILURE not TRUE) ;* ;* Input: None ;* ;* return: None ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _SetSuccess strcmp "" "" endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _XKeyGet ;* ;* Purpose: Pause until a key is pressed and exit script if ESC ;* ;* Input: None ;* ;* return: None ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _XKeyGet intparm key keyget key if (key==27) message "^M^J^M^JScript Aborted.^M^J" exit endif if (key==0x0E08) ; convert backspace key = 8 endif endproc ;########################################################################## ;# # ;# ΙΝΝΝ» # ;# Ί I.Ί DEBUG ROUTINES # ;# ΘΝΝΝΌ # ;# # ;# (1) _BoxVarI # ;# (2) _BoxVarS # ;# (3) _ID # ;# # ;########################################################################## $ifdef DEBUG ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _BoxVarI ;* ;* Purpose: Display an integer variable in a box and await key ;* ;* Input: description string and integer variable ;* ;* return: None ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _BoxVarI strparm s intparm ivar string buf strfmt buf "%s: %i" s ivar BOXMSG buf endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _BoxVarS ;* ;* Purpose: Display a string variable in a box and await key ;* ;* Input: description string and string variable ;* ;* return: None ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _BoxVarS strparm s strparm svar string buf strfmt buf "%s: `"%s`"" s svar BOXMSG buf endproc ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;* Function: _ID ;* ;* Purpose: Display a progress number in corner of screen ;* ;* Input: Progress number ;* ;* return: None ;* ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * proc _ID intparm i fatsay 0 74 112 "%5i" i XKEYGET &tempkey ; get key, abort if ESC endproc $endif $ifdef USERNOTCHANGED proc warning integer wastekey clear 30 box 7 10 18 57 30 atsay 9 12 31 "Please be certain that you have adjusted the" atsay 10 12 31 "various parameters for your system. These " atsay 11 12 31 "include modem settings, baud rates, and the " atsay 12 12 31 "upload/download directories used by this " atsay 13 12 31 "program. HOST.ASP will not run until you " atsay 14 12 31 "have adjusted these defaults and changed the" atsay 15 12 31 "value of USERNOTCHANGED to TRUE. " atsay 16 13 64 "<<<<<<< PRESS ANY KEY TO CONTINUE >>>>>>>" keyget wastekey endproc $endif