home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BlastDOS
/
Telix.rar
/
Telix
/
HOST.SLT
< prev
next >
Wrap
Text File
|
1992-01-09
|
29KB
|
1,087 lines
//////////////////////////////////////////////////////////////////////////////
//
// H O S T . S L T
//
// Copyright (C) 1988,1989,1990,1991 Exis Inc.
//
// - Written by Colin Sampaleanu.
// - Modifications by Jeff Woods, Feb '91, to add help function and support
// for locked modems.
//
// This is a Host Mode for Telix, written as a script file.
// To configure Host Mode parameters such as passwords, run the 'HCONFIG'
// script. That script is run automatically if the Host Mode ocnfiguration
// file 'HOST.CNF' is missing.
//
// This script will only work with Hayes compatible modems, but may be
// modified for operation with othe rmodems.
//
//////////////////////////////////////////////////////////////////////////////
// Parameters which can be configured
str pass1[8] = "pass1", // The level 1 pass
pass2[8] = "pass2", // The level 2 (Sysop) pass
shellpass[8] = "shell", // the pass to enter the Remote Shell
shutpass[8] = "shut", // the pass to shut down the Host Mode
host_downloads[64], // where users may download from
host_uploads[64]; // where uploaded files go
int direct_connect = 0,
modem_lock = 0;
str current_caller[31], // storage of current caller's name
conn300[] = "CONNECT^M", // modem result messages for bauds
conn1200[] = "CONNECT 1200",
conn2400[] = "CONNECT 2400",
conn9600[] = "CONNECT 9600",
conn19200[] = "CONNECT 19200";
int finished_caller, // set to TRUE when must return to top
local_mode, // set to TRUE when local test mode
access_level, // access level of current caller
carrier_counts = 1, // TRUE if should watch Carrier signal
already_connected = 0,
exit_requested = 0, // set to TRUE if Sysop has pressed Esc
connection_lost = 0, // set to TRUE when carrier lost
kill_user = 0; // set to TRUE when user must be purged
int old_scr_chk_key, // storage for some system variables
old_cisb_auto, // which we have to modify and put
old_zmod_auto, // back to what they were when done
old_sound;
str old_down_dir[64],
old_up_dir[64];
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
main()
{
int c;
clear_scr();
if (read_host_config_file() == -1)
{
prints("Unable to read HOST.CNF...");
prints("Running HCONFIG, the Host Mode configuration script.^M^J");
call("HCONFIG");
if (read_host_config_file() == -1)
{
prints("Still unable to read HOST.CNF. Aborting Host Mode.^M^J");
return -1;
}
}
if (!check_directories())
{
prints("Either the upload or download directory as defined in the HOST.CNF file");
prints("doesn't exist. Either create the missing directory with the DOS 'MKDIR'");
prints("command, or run the HCONFIG script to redefine what directories to use.");
prints("Aborting Host Mode.");
return -1;
}
old_scr_chk_key = _scr_chk_key;
_scr_chk_key = 0;
old_cisb_auto = _cisb_auto;
_cisb_auto = 0;
old_zmod_auto = _zmod_auto;
_zmod_auto = 0;
old_sound = _sound_on;
_sound_on = 0;
old_down_dir = _down_dir;
_down_dir = host_uploads; // these are reversed because we are now the Host
old_up_dir = _up_dir;
_up_dir = host_downloads; // these are reversed because we are now the Host
usagelog("HOST.LOG");
if (direct_connect)
carrier_counts = 0;
else
carrier_counts = 1;
if (!direct_connect && carrier())
already_connected = 1;
while (1)
{
if (!direct_connect && !already_connected)
{
if (!modem_lock)
set_cparams(modem_lock, 0, 8, 1);
delay(3);
prints("Sending Modem Init string...");
cputs_tr(_mdm_init_str);
delay(10);
prints("Sending Auto-Answer string...");
cputs_tr(_auto_ans_str);
}
finished_caller = kill_user = 0;
if (direct_connect)
carrier_counts = 0;
else
carrier_counts = 1;
if (!direct_connect)
{
prints("^M^JHost Mode: Waiting for call...");
prints("(Press Esc to exit, or 'L' for local test mode).^M^J");
do
{
if (carrier())
{
local_mode = 0;
break;
}
c = inkey();
if (c)
{
if (c == 27)
{
exit_requested = 1;
break;
}
else if (c == 'l' || c == 'L') // local teswt mode
{
prints("Local test mode entered");
local_mode = 1;
carrier_counts = 0;
}
}
}
while (toupper(c) != 'L');
}
if (!exit_requested)
{
prints("Incoming call. Sysop: press Esc to exit, or END to terminate user.");
do_one_caller();
if ((connection_lost || kill_user) && carrier_counts && carrier())
hangup(); // make sure nobody sneaks in
}
already_connected = 0;
if (exit_requested)
{
if (!carrier() && !direct_connect)
{
prints("Sending Modem Init string...");
cputs_tr(_mdm_init_str);
}
_scr_chk_key = old_scr_chk_key;
_cisb_auto = old_cisb_auto;
_zmod_auto = old_zmod_auto;
_sound_on = old_sound;
_down_dir = old_down_dir;
_up_dir = old_up_dir;
prints("^M^JHost mode script finished.");
usagelog("*CLOSE*");
return 1;
}
}
}
//////////////////////////////////////////////////////////////////////////////
HelpOn(int option)
{
if (option == 'H')
{
host_send("^M^JHelp on Help^M^J");
Host_send("^M^JTo use the help, simply type the first letter of one of the following:"); host_send("^M^J^M^J<H>elp <F>iles <T>ype <U>pload <D>ownload <S>hell <C>hat <G>oodbye ");
host_send("^M^J^M^J<H>elp <F>iles <T>ype <U>pload <D>ownload <S>hell <C>hat <G>oodbye");
Host_send("^M^J");
}
if (option == 'F')
{
host_send("^M^JHelp on Files^M^J");
host_send("^M^JThe 'Files' option allows the caller to list the files in the");
host_send("^M^Jcurrent disk directory. The caller must press a key after each");
host_send("^M^Jscreen. The output is not echoed on the local screen. If the");
host_send("^M^Jcaller has access level two s/he is prompted for a filespec,");
host_send("^M^Jwhich may include the * and ? wildcard characters (see your");
host_send("^M^JDOS manual), so that the contents of other directories than");
host_send("^M^Jthe 'Host download dir' may be listed.");
Host_send("^M^J");
}
if (option == 'T')
{
host_send("^M^JHelp on Type^M^J");
host_send("^M^JThe 'Type' option allows the caller to view any ASCII file in");
host_send("^M^Jthe Host Download Directory, or in any directory for access");
host_send("^M^JLevel 2 callers. Simply give the name (or full path and name)");
host_send("^M^Jof the system file you wish to view: ie. C:\TELIX\TELIX.IMG");
Host_send("^M^J");
}
if (option == 'U')
{
host_send("^M^JHelp on Uploading^M^J");
host_send("^M^JThe 'Upload' option allows the caller to send a file to the");
host_send("^M^Jhost. The caller is shown the a menu of protocols. He/she");
host_send("^M^Jshould select the appropriate protocol by its first letter");
host_send("^M^J(or 'E' for Ymodem-g). If appropriate the caller is also asked");
host_send("^M^Jfor the filename. The transfer is then initiated by HOST. The");
host_send("^M^Jcaller must then initiate the upload on THEIR side by giving");
host_send("^M^Jtheir comm program an upload instruction, choosing the same");
host_send("^M^Jprotocol as they told host, and giving the fil