home *** CD-ROM | disk | FTP | other *** search
- ;*******************************************************
- ; NComm HOST SYSTEM
- ; Version 1.3 891117
- ;
- ; Copyright © 1989 Daniel Bloch
- ;*******************************************************
-
- set $version= "1.3"
-
- ;--------------------------------------------
- ; Set these variables to fit your needs
- ;--------------------------------------------
- set $dir = "NComm:host/" ;Directory for misc. files
- set $uldir = "NComm:host/files/" ;Upload directory
- set $dldir = "NComm:host/files/" ;Download directory
- set $hold = "NComm:host/hold/" ;Hold directory
- set $holdzoo= "t:HOLD.ZOO" ;Hold file
- set $tmp = "t:NHS.tmp" ;Temporary file
- set $passwd = "abc" ;User password
- set $sysop = "Daniel Bloch" ;Sysop name
- set $syspass= "xyz" ;Sysop password
- set $sysname= "Dan's BBS" ;Name of system
- set $list = "C:list" ;Directory lister
-
- ;All files in hold directory will be deleted at initialization!!!
-
- ;-------------------- M A I N P R O G R A M -----------------------;
- message "\f" ;Clear screen
- main: clrstack
- gosub init ;Initialize various stuff
- gosub connect ;Wait for RING and answer the phone
- when "\r\nNO CARRIER\r\n" goto NoCarrier
- gosub prelog ;Show opening picture
- gosub login ;Get name & password
- IF !$name == $sysop THEN goto user
- set $sysacc = "TRUE"
- IF $pass == $syspass THEN goto OK
- send "Wrong!!\n"
- write $dir"log" "\n"$date" Wrong password: "$pass"\n"
- gosub logout
- goto main
- user: set $sysacc = "FALSE"
- IF $pass == $passwd THEN goto OK
- send "Wrong!\n"
- write $dir"log" "\n"$date" "$name" Wrong password: "$pass"\n"
- gosub login
- IF $pass == $passwd THEN goto OK
- send "Wrong!!\n"
- write $dir"log" "\n"$date" "$name" Wrong password: "$pass"\n"
- gosub logout
- goto main
-
- ;User has logged in
- OK: write $dir"log" "\n"$date" Login: "$name" ("$baud")\n"
- gosub postlog
- timeout 2
- echo off
- send "^[[97x"
- input $id "\r"
- echo on
- timeout 300 goto bibi
- send "\nPress [ENTER] to continue..."
- input $dummy "\r"
- send "\f"
- ascsend $dir"menu0"
-
- ;This is the main loop
- loop: gosub MainMenu
- send "Are you sure you want to log off the system (Enter=Y)? "
- input $cmd "\r"
- IF $cmd == "N" THEN goto loop
- send "\n"
- gosub logout
- goto main
-
-
-
-
- ;--------------------- S U B R O U T I N E S ----------------------
-
-
- ;********************************************************
- ;* Initialize the system
- ;********************************************************
- init: config $dir"host.config"
- hangup
- set $sysacc = "FALSE"
- echo off
- dwhens
- timeout 0
- cli "delete >nil: "$hold"#?"
- return
-
-
- ;********************************************************
- ;* Wait for CONNECT
- ;********************************************************
- connect:
- dwhens
- send " \r"
- gosub skip
- conn0: message "\n\n\n"$sysname" [Press '?' for help]\n"
- message "Waiting for caller...\n"
- timeout 0
- input $char "" ;Get one character
- IF !$char == "?" THEN goto conn1
- message "\n\nSpace = Local login (switch your modem off first!)\n"
- message " Q = Quit NHS"
- goto conn0
- conn1: IF $char == "Q" THEN goto QuitNHS
- IF $char == " " THEN goto Local
-
- conn2: when "CONNECT 1200" goto conn1200
- when "CONNECT 2400" goto conn2400
- when "CONNECT 4800" goto conn4800
- when "CONNECT 9600" goto conn9600
- dtenths 7
- send "ATA\n"
- timeout 90 goto connect
- wait "NO CARRIER"
- goto connect
-
- conn3: dwhens
- timeout 0
- echo on
- gosub skip
- return
-
- Local: message "\nStarting local logon..."
- goto conn3
-
- QuitNHS:
- config "NComm:NComm.config"
- end
-
- conn1200:
- set $baud = "1200"
- goto conn3
- conn2400:
- set $baud = "2400"
- goto conn3
- conn4800:
- set $baud = "4800"
- goto conn3
- conn9600:
- set $baud = "9600"
- goto conn3
-
-
- ;********************************************************
- ;* Show "prelog", i.e. the picture to be shown before
- ;* login.
- ;********************************************************
- prelog: send "\f"$sysname" ("$baud") up on "$date"\n"
- send $NComm" / NComm Host System (NHS) v"$version"\n"
- send "Copyright © 1989 Daniel Bloch\n\n\n"
- ascsend $dir"prelog"
- return
-
-
- ;********************************************************
- ;* Show "postlog", i.e. the picture to be shown after
- ;* login.
- ;********************************************************
- postlog:
- send "\n\n"
- ascsend $dir"postlog"
- ; cli "cookie"
- return
-
-
- ;********************************************************
- ;* Read user name and password into the variables
- ;* $name and $pass.
- ;********************************************************
- Login: echo on
- timeout 120 goto LogSleep
- send "\n\nEnter your name: "
- input $name "\r"
- send "\nEnter your password: "
- echo off
- input $pass "\r"
- echo on
- timeout 0
- send "\n"
- return
- LogSleep:
- send "\n\nLogin timed out after 2 minutes\n"
- gosub logout
- goto main
-
- ;********************************************************
- ;Skip junk from the modem
- ;********************************************************
- skip: timeout 3 goto SkipOK
- more: wait ""
- goto more
- SkipOK: timeout 0
- return
-
-
- ;********************************************************
- ;* Log out
- ;********************************************************
- logout: send "\nThanks for calling "$sysname"!\n"
- hangup
- write $dir"log" $date" Logout: "$name"\n"
- cli "delete >nil: "$holdzoo" "$hold"#?"
- return
-
- ;********************************************************
- ;* User sleeps
- ;********************************************************
- bibi: send "\n\nLooks like you fell asleep!"
- write $dir"log" $date" Sleep disconect\n"
- gosub logout
- goto main
-
- ;********************************************************
- ;Main menu
- ;********************************************************
- MainMenu:
- send "\nMain Command (? for menu): "
- input $cmd "\r"
- send "\n"
- IF $cmd == "?" THEN ascsend $dir"menu0"
- IF $cmd == "G" THEN return
- IF $cmd == "F" THEN gosub FileMenu
- IF $cmd == "B" THEN gosub BullMenu
- IF $cmd == "O" THEN gosub page
- IF $cmd == "S" THEN gosub sysop
- IF $cmd == "C" THEN gosub Comment
- IF $cmd == "R" THEN gosub Read
- IF $cmd == "E" THEN gosub Enter
- IF $cmd == "RE"then gosub Enter
- goto MainMenu
-
-
- ;********************************************************
- ;Chat with SYSOP
- ;********************************************************
- page: send "\nPaging SYSOP...\n"
- send "(Press Ctrl-Z to exit from chat)\n"
- beep
- dtenths 3
- beep
- dtenths 3
- beep
- write $dir"log" $date" Paged operator\n"
- when "^Z" goto EndChat
- chat: input $dummy "\r"
- send "\n"
- goto chat
- EndChat:
- dlwhen
- send "\n"
- return
-
-
- ;********************************************************
- ;File menu
- ;********************************************************
- FileMenu:
- send "\nFile Command (? for menu): "
- input $cmd "\r"
- send "\n"
- IF $cmd == "?" THEN ascsend $dir"menu1"
- IF $cmd == "" THEN return
- IF $cmd == "Q" THEN return
- IF $cmd == "L" THEN gosub ListFiles
- IF $cmd == "D" THEN gosub Download
- IF $cmd == "U" THEN gosub Upload
- IF $cmd == "V" THEN gosub ViewZOO
- IF $cmd == "EXT" THEN gosub ExtractZOO
- IF $cmd == "ADD" THEN gosub AddFile
- IF $cmd == "DEL" THEN gosub Remove
- IF $cmd == "DIR" THEN gosub Show
- IF $cmd == "GET" THEN gosub GetHold
- goto FileMenu
-
-
- ;********************************************************
- ;List files in download directory
- ;********************************************************
- ListFiles:
- send "\n"
- cli $list" "$dldir
- return
-
-
- ;********************************************************
- ;Download file
- ;********************************************************
- Download:
- send "\nEnter file name: "
- input $file "\r"
- send "\n"
- IF $file == "" THEN return
- IF exists $dldir$file THEN goto DownlOK
- send "File '"$file"' not found!\n"
- return
- DownlOK:
- send "Select transfer protocol (X,Y,Z): "
- input $proto "\r"
- send "\n"
- IF $proto == "" THEN return
- IF $proto == "X" THEN goto XDownload
- IF $proto == "Y" THEN goto YDownload
- IF $proto == "Z" THEN goto ZDownload
- send "Illegal protocol!\n"
- goto DownlOK
- XDownload:
- upload $dldir$file,x
- write $dir"log" $date" Downloaded "$file" (Xmodem)\n"
- return
- YDownload:
- upload $dldir$file,y
- write $dir"log" $date" Downloaded "$file" (Ymodem)\n"
- return
- ZDownload:
- upload $dldir$file,z
- write $dir"log" $date" Downloaded "$file" (Zmodem)\n"
- return
-
-
- ;********************************************************
- ;Upload file
- ;********************************************************
- Upload:
- send "\nEnter file name: "
- input $file "\r"
- send "\n"
- IF $file == "" THEN return
- IF !exists $uldir$file THEN goto UploadOK
- send "File '"$file"' already exist!\n"
- return
- UploadOK:
- send "Enter description of file (Enter=none): "
- input $desc "\r"
- send "\n"
- GetProto:
- send "Select transfer protocol (X,Y,Z): "
- input $proto "\r"
- send "\n"
- IF $proto == "" THEN return
- IF $proto == "X" THEN goto XUpload
- IF $proto == "Y" THEN goto YUpload
- IF $proto == "Z" THEN goto ZUpload
- send "Illegal protocol!\n"
- goto GetProto
- XUpload:
- download $uldir$file,x
- write $dir"log" $date" Uploaded "$file" (Xmodem)\n"
- IF !$desc == "" THEN cli "Filenote "$uldir$file" \""$desc"\""
- return
- YUpload:
- download $uldir$file,y
- write $dir"log" $date" Uploaded "$file" (Ymodem)\n"
- IF !$desc == "" THEN cli "Filenote "$uldir$file" \""$desc"\""
- return
- ZUpload:
- download $uldir$file,z
- write $dir"log" $date" Uploaded "$file" (Zmodem)\n"
- IF !$desc == "" THEN cli "Filenote "$uldir$file" \""$desc"\""
- return
-
-
- ;********************************************************
- ;Bulletin menu
- ;********************************************************
- BullMenu:
- ascsend $dir"menu2"
- bull: send "\nBulletin number (? for menu): "
- input $cmd "\r"
- send "\n"
- IF $cmd == "?" THEN goto BullMenu
- IF $cmd == "" THEN return
- IF $cmd == "Q" THEN return
- IF exists $dir"bull"$cmd THEN goto ShowBull
- send "Illegal bulletin number!\n"
- goto bull
- ShowBull:
- send "\n"
- ascsend $dir"bull"$cmd
- write $dir"log" $date" Read bulletin #"$cmd"\n"
- goto bull
-
-
- ;********************************************************
- ;Sysop menu
- ;********************************************************
- Sysop:
- IF $sysacc == "TRUE" THEN goto SysOK
- send "You are not allowed to do that!\n"
- write $dir"log" $date" Attempted restricted command\n"
- return
- SysOK: send "\nSysop Command (? for menu): "
- input $cmd "\r"
- send "\n"
- IF $cmd == "?" THEN ascsend $dir"menu3"
- IF $cmd == "Q" THEN return
- IF $cmd == "" THEN return
- IF $cmd == "L" THEN gosub ListLog
- IF $cmd == "P" THEN gosub ChangePass
- IF $cmd == "S" THEN gosub ChangeSys
- IF $cmd == "E" THEN gosub ExecDOS
- IF $cmd == "R" THEN gosub Priv
- IF $cmd == "D" THEN gosub DeleteLog
- IF $cmd == "M" THEN gosub DeleteMess
- IF $cmd == "C" THEN gosub DeleteComm
- goto sysop
-
-
- ;********************************************************
- ;Delete log file
- ;********************************************************
- DeleteLog:
- send "\nAre you sure (Enter=N)? "
- input $cmd "\r"
- send "\n"
- IF !$cmd == "Y" THEN return
- cli "delete "$dir"log"
- write $dir"log" $date" Started new log\n"
- return
-
-
- ;********************************************************
- ;Delete Public messages
- ;********************************************************
- DeleteMess:
- send "\nDelete all public messages (Enter=N)? "
- input $cmd "\r"
- send "\n"
- IF !$cmd == "Y" then return
- cli "delete >nil: "$dir"Messages"
- write $dir"log" $date" Public messages deleted\n"
- return
-
-
- ;********************************************************
- ;Delete private messages
- ;********************************************************
- DeleteComm:
- send "\nDelete all private messages (Enter=N)? "
- input $cmd "\r"
- send "\n"
- IF !$cmd == "Y" then return
- cli "delete >nil: "$dir"Comments"
- write $dir"log" $date" Private messages deleted\n"
- return
-
-
- ;********************************************************
- ;List log file
- ;********************************************************
- ListLog:
- send "\n"
- ascsend $dir"log"
- return
-
-
- ;********************************************************
- ;Change user password
- ;********************************************************
- ChangePass:
- send "\nEnter new user password: "
- input $passwd "\r"
- send "\n\nUser password changed to '"$passwd"'.\n"
- send "WARNING: Password changes are lost when the NHS script "
- send "is stopped.\n"
- send "Edit the file host.script to make changes permanent.\n"
- write $dir"log" $date" User password changed to '"$passwd"'.\n"
- return
-
-
- ;********************************************************
- ;Change Sysop password
- ;********************************************************
- ChangeSys:
- send "\nEnter old SYSOP password: "
- input $pass "\r"
- send "\n"
- IF $pass == $syspass then goto ChangeOK
- send "Wrong!\n"
- return
- ChangeOK:
- send "Enter new SYSOP password: "
- input $syspass "\r"
- send "\n\nSYSOP password changed to '"$syspass"'.\n"
- write $dir"log" $date" SYSOP password changed to '"$syspass"'.\n"
- send "WARNING: Password changes are lost when the NHS script "
- send "is stopped.\n"
- send "Edit the file host.script to make changes permanent.\n"
- return
-
-
- ;********************************************************
- ;Execute DOS command
- ;********************************************************
- ExecDOS:
- send "\nEnter DOS command to execute: "
- input $cmd "\r"
- send "\n"
- write $dir"log" $date" Executed DOS command: "$cmd"\n"
- cli $cmd
- return
-
-
- ;********************************************************
- ;Comment to sysop
- ;********************************************************
- Comment:
- send "\n\nSubject: "
- input $subject "\r"
- IF $subject == "" then return
- set $header = "\n\nFrom: "$name"\nSubject: "$subject"\n"
- set $header = $header"Date: "$date"\n"
- set $header = $header"------------------------------\n"
- write $dir"Comments" $header
- send $header
- send "[Enter your message below; "
- send "end with Ctrl-Z on a separate line]\n\n"
- when "^Z" goto EndCom
- com: input $line "\r"
- send "\n"
- write $dir"Comments" $line"\n"
- goto com
- EndCom: dlwhen
- send "\nMessage entered!^G\n"
- write $dir"log" $date" Entered comment to SYSOP\n"
- return
-
-
- ;********************************************************
- ;Enter message
- ;********************************************************
- Enter:
- send "\nTo (Enter=ALL): "
- input $to "\r"
- IF $to == "" then set $to = "ALL"
- send "\nSubject: "
- input $subject "\r"
- IF $subject == "" then return
- set $header = "\n\nFrom: "$name"\n"
- set $header = $header"To: "$to"\nSubject: "$subject"\n"
- set $header = $header"Date: "$date"\n"
- set $header = $header"------------------------------\n"
- write $dir"messages" $header
- send $header
- send "[Enter your message below; "
- send "end with Ctrl-Z on a separate line]\n\n"
- when "^Z" goto EndEnt
- ent: input $line "\r"
- send "\n"
- write $dir"messages" $line"\n"
- goto ent
- EndEnt: dlwhen
- send "\nMessage entered!^G\n"
- write $dir"log" $date" Entered message\n"
- return
-
-
- ;********************************************************
- ;Read public messages
- ;********************************************************
- Read: IF !exists $dir"messages" then return
- ascsend $dir"messages"
- return
-
-
- ;********************************************************
- ;Read private messages
- ;********************************************************
- Priv: IF !exists $dir"comments" then return
- ascsend $dir"comments"
- return
-
- ;********************************************************
- ;Handle NO CARRIER
- ;********************************************************
- NoCarrier:
- write $dir"log" $date" CARRIER LOST\n"
- gosub logout
- goto main
-
-
- ;********************************************************
- ;View ZOO file
- ;********************************************************
- ViewZOO:
- send "\nEnter name of .ZOO file: "
- input $file "\r"
- send "\n"
- IF $file == "" then return
- IF exists $dldir$file then goto ViewOK
- IF exists $dldir$file".ZOO" then goto ViewOK
- send "File not found!\n"
- return
- ViewOK: write $dir"log" $date" ZOO view of "$file"\n"
- cli "zoo v "$dldir$file
- return
-
-
- ;********************************************************
- ;Extract ZOO file
- ;********************************************************
- ExtractZOO:
- send "\nEnter name of .ZOO file: "
- input $file "\r"
- send "\n"
- IF $file == "" then return
- IF exists $dldir$file then goto ExtOK
- IF exists $dldir$file".ZOO" then goto ExtOK
- send "File not found!\n"
- return
- ExtOK: send "\nEnter name(s) of file(s) to extract [Enter=all]: "
- input $files "\r"
- write $dir"log" $date" Extracted "$file" "$files"\n"
- send "\n"
- cli "delete >nil: "$tmp
- write $tmp "CD "$hold"\n"
- write $tmp "zoo xO "$dldir$file" "$files"\n"
- cli "execute "$tmp
- return
-
-
- ;********************************************************
- ;Add file to HOLD
- ;********************************************************
- AddFile:
- send "\nEnter file name: "
- input $file "\r"
- send "\n"
- IF $file == "" then return
- IF exists $dldir$file then goto AddOK
- send "File '"$file"' not found!\n"
- return
- AddOK: cli "COPY "$dldir$file" "$hold
- write $dir"log" $date" Added "$file"\n"
- return
-
-
- ;********************************************************
- ;Delete file(s) from HOLD
- ;********************************************************
- Remove: send "\nEnter file name: "
- input $file "\r"
- send "\n"
- IF $file == "" then return
- write $dir"log" $date" Deleted "$file"\n"
- cli "delete \""$hold$file"\""
- return
-
-
- ;********************************************************
- ;List files in HOLD directory
- ;********************************************************
- Show:
- send "\n"
- cli $list" "$hold
- return
-
-
- ;********************************************************
- ;Download files in HOLD directory
- ;********************************************************
- GetHold:
- send "One moment while I pack the file...\n"
- cli "delete >nil: "$holdzoo
- cli "zoo a "$holdzoo" "$hold"*"
- GetPr:
- send "Select transfer protocol (X,Y,Z): "
- input $proto "\r"
- send "\n"
- IF !$proto == "" then goto Get1
- cli "delete >nil: "$holdzoo
- return
- Get1: IF $proto == "X" then goto XGet
- IF $proto == "Y" then goto YGet
- IF $proto == "Z" then goto ZGet
- send "Illegal protocol!\n"
- goto GetPr
- XGet:
- upload $holdzoo,x
- write $dir"log" $date" Downloaded HOLD.ZOO (Xmodem)\n"
- cli "delete >nil: "$holdzoo
- return
- YGet:
- upload $holdzoo,y
- write $dir"log" $date" Downloaded HOLD.ZOO (Ymodem)\n"
- cli "delete >nil: "$holdzoo
- return
- ZGet:
- upload $holdzoo,z
- write $dir"log" $date" Downloaded HOLD.ZOO (Zmodem)\n"
- cli "delete >nil: "$holdzoo
- return
-