home *** CD-ROM | disk | FTP | other *** search
- //////////////////////////////////////////////////////////////////////////////
- //
- // W C O N F I G . S L T
- //
- // Copyright (C) 1988,1989,1990,1991 Exis Inc.
- // Copyright (C) 1994 deltaComm Development, Inc.
- //
- // - Written by Colin Sampaleanu.
- // - Modifications by Jeff Woods, Feb '91, to add help function and support
- // for locked modems.
- // - Modifications for Telix for Windows July '94
- //
- // This is a Host Mode configuration script for Telix for Windows.
- // It reads from and saves parameters to the file WINHOST.CNF.
- //
- //////////////////////////////////////////////////////////////////////////////
-
- str modem_lock[5] = "0",
- host_downloads[64],
- host_uploads[64],
- our_dir[64];
- int direct_connect = 0,
- closed_sys = 0,
- temp_var;
-
- #INCLUDE "WHUTILS.SLT"
-
- //////////////////////////////////////////////////////////////////////////////
-
- main() {
-
- get_our_dir();
- read_host_config_file();
- host_configure();
-
- }
-
-
- //////////////////////////////////////////////////////////////////////////////
-
- host_configure() {
-
- str s[200];
- int c, f, i, stat;
-
- if (!host_downloads) {
- if (getenv ("HOST2DIR", s) != 0) {
- host_downloads = our_dir;
- strcat (host_downloads, "XFER\");
- }
- else {
- host_downloads = _telix_dir;
- strcat(host_downloads, "HOSTDOWN\");
- }
- }
-
- if (!host_uploads) {
- if (getenv ("HOST2DIR", s) != 0) {
- host_uploads = our_dir;
- strcat (host_uploads, "XFER\");
- }
- else {
- host_uploads = _telix_dir;
- strcat(host_uploads, "HOSTDOWN\");
- }
- }
-
- while (1) {
- clear_scr ();
- prints("^M^JWCONFIG - WinHost Mode Configuration Script^M^J");
- printsc("A: Host download directory: ");
- prints(host_downloads);
- printsc("B: Host upload directory : ");
- prints(host_uploads);
- printsc("C: Connection type : ");
- if (direct_connect)
- prints("Direct");
- else
- prints("Modem");
- printsc("D: Lock Speed (0=none) : ");
- prints(modem_lock);
- printsc("E: Sign-up mode : ");
- if (closed_sys) {
- prints ("Closed (users may not sign up on-line)");
- }
- else {
- prints ("Open (users may sign up on-line)");
- }
-
- prints("^M^JF: Exit without saving changes.");
- prints("G: Exit and save changes to disk.^M^J");
-
- printsc("Which option? ");
- gets(s, 1);
- prints("");
- c = toupper(subchr(s, 0));
-
- if (c < 'A' || c > 'G')
- continue;
-
- if (c >= 'A' && c <= 'D')
- printsc("Enter new value (Esc to abort): ");
-
- if (c == 'A') {
- s = host_downloads;
- stat = inputbox ("Host Download Directory", "Directory:", s);
- if (stat == 1) {
- host_downloads = s;
- strupper(host_downloads);
- }
- if ((i = strlen(host_downloads)) != 0) // add slash if needed
- if (subchr(host_downloads, i - 1) != '\')
- copystr("\", host_downloads, i, 1);
- }
-
- else if (c == 'B') {
- s = host_uploads;
- stat = inputbox ("Host Upload Directory", "Directory:", s);
- if (stat == 1) {
- host_uploads = s;
- strupper(host_uploads);
- }
- if ((i = strlen(host_uploads)) != 0)
- if (subchr(host_uploads, i - 1) != '\')
- copystr("\", host_uploads, i, 1);
- }
-
- else if (c == 'C') {
- direct_connect = ! direct_connect;
- }
-
- else if (c == 'D') {
- stat = gets(s, 5);
- if (stat != -1) {
- temp_var = stoi(s);
- itos(temp_var, modem_lock);
- }
- }
-
- else if (c == 'E') {
- closed_sys = ! closed_sys;
- }
-
- else if (c == 'F') {
- prints("^M^JWCONFIG done.^M^J");
- return;
- }
-
- else if (c == 'G') {
-
- if (! check_directory (host_downloads)) {
- s = host_downloads;
- strcat (s, " does not exist^M^JHost will not run intil its directories exist");
- msgbox ("Warning", s, 0);
- }
-
- if ((strcmpi (host_downloads, host_uploads) != 0) && (! check_directory (host_uploads))) {
- s = host_uploads;
- strcat (s, " does not exist^M^JHost will not run intil its directories exist");
- msgbox ("Warning", s, 0);
- }
-
- s = our_dir;
- strcat(s, "WINHOST.CNF");
- f = fopen(s, "w");
-
- if (!f) {
- printsc("Error writing to ");
- printsc(s);
- prints("!");
- continue;
- }
-
- fputs(host_downloads, f);
- fputs("^M^J", f);
- fputs(host_uploads, f);
- fputs("^M^J", f);
- if (direct_connect)
- fputs("Direct^M^J", f);
- else
- fputs("Modem^M^J", f);
- fputs(modem_lock, f);
- fputs("^M^J", f);
- if (closed_sys)
- fputs ("Closed", f);
- else
- fputs ("Open", f);
-
- prints("^M^JWCONFIG done.^M^J");
- fclose(f);
- return;
- }
- }
- }
-