// TOES_CFG.SLT - toes configuration script // written by Allan Marillier, April 1991 as a supplemental program // to TOES.SLT. This script generates/edits a file named TOES.CNF which is // the required configuration for the TOES main script //////////////////////////////////////////////////////////////////////////// str my_screen_shows_color[1]; // If you have a colour screen, // this will be 1. If mono, it will be 0 str dial_str[10]; // This string must be modified. // In my dialing directory, the Fido // numbers are 1 and 2. Your numbers go in here. str user_name[60]; // user name goes here str toes_msg_file[80]; // Mail packet file name str toes_rep_file[80]; // Mail packet reply name str my_reply_dir[80]; // Reply file directory for upload str my_mail_dir[80]; // Mail packet directory for download str make_date_packet[1]; // if you want the script to // make a copy of the file GCOBBS.OPX // in the format YYMMDDnn.OPX, this will be // equal to 1, otherwise it will be 0 str zmodem_protocol[1]; // this will be 0 for Telix's internal // Zmodem, or 1 for an external DSZ str auto_zap_opx[1]; // this will be 1 if old OPX's are to be auto // deleted or 0 if you want to be prompted // Note - if you use DSZ, this SHOULD be 1 as well str i_send_password[1]; // Password sent from config, or Telix dialling dir str user_password[50]; // replacement password str buffer[80]; int kount; int file_handle; ////////////////////////////////////////////////////////////////////////////// main() { // set defaults my_screen_shows_color = "N"; dial_str = "1 2"; user_name = "Jan Pierewiet"; toes_msg_file = "GCOBBS.OPX"; toes_rep_file = "GCOBBS.REP"; my_reply_dir = "C:\XPRESS\REPLY\"; my_mail_dir = "C:\XPRESS\MAIL\"; make_date_packet = "N"; zmodem_protocol = "I"; auto_zap_opx = "N"; i_send_password = "N"; user_password = "Choose_a_password:-50_chars"; get_config(); // read config from file, if it exists. If not, set defaults set_config(); // allow editing of config, and write back to disk } ////////////////////////////////////////////////////////////////////////////// set_config() // read config from file, if it exists. If not, set defaults { str s[100]; int c, i, stat; while (1) { clear_scr(); prints("^M^J TOES Configuration Script^M^J"); printsc("A: Colour Display : "); if (my_screen_shows_color == "Y") prints("Yes"); else prints("No"); printsc("B: Dialing Directory Entries : "); prints(dial_str); printsc("C: User Name (as defined to BBS) : "); prints(user_name); printsc("D: Mail File Name : "); prints(toes_msg_file); printsc("E: Reply File Name : "); prints(toes_rep_file); printsc("F: Mail Directory : "); prints(my_mail_dir); printsc("G: Reply Directory : "); prints(my_reply_dir); printsc("H: Date Named Backup : "); if (make_date_packet == "Y") prints("Yes"); else prints("No"); printsc("I: Z-Modem - Internal, Dsz, Pcz : "); if (zmodem_protocol == "I") prints("Internal"); else if (zmodem_protocol == "D") prints("DSZ"); else if (zmodem_protocol == "P") prints("PCZ"); printsc("J: Automatically Destroy Existing .OPX : "); if (auto_zap_opx == "Y") prints("Yes"); else prints("No"); printsc("K: Read TOES Config file for password : "); if (i_send_password == "Y") prints("Yes"); else prints("No"); printsc("L: BBS Password : "); prints(user_password); prints("^M^JW: Exit and save changes to disk.^M^J"); prints("X: Exit without saving changes."); printsc("Which option? "); gets(s, 1); prints(""); c = toupper(subchr(s, 0)); if (c < 'A' || c > 'L' && c != 'W' && c != 'X') continue; if (c >= 'A' && c <= 'L') printsc("Enter new value (Esc to abort): "); if (c == 'A') // chose A - my_screen_shows_color { prints("< Y / N >"); stat = gets(s,1); if (stat != -1) { my_screen_shows_color = s; strupper(my_screen_shows_color); } } else if (c == 'B') // chose B - dial_str { prints(""); stat = gets(s,80); if (stat != -1) { dial_str = s; strupper(dial_str); } } else if (c == 'C') // chose C - user_name { prints(""); stat = gets(s,80); if (stat != -1) { user_name = s; strupper(user_name); } } else if (c == 'D') // chose D - toes_msg_file { prints(""); stat = gets(s,80); if (stat != -1) { toes_msg_file = s; strupper(toes_msg_file); } } else if (c == 'E') // chose E - toes_rep_file { prints(""); stat = gets(s,80); if (stat != -1) { toes_rep_file = s; strupper(toes_rep_file); } } else if (c == 'F') // chose F - my_mail_dir { prints(""); stat = gets(s,80); if (stat != -1) { my_mail_dir = s; strupper(my_mail_dir); } if ((i = strlen(my_mail_dir)) != 0) // add slash if needed if (subchr(my_mail_dir, i - 1) != '\') copystr("\", my_mail_dir, i, 1); } else if (c == 'G') // chose G - my_reply_dir { prints(""); stat = gets(s,80); if (stat != -1) { my_reply_dir = s; strupper(my_reply_dir); } if ((i = strlen(my_reply_dir)) != 0) // add slash if needed if (subchr(my_reply_dir, i - 1) != '\') copystr("\", my_reply_dir, i, 1); } else if (c == 'H') // chose H - make_date_packet { prints("< Y / N >"); stat = gets(s,1); if (stat != -1) { make_date_packet = s; strupper(make_date_packet); } } else if (c == 'I') // chose I - zmodem_protocol { prints("< I / D / P >"); stat = gets(s,1); if (stat != -1) { zmodem_protocol = s; strupper(zmodem_protocol); } } else if (c == 'J') // chose J - auto_zap_opx { prints("< Y / N >"); stat = gets(s,1); if (stat != -1) { auto_zap_opx = s; strupper(auto_zap_opx); } } else if (c == 'K') // chose K - i_send_password { prints("< Y / N >"); stat = gets(s,1); if (stat != -1) { i_send_password = s; strupper(i_send_password); } } else if (c == 'L') // chose L - user_password { prints(""); stat = gets(s,80); if (stat != -1) { user_password = s; strupper(user_password); } } else if (c == 'X') // chose X to exit with no change { prints("^M^JTOES Configuration done - no changes made.^M^J"); delay(40); return; } else if (c == 'W') // chose W - write to file { s = _telix_dir; strcat(s,"TOES.CNF"); file_handle = fopen(s,"w"); if (!file_handle) // problem opening the file { printsc("TOES configuration : "); printsc("Error writing to "); printsc(s); prints("!"); delay(40); continue; } // write the data to file fputs(my_screen_shows_color,file_handle); fputs("^M^J",file_handle); fputs(dial_str,file_handle); fputs("^M^J",file_handle); fputs(user_name,file_handle); fputs("^M^J",file_handle); fputs(toes_msg_file,file_handle); fputs("^M^J",file_handle); fputs(toes_rep_file,file_handle); fputs("^M^J",file_handle); fputs(my_reply_dir,file_handle); fputs("^M^J",file_handle); fputs(my_mail_dir,file_handle); fputs("^M^J",file_handle); fputs(make_date_packet,file_handle); fputs("^M^J",file_handle); fputs(zmodem_protocol,file_handle); fputs("^M^J",file_handle); fputs(auto_zap_opx,file_handle); fputs("^M^J",file_handle); fputs(i_send_password,file_handle); fputs("^M^J",file_handle); fputs(user_password,file_handle); fputs("^M^J",file_handle); fclose(file_handle); prints("^M^JTOES CONFIG done.^M^J"); delay(30); return; } } // end while } // end function set_config //////////////////////////////////////////////////////////////////////////// get_config() // check for and read the config file. If none exists, create it // using the defaults, and allow editing { if (filefind("TOES.CNF",3,buffer) != 0) { // it exists, so read it // if it doesn't exist, return to main. set_config will create it file_handle = fopen("TOES.CNF","r"); // get value for colour screen buffer = ""; if (fgets(buffer,3,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); if (buffer == "Y" || buffer =="N") my_screen_shows_color = buffer; // get value for dial string buffer = ""; if (fgets(buffer,80,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); dial_str = buffer; // how do I check this ? I think that's the user's responsibility // get value for user_name buffer = ""; if (fgets(buffer,80,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); user_name = buffer; // strcat(user_name,";y"); - only necessary for TOES itself // get value for toes_msg_file buffer = ""; if (fgets(buffer,80,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); toes_msg_file = buffer; // get value for toes_rep_file buffer = ""; if (fgets(buffer,80,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); toes_rep_file = buffer; // get value for my_reply_dir buffer = ""; if (fgets(buffer,80,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); my_reply_dir = buffer; // get value for my_mail_dir buffer = ""; if (fgets(buffer,80,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); my_mail_dir = buffer; // get value for make_date_packet buffer = ""; if (fgets(buffer,3,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); if (buffer == "Y" || buffer == "N") make_date_packet = buffer; // get value for zmodem_protocol buffer = ""; if (fgets(buffer,3,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); if (buffer == "I" || buffer == "D" || buffer == "P") zmodem_protocol = buffer; // get value for auto_zap_opx buffer = ""; if (fgets(buffer,3,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); if (buffer == "Y" || buffer == "N") auto_zap_opx = buffer; // get value for i_send_password buffer = ""; if (fgets(buffer,3,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); if (buffer == "Y" || buffer == "N") i_send_password = buffer; // get value for user_password buffer = ""; if (fgets(buffer,53,file_handle) == -1) { fclose(file_handle); panic(); } strupper(buffer); user_password = buffer; fclose(file_handle); } } // end function get_config //////////////////////////////////////////////////////////////////////////// panic() { // panic exit from get_config - due to corrupt file etc. prints("PANIC exit from TOES script attempting to read the config file"); prints(" TOES.CNF. Something is wrong ! The file is corrupt, or otherwise"); prints(" inaccessible. If it exists, try deleting it. This script will "); prints(" automatically recreate it. If that fails, try viewing it. It "); prints(" should appear in the format shown below :"); prints("N"); prints("1 2"); prints("GCOBBS.OPX"); prints("GCOBBS.REP"); prints("C:\XPRESS\REPLY\"); prints("C:\XPRESS\MAIL\"); prints("N"); prints("I"); prints("Y"); prints("N"); prints("Choose_a_password:-50_chars"); prints(""); prints(" If errors persist - please contact Allan Marillier at 5:491/1"); fclose(file_handle); delay(40); exittelix(); } // end function panic ////////////////////////////////////////////////////////////////////////////