home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR10 / DBBS_13.ZIP / DBBSCOM1.SLT < prev    next >
Text File  |  1989-03-28  |  49KB  |  1,380 lines

  1. // █████▓▓▓▓▓▒▒▒▒▒░░░░░ DBBS VERSION 1.3 BY DENNIS SEATON ░░░░░▒▒▒▒▒▓▓▓▓▓█████
  2.  
  3. str password[16],                       //caller's password
  4.     host_downloads[64],                 // where users may download from
  5.     host_uploads[64],                   // where uploaded files go
  6.     fp[30],                             // path of all files
  7.     stuff[78];                          // stuff!
  8. int direct_connect = 0;
  9.  
  10. str current_caller[31],                 // storage of current caller's name
  11.     conn300[] = "CONNECT^M",            // modem result messages for bauds
  12.     conn1200[] = "CONNECT 1200",
  13.     conn2400[] = "CONNECT 2400",
  14.     conn9600[] = "CONNECT 9600",
  15.     conn19200[] = "CONNECT 19200";
  16. int finished_caller,                    // set to TRUE when must return to top
  17.     local_mode,                         // set to TRUE when local test mode
  18.     access_level,                       // access level of current caller
  19.     we_care_about_carrier = 1,                 // TRUE if should watch Carrier signal
  20.     already_connected = 0,
  21.     exit_requested = 0,                 // set to TRUE if Sysop has pressed Esc
  22.     connection_lost = 0,                // set to TRUE when carrier lost
  23.     kill_user = 0,                      // set to TRUE when user must be purged
  24.     min_user_name = 2;                      // Minimum length of a user name
  25.  
  26. int old_scr_chk_key,                    // storage for some system variables
  27.     old_cisb_auto,                      // which we have to modify and put
  28.     old_zmod_auto,                      // back to what they were when done
  29.     old_sound;
  30. str old_down_dir[64],
  31.     old_up_dir[64];
  32.  
  33. //////////////////////////////////////////////////////////////////////////////
  34. //////////////////////////////////////////////////////////////////////////////
  35.  
  36. main() {
  37.  
  38.    clear_scr();
  39.  
  40.    int c;
  41.  
  42.        if (read_host_config_file () == -1) {
  43.        prints("┌──────────────────────────────────────────────────────┐");
  44.        prints("│ Unable to read DBBS.CNF...                           │");
  45.        prints("│ Running DCONFIG, the Host Mode configuration script. │");
  46.        prints("└──────────────────────────────────────────────────────┘^M^J");
  47.        call("DCONFIG");
  48.        if (read_host_config_file() == -1) {
  49.         clear_scr();
  50.            prints("┌──────────────────────────────────────────────┐");
  51.            prints("│ Still unable to read DBBS.CNF. Aborting DBBS │");
  52.            prints("└──────────────────────────────────────────────┘^M^J");
  53.            return -1;
  54.        }
  55.    }
  56.  
  57.    if (!check_directories()) {
  58.        clear_scr();
  59.        prints("┌─────────────────────────────────────────────────────────────────────────┐");
  60.        prints("│ Either the upload or download directory as defined in the DBBS.CNF file │");
  61.        prints("│ doesn't exist. Either create the missing directory with the DOS 'MKDIR' │");
  62.        prints("│ command, or run the DCONFIG script to redefine what directories to use. │");
  63.        prints("└─────────────────────────────────────────────────────────────────────────┘");
  64.        prints("");
  65.        prints("┌───────────────┐");
  66.        prints("│ Aborting DBBS │");
  67.        prints("└───────────────┘");
  68.        prints("");
  69.        return -1;
  70.    }
  71.  
  72.    old_scr_chk_key = _scr_chk_key;
  73.    _scr_chk_key = 0;
  74.    old_cisb_auto = _cisb_auto;
  75.    _cisb_auto = 0;
  76.    old_zmod_auto = _zmod_auto;
  77.    _zmod_auto = 0;
  78.    old_sound = _sound_on;
  79.    _sound_on = 0;
  80.    old_down_dir = _down_dir;
  81.    _down_dir = host_uploads;   // these are reversed because we are now the Host
  82.    old_up_dir = _up_dir;
  83.    _up_dir = host_downloads;   // these are reversed because we are now the Host
  84.  
  85.    clear_scr();
  86.    usagelog("DBBS.LOG");
  87.  
  88.    if (direct_connect)
  89.        we_care_about_carrier = 0;
  90.    else
  91.        we_care_about_carrier = 1;
  92.  
  93.    if (!direct_connect && carrier())
  94.        already_connected = 1;
  95.  
  96.    if (!direct_connect && !already_connected) {
  97.        prints("Initializing modem");
  98.        cputs_tr(_auto_ans_str);
  99.    }
  100.  
  101.    while (1) {
  102.        finished_caller = kill_user = 0;
  103.  
  104.        if (direct_connect)
  105.            we_care_about_carrier = 0;
  106.        else
  107.            we_care_about_carrier = 1;
  108.  
  109.        if (!direct_connect) {
  110.  
  111.            clear_scr();
  112.            prints("┌────────────┬───────────────────────────────┐");
  113.            prints("│  DBBS 1.3  │  Waiting For Someone To Call  │");
  114.            prints("└────────────┴───────────────────────────────┘");
  115.            prints("┌────────────────────────────────────────────┐");
  116.            prints("│   Press F1 for local test, F9 to exit,     │");
  117.            prints("│   Press F2 for sysop dos utilities menu.   │");
  118.            prints("└────────────────────────────────────────────┘");
  119.            do {
  120.                if (carrier()) {
  121.                    local_mode = 0;
  122.                    break;
  123.                }
  124.  
  125.                c = inkey();
  126.                if (c) {
  127.                    if (c == 0x4300) {    // F9 exit
  128.                        exit_requested = 1;
  129.                        break;
  130.                    }
  131.                    else if (c == 0x3b00) {            // F1 local test mode
  132.                        prints("Local test mode entered");
  133.                        local_mode = 1;
  134.                        we_care_about_carrier = 0;
  135.                    }
  136.                      else if (c == 0x3c00) {  // F2 dos stuff
  137.                ustamp("Sysop used DOS functions while offline.",1,1);
  138.                dosfunction();
  139.                 }
  140.                }
  141.            }
  142.            while (toupper(c) != 0x3b00);
  143.        }
  144.  
  145.        if (!exit_requested) {
  146.            host_send("^LDBBS Version 1.3   -   By Dennis Seaton^G^M^J");
  147.            prints("┌────────────────────────────────────────────────────────────┐");
  148.            prints("│ SYSOP: Press F10 for SYSOP help menu (User can not see it) │");
  149.            prints("└────────────────────────────────────────────────────────────┘");
  150.            _sound_on=1;
  151.            tone(500, 9);
  152.            tone(900, 9);
  153.            tone(500, 9);
  154.            tone(900, 9);
  155.            tone(500, 9);
  156.            tone(900, 9);
  157.            tone(500, 9);
  158.            do_one_caller();
  159.            if ((connection_lost || kill_user) && we_care_about_carrier && carrier())
  160.                hangup();             // make sure nobody sneaks in
  161.        }
  162.        already_connected = 0;
  163.        if (exit_requested) {
  164.            if (!carrier() && !direct_connect)
  165.                cputs_tr(_mdm_init_str);
  166.            _scr_chk_key = old_scr_chk_key;
  167.            _cisb_auto = old_cisb_auto;
  168.            _zmod_auto = old_zmod_auto;
  169.            _sound_on = old_sound;
  170.            _down_dir = old_down_dir;
  171.            _up_dir = old_up_dir;
  172.            prints("^M^JHost mode script finished.");
  173.            usagelog("DBBS.LOG");
  174.            return 1;
  175.        }
  176.    }
  177. }
  178. //////////////////////////////////////////////////////////////////////////////
  179.  
  180. do_one_caller() {
  181.  
  182.    str strn[80], fname[64], temporary[1];
  183.    int option, status, c, i, i2;
  184.  
  185.    access_level = 1;
  186.  
  187.    if (already_connected)
  188.        prints("Already Connected!");
  189.    else if (we_care_about_carrier) {
  190.        if (!determine_baud())
  191.            ;                       // do something else here if this is a problem
  192.    }
  193.  
  194.    delay(10);
  195.    type_file("FIRST.MSG");
  196.  
  197.    flushbuf();
  198.    while (1) {
  199.        host_send("Please Enter Your Name -=> ");
  200.        host_input_strn(current_caller, 30, 0);
  201.        host_send("^M^J");
  202.  
  203.        if (finished_caller)
  204.            return;
  205.  
  206.        if (strlen(current_caller) >= min_user_name) {
  207.            host_send ("^"");
  208.            host_send (current_caller);
  209.            host_send ("^", correct? (Y/N) -=> ");
  210.            host_input_strn (temporary, 30, 0);
  211.            host_send ("^M^J");
  212.  
  213.            if (strcmpi (temporary, "y") == 0)
  214.                break;
  215.        }
  216.        else
  217.            host_send ("^M^JVery Funny...^G^M^J^M^J");
  218.    }
  219.  
  220.    if (access_level = ask_for_pass(3)) {
  221.        ustamp("Logon by ", 1, 0);
  222.        ustamp(current_caller, 0, 1);
  223.    }
  224.    else {
  225.        host_send("^G^M^JGoodbye!^G^M^J");
  226.        if (we_care_about_carrier) {
  227.            delay(10);
  228.            hangup();
  229.        }
  230.        ustamp("Failed logon attempt by ", 1, 0);
  231.        ustamp(current_caller, 0, 1);
  232.        return;
  233.    }
  234.  
  235.    type_file("BULLETIN.MSG");
  236.    host_send("-=> Hit Enter <=-");
  237.    host_input_strn(stuff,1,0);
  238.  
  239.    while (1) {
  240.        if (finished_caller)
  241.            return;
  242.        if (access_level <= 1) {
  243.        type_file("NEWMENU.MSG");                 // New user Menu
  244.        printsc("                 ────»   User: ");
  245.        printsc(current_caller);
  246.        printsc("   Access Level: New User   ");
  247.        printsc("   «─────^M^J");
  248.        host_send("                                  -=> ");
  249.        }
  250.        else {
  251.      type_file("MENU.MSG");                               // Normal Menu
  252.        printsc("               ────»   User: ");
  253.        printsc(current_caller);
  254.        printsc("   Access Level: ");
  255.        printc(access_level+48);
  256.        printsc("   «─────^M^J");
  257.        host_send("                                  -=> ");
  258.        }
  259.        host_input_strn(strn, 1, 0);
  260.        option = toupper(subchr(strn, 0));
  261.        host_send("^M^J");
  262.  
  263.           if (option == 'R') {                 // Files directory
  264.            if (access_level >= 2) {
  265.                host_send("^L");
  266.                host_send("┌───────────────────────┐^M^J");
  267.                host_send("│  Raw Files Directory  │^M^J");
  268.                host_send("└───────────────────────┘^M^J^M^J");
  269.                host_send("Enter filespec or Return for *.* -=> ");
  270.                host_input_strn(fname, 64, 0);
  271.                host_send("^M^J");
  272.  
  273.                if (just_filename(fname)) {
  274.                    strn = host_downloads;
  275.                    strcat(strn, fname);
  276.                }
  277.                else
  278.                strn = fname;
  279.            }
  280.            else {
  281.                strn = host_downloads;
  282.                strcat(strn, "*.*");
  283.            }
  284.  
  285.            ustamp("User used RAW directory listing.",1,1);
  286.            if (local_mode)
  287.                show_directory(strn, 0, we_care_about_carrier);
  288.            else
  289.                show_directory(strn, 1, we_care_about_carrier);
  290.          host_input_strn(stuff,1,0);
  291.        }
  292.  
  293.        else if (option == 'T') {           // Type a file
  294.            host_send("^L");
  295.            host_send("┌───────────────┐^M^J");
  296.            host_send("│  Type a File  │^M^J");
  297.            host_send("└───────────────┘^M^J^M^J");
  298.            host_send("Enter File To Display -=> ");
  299.            host_input_strn(strn, 64, 0);
  300.            host_send("^M^J");
  301.            if (access_level == 1) {           // if access 1, name and ext only
  302.                host_send("^M^J^G* Your Access Level Is Too Low *^G^M^J");
  303.                ustamp("Level 1 User Attempted To TYPE a File.",1,1);
  304.                strn = stuff;
  305.             }
  306.            else {
  307.               fname = strn;
  308.             }
  309.            if (just_filename(fname)) {
  310.                strn = host_downloads;
  311.                strcat(strn, fname);
  312.                fname = strn;
  313.            }
  314.  
  315.            if (!filefind(fname, 0, strn)) {
  316.                host_send("^GUnable to find ");
  317.                host_send(fname);
  318.                continue;
  319.            }
  320.  
  321.            type_file(fname);
  322.            host_send("^M^J-=> Hit Enter <=-");
  323.            host_input_strn(stuff,1,0);
  324.        }
  325.  
  326.        else if (option == 'L') {           // Goodbye (Hang-up)
  327.            type_file("LAST.MSG");
  328.            ustamp("User logged off.", 1, 1);
  329.            if (we_care_about_carrier) {
  330.                delay(10);
  331.                hangup();
  332.            }
  333.            return;
  334.       }
  335.        else if (option == 'M') {            // Sysop Message
  336.            host_send("^L");
  337.            host_send("┌────────────────────┐^M^J");
  338.            host_send("│  Message To Sysop  │    ( 10 lines )^M^J");
  339.            host_send("└────────────────────┘^M^J");
  340.  
  341.            host_send("( Hit enter on the 10th line to save )^M^J^M^J");
  342.                ustamp("",0,1);
  343.                ustamp("**** Message To Sysop **** ",0,1);
  344.                host_send("^M^J 1> ");
  345.                host_input_strn(stuff,78,0);
  346.                 ustamp(stuff,0,1);
  347.                host_send("^M^J 2> ");
  348.                host_input_strn(stuff,78,0);
  349.                 ustamp(stuff,0,1);
  350.                host_send("^M^J 3> ");
  351.                host_input_strn(stuff,78,0);
  352.                 ustamp(stuff,0,1);
  353.                host_send("^M^J 4> ");
  354.                host_input_strn(stuff,78,0);
  355.                 ustamp(stuff,0,1);
  356.                host_send("^M^J 5> ");
  357.                host_input_strn(stuff,78,0);
  358.                 ustamp(stuff,0,1);
  359.                host_send("^M^J 6> ");
  360.                host_input_strn(stuff,78,0);
  361.                 ustamp(stuff,0,1);
  362.                host_send("^M^J 7> ");
  363.                host_input_strn(stuff,78,0);
  364.                 ustamp(stuff,0,1);
  365.                host_send("^M^J 8> ");
  366.                host_input_strn(stuff,78,0);
  367.                 ustamp(stuff,0,1);
  368.                host_send("^M^J 9> ");
  369.                host_input_strn(stuff,78,0);
  370.                 ustamp(stuff,0,1);
  371.                host_send("^M^J10> ");
  372.                host_input_strn(stuff,78,0);
  373.                 ustamp(stuff,0,1);
  374.                 ustamp(" **** End Of Message **** ",0,1);
  375.                 ustamp("",0,1);
  376.                }
  377.            else if (option == 'Y') {           // Chat mode
  378.            host_send("^L");
  379.            host_send("┌────────────────┐^M^J");
  380.            host_send("│  Paging Sysop  │^M^J");
  381.            host_send("└────────────────┘^M^J^M^J");
  382.            printsc("─────»  User: ");
  383.            printsc(current_caller);
  384.            printsc("   Access Level: ");
  385.            printc(access_level+48);
  386.            printsc("  «─────");
  387.            c = 0;
  388.            _sound_on = 1;
  389.            for (i = 4; i && !c; --i) {
  390.                if (we_care_about_carrier && !carrier()) {
  391.                    prints("^M^JConnection has been lost, call terminated.^M^J");
  392.                    connection_lost = 1;
  393.                    finished_caller = 1;
  394.                    break;
  395.                }
  396.                cputc('^G');
  397.                tone(475, 10);
  398.                tone(925, 10);
  399.                tone(475, 10);
  400.                tone(925, 10);
  401.                tone(475, 10);
  402.                tone(925, 10);
  403.                for (i2 = 30; i2 && (c = inkey()) == 0; --i2)
  404.                    delay(1);
  405.            }
  406.            _sound_on = 0;
  407.            if (finished_caller)
  408.                continue;
  409.            if (c != ' ' || !c) {
  410.                host_send("^LSorry The Sysop Is Unavaliable!^M^J^M^J");
  411.                host_send("Leave Him A Short Message  (5 Lines)^M^J");
  412.                ustamp("",0,1);
  413.                ustamp("**** Message To Sysop *** ",0,1);
  414.                host_send("^M^J1>");
  415.                host_input_strn(stuff,78,0);
  416.                ustamp(stuff,0,1);
  417.                host_send("^M^J2>");
  418.                host_input_strn(stuff,78,0);
  419.                ustamp(stuff,0,1);
  420.                host_send("^M^J3>");
  421.                host_input_strn(stuff,78,0);
  422.                ustamp(stuff,0,1);
  423.                host_send("^M^J4>");
  424.                host_input_strn(stuff,78,0);
  425.                ustamp(stuff,0,1);
  426.                host_send("^M^J^G5>");
  427.                host_input_strn(stuff,78,0);
  428.                ustamp(stuff,0,1);
  429.                ustamp(" **** End of Message **** ",0,1);
  430.                ustamp("",0,1);
  431.                continue;
  432.            }
  433.             host_send("^L");
  434.             host_send("┌─────────────┐^M^J");
  435.             host_send("│  Chat Mode  │^M^J");
  436.             host_send("└─────────────┘^M^J^M^J");
  437.             ustamp("User chated with sysop.",1,1);
  438.             chatmode(1);
  439.        }
  440.       else if (option == 'F')    // Files List
  441.        {
  442.       if (access_level >= 2) {
  443.       ustamp("User viewed the FILES",1,1);
  444.       type_file ("FILES.MSG");
  445.       host_send("-=> Hit Enter <=-");
  446.       host_input_strn(stuff,1,0);
  447.        }
  448.       else {
  449.       host_send("^M^J^G* Your Access Level Is Too Low *^G^M^J");
  450.       ustamp("Level 1 User Attempted To View FILES LIST.",1,1);
  451.       }
  452.        }
  453.       else if (option == 'B')
  454.       {
  455.       ustamp("User read BULLETINS",1,1);
  456.       type_file ("BULLETIN.MSG");
  457.       host_send("-=> Hit Enter <=-");
  458.       host_input_strn(stuff,1,0);
  459.       }
  460.       else if (option == 'V')
  461.       {
  462.       host_send("^L");
  463.       ustamp("User looked at VERSION information",1,1);
  464.       host_send("┌───────────────────────────────────────┐^M^J");
  465.       host_send("│ DBBS Version 1.3    By Dennis Seaton  │^M^J");
  466.       host_send("│                                       │^M^J");
  467.       host_send("│     Released -=> March 27th 1988      │^M^J");
  468.       host_send("│                                       │^M^J");
  469.       host_send("│  Telix Support BBS -=> 416-284-0682   │^M^J");
  470.       host_send("└───────────────────────────────────────┘^M^J");
  471.       host_send("^M^J^M^J-=> Hit Enter <=-");
  472.       host_input_strn(stuff,1,0);
  473.       }
  474.       else if (option == 'O')
  475.       {
  476.       if (access_level >= 2) {
  477.       ustamp("User read the BBS list",1,1);
  478.       type_file("BBSNUM.MSG");
  479.       host_send("-=> Hit Enter <=-");
  480.       host_input_strn(stuff,1,0);
  481.       }
  482.       else {
  483.       host_send("^G* Your Access Level Is Too Low *^G^M^J");
  484.       ustamp("Level 1 User Attempted To View BBS LIST",1,1);
  485.        }
  486.       }
  487.       else if (option == 'C')
  488.       {
  489.       if (access_level == 3) {
  490.       host_send("^L");
  491.       host_send("┌───────────────┐^M^J");
  492.       host_send("│  Dos Command  │^M^J");
  493.       host_send("└───────────────┘^M^J");
  494.       host_send("^M^J");
  495.       host_send("Enter Command -=> ");
  496.       host_input_strn(stuff, 78, 0);
  497.       ustamp("Level 3 user used DOS COMMAND",1,1);
  498.       dos(stuff,1);
  499.       }
  500.       else {
  501.       host_send("^G* Your Access Level Is Too Low *^G^M^J");
  502.       ustamp("User attempted to use DOS COMMAND",1,1);
  503.        }
  504.       }
  505.       else if (option == 'G')
  506.       {
  507.       if (access_level == 3) {
  508.       ustamp("Level 3 user viewed DBBS.LOG",1,1);
  509.       type_file("DBBS.LOG");
  510.       host_send("-=> Hit Enter <=-");
  511.       host_input_strn(stuff,1,0);
  512.       }
  513.       else {
  514.       host_send("^G* Your Access Level Is Too Low *^G^M^J");
  515.       ustamp("User Attempted To View DBBS.LOG",1,1);
  516.        }
  517.       }
  518.       else if (option == 'N')
  519.       {
  520.       ustamp("User read the NEW USER information",1,1);
  521.       type_file("NEWUSER.MSG");
  522.       host_send("-=> Hit Enter <=-");
  523.       host_input_strn(stuff,1,0);
  524.       }
  525.       else if (option == 'A') {
  526.        if (access_level >= 2) {
  527.        dos("DBBS.BAT", 0);
  528.        ustamp("User ran DBBS.BAT.",1,1);
  529.        }
  530.        else {
  531.         host_send("^M^J^G* Your Access Level Is Too Low *^G^M^J");
  532.         ustamp("Level 1 User Attempted To Run DBBS.BAT",1,1);
  533.  
  534.         }
  535.       }
  536.       else if (option == 'E')
  537.       {
  538.       ustamp("User viewed the EXTRA INFORMATION file.",1,1);
  539.       type_file ("EXTRA.MSG");
  540.       host_send("-=> Hit Enter <=-");
  541.       host_input_strn(stuff,1,0);
  542.       }
  543.        else if (option == 'U') {           // User upload
  544.            if (! (option = host_get_prot()))
  545.                continue;
  546.  
  547.            status = 1;
  548.            if (option == 'T' || option == 'M' || option == 'S' ||
  549.                    option == 'Y' || option == 'Z' || option == 'E') {
  550.                send_transfer_msg();
  551.                status = receive(option, "");
  552.            }
  553.            else {
  554.                host_send("Upload what file -> ");
  555.                host_input_strn(strn, 48, 0);
  556.                host_send("^M^J");
  557.                if (!strn)
  558.                    continue;
  559.                if (access_level == 1)             // if access 1, name and ext only
  560.                    fnstrip(strn, 3, fname);
  561.                else
  562.                    fname = strn;
  563.  
  564.                if (just_filename(fname)) {
  565.                    strn = host_uploads;
  566.                    strcat(strn, fname);
  567.                    fname = strn;
  568.                  }
  569.                if (filefind(fname, 23, strn))
  570.                    host_send("Thanks, but I've got that file already!^G^M^J");
  571.                     else {
  572.                    send_transfer_msg();
  573.                    status = receive(option, fname);
  574.                }
  575.            }
  576.            if (status == -2)                        // Carrier lost
  577.                connection_lost = finished_caller = 1;
  578.            else if (status == -1)
  579.                host_send("^G-=> One or more files not received! <=-^M^J");
  580.        }
  581.        else if (option == 'S') {           // Remote shell
  582.            if (get_port() != 1 && get_port() != 2) {
  583.                host_send("Remote Shell not supported on this comm port due to DOS limits!^M^J");
  584.                continue;
  585.            }
  586.  
  587.            if (access_level == 3) {            // Need access level 3 to shell
  588.                host_send("^L");
  589.                host_send("┌─────────────┐^M^J");
  590.                host_send("│  Dos Shell  │^M^J");
  591.                host_send("└─────────────┘^M^J^M^J");
  592.                host_send(" - Do NOT hang up while in shell^M^J");
  593.                host_send(" - Most programs can NOT be ran through modem^M^J");
  594.                host_send(" - Type EXIT to return to DBBS ^M^J");
  595.                host_send("        ────^M^J");
  596.                if (get_baud() == 300)
  597.                    delay(10);
  598.  
  599.                strn = "GATE1";     // THE GATEWAY DRIVER IS NEEDED CHANGE GATE1 TO STRN
  600.                setchr("GATE1", 3, get_port() + '0'); // AND TAKE OUT QUOTES ON THIS LINE
  601.                                                   // TO MAKE IT WORK WITH OUT GATEWAY. THIS IS
  602.                if (!local_mode)                  // SET UP FOR COM1 RIGHT NOW.  * DBBS 1.1 *
  603.                    if (redirect_dos("GATE1") == -1)    // redirect DOS input and output
  604.                        continue;
  605.                ustamp("Level 3 user jumped to shell.",1,1);
  606.                dos("", 0);                    // actually call the shell
  607.  
  608.                    if (!local_mode)
  609.                        redirect_dos("");         // very important to put things back to norm
  610.                ustamp("User returned from dos shell.",1,1);
  611.            }
  612.            else {
  613.                host_send ("^G^G * Your Access Level Is Too Low *^M^J");
  614.            }
  615.        }
  616.  
  617.        else if (option == 'K') {            // Remote Shut down Host Mode
  618.            if (access_level == 3) {
  619.                host_send("┌──────────────────────────────────────┐^M^J");
  620.                host_send("│  User Shutting down DBBS.  Goodbye!  │^M^J");
  621.                host_send("└──────────────────────────────────────┘^M^J");
  622.                if (we_care_about_carrier)
  623.                    hangup();
  624.                ustamp("Level 3 user shut down DBBS.", 1, 1);
  625.                finished_caller = 1;
  626.                exit_requested = 1;
  627.            }
  628.            else {
  629.                host_send ("^G^G * Your Access Level Is Too Low *^M^J");
  630.            }
  631.        }
  632.        else if (option == 'D') {           // User download
  633.            if (access_level >= 2) {
  634.            if (! (option = host_get_prot()))
  635.                continue;
  636.            host_send("Download what file -=> ");
  637.            host_input_strn(strn, 48, 0);
  638.            host_send("^M^J");
  639.  
  640.            if (!strn)
  641.                continue;
  642.                fname = strn;
  643.  
  644.            if (just_filename(fname)) {
  645.                strn = host_downloads;
  646.                strcat(strn, fname);
  647.                fname = strn;
  648.            }
  649.  
  650.            if (!filefind(fname, 0, strn)) {
  651.                host_send("^G* I dont have that file! *^M^J");
  652.                continue;
  653.            }
  654.  
  655.            status = 1;
  656.            send_transfer_msg();
  657.            status = send(option, fname);
  658.            if (status == -2)                        // Carrier lost
  659.                connection_lost = finished_caller = 1;
  660.            else if (status == -1)
  661.                host_send("^G-=> One or more files NOT received! <=-^M^J");
  662.        }
  663.         else {
  664.         host_send("^M^J^G* Your Access Level Is Too Low *^G^M^J");
  665.         ustamp("Level 1 User Attempted To Download",1,1);
  666.          }
  667.        }
  668.      }
  669.    }
  670.  
  671. //////////////////////////////////////////////////////////////////////////////
  672.  
  673. host_get_prot() {
  674.  
  675.    str prot[1];
  676.    host_send("^L");
  677.    host_send("        ┌─────────────────┐^M^J");
  678.    host_send("        │  File Transfer  │^M^J");
  679.    host_send("        └─────────────────┘^M^J^M^J");
  680.    host_send("┌───────────────────────────────────┐^M^J");
  681.    host_send("│   [Z]modem          [S]ealink     │^M^J");
  682.    host_send("│   [X]modem          [1]k-Xmodem   │^M^J");
  683.    host_send("│   [G]-1k-Xmodem     [Y]modem      │^M^J");
  684.    host_send("└───────────────────────────────────┘^M^J");
  685.  
  686.    host_send("^M^J    Which protocol -=> ");
  687.    host_input_strn(prot, 1, 0);
  688.    host_send("^M^J");
  689.  
  690.    if (strposi("MSX1GYEZ", prot, 0) == -1)     // if illegal prot
  691.        prot = "";                                 // return 0
  692.  
  693.    return (toupper(subchr(prot, 0)));
  694.  
  695. }
  696.  
  697. //////////////////////////////////////////////////////////////////////////////
  698.  
  699. send_transfer_msg() {
  700.    host_send("^L");
  701.    host_send("┌──────────────────────────────────────────────────────────────┐^M^J");
  702.    host_send("│ -=> Ready to transfer file(s)... Slam on Ctrl-X to abort <=- │^M^J");
  703.    host_send("└──────────────────────────────────────────────────────────────┘^M^J");
  704. }
  705.  
  706. //////////////////////////////////////////////////////////////////////////////
  707. // Determine the baud rate once a Carrier Detect Signal has been detected
  708. // Since no characters were read, the 'CONNECT' string should still be
  709. // in the receive buffer.
  710.  
  711. determine_baud() {
  712.  
  713.    int t3, t12, t24, t96, t192;
  714.    int tmark, stat;
  715.    int new_baud = 0;
  716.  
  717.    printsc("Determining baud... ");
  718.  
  719.    track_free(0);                // clear all existing tracks
  720.  
  721.    t3 = track(conn300, 0);       // check for connect strings
  722.    t12 = track(conn1200, 0);
  723.    t24 = track(conn2400, 0);
  724.    t96 = track(conn9600, 0);
  725.    t192 = track(conn19200, 0);
  726.  
  727.    tmark = timer_start(30);      // wait up to 3 seconds for string
  728.  
  729.    while (!time_up(tmark)) {
  730.        if (!carrier()) {
  731.            track_free(0);            // clear all existing tracks
  732.            return 0;
  733.        }
  734.  
  735.    if (cinp_cnt())
  736.        track_addchr(cgetc());
  737.  
  738.    stat = track_hit(0);
  739.    if (stat == 0)
  740.        continue;
  741.  
  742.    if (stat == t3)
  743.        new_baud = 300;
  744.    else if (stat == t24)
  745.        new_baud = 2400;
  746.    else if (stat == t96)
  747.        new_baud = 9600;
  748.    else if (stat == t192)
  749.        new_baud = 19200;
  750.    else
  751.        new_baud = 1200;
  752.  
  753.    break;                      // have baud rate, get out
  754.    }
  755.  
  756.    if (!new_baud) {               // time-up without CONNECT string
  757.        prints("Unknown!");
  758.        track_free(0);              // clear all existing tracks
  759.        return 0;
  760.    }
  761.  
  762.    printn(new_baud);
  763.    prints("");
  764.    set_cparams(new_baud, get_parity(), get_datab(), get_stopb());
  765.  
  766.    track_free(0);                // clear all existing tracks
  767.    return 1;                     // indicate success
  768.  
  769. }
  770.  
  771. //////////////////////////////////////////////////////////////////////////////
  772.  
  773. type_file(str fname) {
  774.  
  775.    int f, control_z_loc;
  776.    str buf[100];
  777.    int ichar, lines_sent = 0;
  778.  
  779.    if (not (f = fopen(fname, "r")))
  780.        return -1;
  781.  
  782.    host_send("^M^J");
  783.  
  784.    while (1) {
  785.        if (we_care_about_carrier) {
  786.            if (!carrier()) {
  787.                connection_lost = 1;
  788.                finished_caller = 1;
  789.                fclose(f);
  790.                return 0;
  791.            }
  792.        }
  793.  
  794.        if (fgets(buf, 80, f) == -1) {
  795.            fclose(f);
  796.            return 1;
  797.        }
  798.  
  799.        if ((control_z_loc = strpos (buf, "^Z", 0)) >= 0) {
  800.            if (control_z_loc == 0) {
  801.                fclose (f);
  802.                return 1;
  803.            }
  804.            else {
  805.                setchr (buf, control_z_loc, 0);
  806.            }
  807.        }
  808.  
  809.        host_send(buf);
  810.        host_send("^M^J");
  811.        ++lines_sent;
  812.  
  813.        if (lines_sent >= 22222) {    // This is just a pain in the butt,
  814.            lines_sent = 0;           // who needs it!?
  815.            host_send("-=> Hit Enter <=-");
  816.            host_input(0);
  817.  
  818.            if (finished_caller) {        // if user inactivity
  819.                fclose(f);
  820.                return 0;
  821.            }
  822.  
  823.            host_send("^H ^H^H ^H^H ^H^H ^H^H ^H^H ^H^H ^H");
  824.        }
  825.  
  826.        while (cinp_cnt()) {
  827.            ichar = cgetc();
  828.            if (ichar == '^C' || ichar == '^K') {
  829.                host_send("^M^J");
  830.                fclose(f);
  831.                return 1;
  832.            }
  833.        }
  834.    }
  835. }
  836.  
  837. //////////////////////////////////////////////////////////////////////////////
  838.  
  839. host_send(str outstr) {
  840.  
  841.    printsc(outstr);
  842.    if (!local_mode)
  843.        cputs(outstr);
  844.  
  845. }
  846.  
  847. //////////////////////////////////////////////////////////////////////////////
  848.  
  849. host_send_c(int chr) {
  850.  
  851.    printc(chr);
  852.    if (!local_mode)
  853.        cputc(chr);
  854.  
  855. }
  856.  
  857. //////////////////////////////////////////////////////////////////////////////
  858.  
  859. host_input_strn(str buf, int maximum, int echo_asterisk) {
  860.  
  861. //Rev 11/25/88 by Jon Fleming to echo a string of asterisks if
  862. //     "echo_asterisk" is non-zero, echo the input string if "echo_asterisk"
  863. //     is zero.
  864.  
  865.    int i = 0, key;
  866.  
  867.    while (1) {
  868.        key = host_input(echo_asterisk);
  869.        if (!key) {                // timeout or user disconnect
  870.            setchr(buf, 0, 0);      // set string to empty
  871.            return 0;               // indicate there is a problem
  872.        }
  873.  
  874.        if (key == '^M')
  875.            break;
  876.        if (key == 127 || key == 8) {
  877.            if (i) {
  878.                --i;
  879.                host_send_c(key);
  880.            }
  881.            continue;
  882.        }
  883.        if (i < maximum) {
  884.            setchr(buf, i, key);
  885.            i = i + 1;
  886.        }
  887.        else
  888.            i = i + 1;
  889.    }
  890.  
  891.    if (i > maximum)
  892.        i = maximum;
  893.  
  894.    setchr(buf, i, '^0');
  895.  
  896.    if (subchr(buf, 0))
  897.        return 1;
  898.    else
  899.        return 0;
  900.  
  901. }
  902.  
  903. //////////////////////////////////////////////////////////////////////////////
  904.  
  905. host_input(int echo_asterisk) {
  906.  
  907. // Rev 11/25 88 by Jon Fleming to echo asterisk if "echo_asterisk" is
  908. //     non-zero, to echo the input character if "echo_asterisk" is zero.
  909. // Rev 15/03 89 by Dennis Seaton to ditch the echo asterisk *DBBS 1.3*
  910.    int c, t;
  911.  
  912.    t = timer_start(3000);         // 4 minutes inactivity allowed
  913.  
  914.    while (1) {
  915.        if (time_up(t) && !direct_connect) {
  916.            host_send("^L^M^J^M^J^G^G^GInactivity period too long! Goodbye!^M^J");
  917.            if (we_care_about_carrier)
  918.                hangup();
  919.            ustamp("User inactivity, hung up.",1,1);
  920.            finished_caller = 1;
  921.            kill_user = 1;
  922.            return 0;
  923.        }
  924.  
  925.        if (we_care_about_carrier)
  926.            if (!carrier()) {
  927.                prints("^M^JConnection has been lost, call terminated.^M^J");
  928.                connection_lost = 1;
  929.                finished_caller = 1;
  930.            return 0;
  931.            }
  932.                      // ****** DBBS 1.3 SYSOP UTILITIES ******
  933.  
  934.        if ((c = inkey()) != 0) {
  935.            if (c == 0x4300) {              // *F9 key* sysop wants to exit
  936.                host_send("^M^J* Sysop Terminating DBBS *^M^J");
  937.                ustamp("Sysop Terminated DBBS",1,1);
  938.                finished_caller = 1;
  939.                exit_requested = 1;
  940.                return 0;
  941.            }
  942.            else if (c == 0x3b00) {     // *F1 key* Terminate Loser
  943.                host_send("^GSystem Lock Out! ^G GET LOST! ^M^J^M^J^M^J^G");
  944.                prints("^M^J* Jerk terminated! *");
  945.                ustamp("Bad User terminated!", 1, 1);
  946.                if (we_care_about_carrier)
  947.                hangup();
  948.  
  949.                finished_caller = 1;
  950.                kill_user = 1;
  951.                return 0;
  952.            }
  953.            else if (c == 0x3c00) {     // *F2 key* Dos Functions
  954.                host_send("^M^J");
  955.                host_send("┌───────────────┐^M^J");
  956.                host_send("│  Please Wait  │^M^J");
  957.                host_send("└───────────────┘^M^J");
  958.                dosfunction();
  959.                host_send("^G");
  960.                return 0;
  961.            }
  962.             else if (c == 0x3d00) {    // *F3 key* New user level
  963.                host_send("^M^J");
  964.                host_send("┌───────────────────────────────┐^M^J");
  965.                host_send("│ You are now at new user level │^M^J");
  966.                host_send("└───────────────────────────────┘^M^J");
  967.                host_send("^M^J");
  968.                access_level = 1;
  969.                ustamp("Sysop put user at level 1",1,1);
  970.                return 0;
  971.               }
  972.                else if (c == 0x3e00) {    // *F4 key* Normal User Level
  973.                host_send("^M^J");
  974.                host_send("┌──────────────────────────────────┐^M^J");
  975.                host_send("│ You are now at normal user level │^M^J");
  976.                host_send("└──────────────────────────────────┘^M^J");
  977.                host_send("^M^J");
  978.                access_level = 2;
  979.                ustamp("Sysop put user at level 2",1,1);
  980.                return 0;
  981.               }
  982.                else if (c == 0x3f00) {    // *F5 key* Sysop user level
  983.                host_send("^M^J");
  984.                host_send("┌─────────────────────────────────┐^M^J");
  985.                host_send("│ You are now at sysop user level │^M^J");
  986.                host_send("└─────────────────────────────────┘^M^J");
  987.                host_send("^M^J");
  988.                access_level = 3;
  989.                ustamp("Sysop put user at level 3",1,1);
  990.                return 0;
  991.               }
  992.                else if (c == 0x4000) {    // *F6 key* Force Chat
  993.                host_send("^M^J");
  994.                ustamp("Sysop entered chat",1,1);
  995.                host_send("^L");
  996.                host_send("┌─────────────────────────┐^M^J");
  997.                host_send("│ Sysop now entering chat │^M^J");
  998.                host_send("└─────────────────────────┘^M^J^M^J");
  999.                t = timer_start(999999);    // Neccessary or USER INACTIVITY kills user
  1000.                chatmode(1);
  1001.                t = timer_start(3000);      // Return to normal
  1002.                return 0;
  1003.              }
  1004.                else if (c == 0x4100) {      // *F8 key* Use Telix.Fon Directory
  1005.                host_send("^M^J");
  1006.                host_send("┌───────────────┐^M^J");
  1007.                host_send("│  Please Wait  │^M^J");
  1008.                host_send("└───────────────┘^M^J");
  1009.                loadfon();
  1010.                dial();
  1011.                host_send("^G");
  1012.                ustamp("Sysop used dialing directory",1,1);
  1013.                return 0;
  1014.                }
  1015.                else if (c == 0x4200) {    // *F8 key* Take User to Dos
  1016.                if (get_baud() == 300)
  1017.                    delay(10);
  1018.  
  1019.                setchr("GATE1", 3, get_port() + '0');
  1020.  
  1021.                if (!local_mode)                  // SET UP FOR COM1 RIGHT NOW.  * DBBS 1.1 *
  1022.                    if (redirect_dos("GATE1") == -1)
  1023.                        continue;
  1024.                ustamp("User forced to shell with sysop.",1,1);
  1025.                host_send("^L");
  1026.                host_send("┌─────────────────────────────┐^M^J");
  1027.                host_send("│  Sysop bringing you to dos  │^M^J");
  1028.                host_send("└─────────────────────────────┘^M^J");
  1029.                dos("", 0);
  1030.  
  1031.                    if (!local_mode)
  1032.                        redirect_dos("");
  1033.                ustamp("User returned from dos shell.",1,1);
  1034.                return 0;
  1035.               }
  1036.  
  1037.                else if (c == 0x4400) {    // *F10* Sysop Help Menu
  1038.                clear_scr();
  1039.                prints("╒══════════════════════════════════════╕");
  1040.                prints("╞════════════╡ Sysop Menu ╞════════════╡");
  1041.                prints("╞══════════════════════════════════════╡");
  1042.                prints("│═══» KEY «══════» FUNCTION «══════════│");
  1043.                prints("│     F1   ──   Hang Up On User        │");
  1044.                prints("│     F2   ──   Dos Functions          │");
  1045.                prints("│     F3   ──   Make User Level 1      │");
  1046.                prints("│     F4   ──   Make User Level 2      │");
  1047.                prints("│     F5   ──   Make User Level 3      │");
  1048.                prints("│     F6   ──   Force Chat             │");
  1049.                prints("│     F7   ──   Access Telix.fon       │");
  1050.                prints("│     F8   ──   Jump To Dos With User  │");
  1051.                prints("│     F9   ──   Exit To Telix          │");
  1052.                prints("│    F10   ──   Display This Menu      │");
  1053.                prints("└──────────────────────────────────────┘");
  1054.            }
  1055.  
  1056.            else if (c <= 255) {
  1057.                if (c != 8 && c != 127) {
  1058.                    if ( (echo_asterisk) && (c != 13) ) {
  1059.                        host_send_c(c);
  1060.                    }
  1061.                    else {
  1062.                        host_send_c(c);
  1063.                    }
  1064.                }
  1065.                return c;
  1066.            }
  1067.        }
  1068.  
  1069.        if (!local_mode)
  1070.            if (cinp_cnt()) {
  1071.                c = cgetc();
  1072.                if (c != 8 && c != 127) {
  1073.                    if ( (echo_asterisk) && (c != 13) ) {
  1074.                    host_send_c (c);
  1075.                    }
  1076.                else {
  1077.                    host_send_c(c);
  1078.                }
  1079.            }
  1080.            return c;
  1081.        }
  1082.    }
  1083. }
  1084.  
  1085. //////////////////////////////////////////////////////////////////////////////
  1086.  
  1087.  
  1088. // This routine maintains an ASCII file in the Telix files directory called
  1089. //     PASSWORD.TLX.  The format for each line is:
  1090.  
  1091. //     name;password;access_level  (optional comment)
  1092. // Changed by Dennis seaton, DBBS 1.3
  1093. ask_for_pass(int maxtries) {
  1094.    str password_file[64], line_from_file[80], password_from_file[16],
  1095.            name_from_file[31], temporary[16], typed_password[16];
  1096.  
  1097.    int password_file_handle, field_length, field_start,
  1098.            found_password = 0, access_from_file, counter = 0,
  1099.            file_ends_in_control_z = 0, line_number = 0;
  1100.  
  1101.                                            // Build password file name
  1102.    password_file = _telix_dir;
  1103.    strcat (password_file, "DBBSPASS.TLX");
  1104.                                            // Try to open password file
  1105.    if (password_file_handle = fopen (password_file, "r")) {
  1106.                                            // Read next line from file.
  1107.        while (fgets (line_from_file, 64, password_file_handle) != -1) {
  1108.                                            // Check for ^Z termination
  1109.            if (line_from_file == "^Z") {
  1110.                file_ends_in_control_z = 1;
  1111.                break;
  1112.            }
  1113.            line_number = line_number + 1;
  1114.                                            // If line is long enough . . .
  1115.            if (strlen (line_from_file) >= min_user_name+4) {
  1116.                                            // Get length of name
  1117.                if ( (field_length = strchr (line_from_file, 0, ';')) > 0) {
  1118.                                            // Get name
  1119.                    substr (line_from_file, 0, field_length, name_from_file);
  1120.                                            // If name matches . . . .
  1121.                    if (strcmpi (name_from_file, current_caller) == 0) {
  1122.                                            // Get password
  1123.                        field_start = field_length + 1;
  1124.                        if ( (field_length = strchr (line_from_file, field_start, ';') - field_start) > 0) {
  1125.                            substr (line_from_file, field_start, field_length, password_from_file);
  1126.                                            // Get access level
  1127.                            field_start = field_start + field_length + 1;
  1128.                            substr (line_from_file, field_start, 1, temporary);
  1129.                            access_from_file = stoi (temporary);
  1130.                                            // Set flag that we got an old user
  1131.                            found_password = 1;
  1132.                            break;
  1133.                        }
  1134.                        else {
  1135.                            password_file_error (line_number, line_from_file, "no second semicolon");
  1136.                            ustamp("** Password file error! **",0,1);
  1137.                        }
  1138.                    }
  1139.                }
  1140.                else {
  1141.                    password_file_error (line_number, line_from_file, "no first semicolon");
  1142.                    ustamp("** Password file error! **",0,1);
  1143.                }
  1144.            }
  1145.            else {
  1146.                password_file_error (line_number, line_from_file, "line too short");
  1147.                ustamp("** Password file error! **",0,1);
  1148.            }
  1149.        }
  1150.        fclose (password_file_handle);
  1151.    }
  1152.  
  1153.    if (found_password) {
  1154.                                            // Password is on file; ask for it
  1155.        host_send ("Password -=> ");
  1156.        for (counter = 1; counter <= maxtries; counter = counter + 1) {
  1157.            host_input_strn (typed_password, 16, 1);
  1158.                                            // If a match
  1159.            if (strcmpi (typed_password, password_from_file) == 0) {
  1160.                host_send ("^M^J");
  1161.                return (access_from_file);
  1162.            }
  1163.            if (counter <maxtries) {
  1164.                host_send ("^M^J^GWRONG PASSWORD! Try again.^M^J");
  1165.                host_send ("Password -> ");
  1166.            }
  1167.            else {
  1168.                host_send ("^L^M^J^G^GTOO MANY ATTEMPTS! ACCESS DENIED!^M^J^G^G");
  1169.            }
  1170.        }
  1171.    }
  1172.                                            // Password is not on file
  1173.    else {
  1174.                                            // Offer chance to register
  1175.        host_send ("^L^M^J Hello ^"");
  1176.        host_send (current_caller);
  1177.        host_send ("^" , You are not found in the user file.^J^M^J^M");
  1178.        host_send ("Would you like to register -=> ");
  1179.        host_input_strn (temporary, 1, 0);
  1180.        host_send ("^M^J");
  1181.                                            // If user doesn't want to register
  1182.        if (not ((temporary == "Y") || (temporary == "y"))) {
  1183.            return (0);
  1184.        }
  1185.                       // If user wants to register
  1186.                       // DBBS V1.3 QUESTIONAIRE CREATED
  1187.        host_send("^L");
  1188.        host_send("┌─────────────────────────────┐^M^J");
  1189.        host_send("│  Registration Questionaire  │^M^J");
  1190.        host_send("└─────────────────────────────┘^M^J");
  1191.        ustamp("",0,1);
  1192.        ustamp("**** New User Answers to Registration Questionaire ****",0,1);
  1193.        host_send("1. Enter your full REAL name ^M^J-=> ");
  1194.        host_input_strn(stuff, 45, 1);
  1195.        ustamp("1. Full Name -=> ");
  1196.        ustamp(stuff,0,1);
  1197.  
  1198.        host_send("^M^J^M^J2. Voice Phone Number ^M^J-=> ");
  1199.        host_input_strn(stuff, 14, 1);
  1200.        ustamp("2. Voice Phone Number -=> ");
  1201.        ustamp(stuff,0,1);
  1202.  
  1203.        host_send("^M^J^M^J3. Data Phone Number ^M^J-=> ");
  1204.        host_input_strn(stuff, 14, 1);
  1205.        ustamp("3. Data Phone Number -=> ");
  1206.        ustamp(stuff,0,1);
  1207.  
  1208.        host_send("^M^J^M^J4. Home Adress ^M^J-=> ");
  1209.        host_input_strn(stuff, 50, 1);
  1210.        ustamp("4. Home Adress -=> ");
  1211.        ustamp(stuff,0,1);
  1212.  
  1213.        host_send("^M^J^M^J5. Age ^M^J-=> ");
  1214.        host_input_strn(stuff, 2, 1);
  1215.        ustamp("5. Age -=> ");
  1216.        ustamp(stuff,0,1);
  1217.  
  1218.        host_send("^M^J^M^J6. Comment To Sysop (1 Line) ^M^J-=> ");
  1219.        host_input_strn(stuff, 77, 1);
  1220.        ustamp("6. Comment -=> ");
  1221.        ustamp(stuff,0,1);
  1222.  
  1223.    host_send ("^M^J^M^J7. Pick a password (16 characters max)^M^J-=> ");
  1224.    host_input_strn (password_from_file, 16, 1);
  1225.    ustamp("7. Password -=> ");
  1226.    ustamp(password_from_file,0,1);
  1227.    ustamp("",0,1);
  1228.    ustamp("**** End Of New User Questionaire ****",0,1);
  1229.    ustamp("",0,1);
  1230.    host_send("^M^JRemeber your password! -=> ");
  1231.    host_send(password_from_file);
  1232.    host_send("^M^J^M^JThank you for answering the questions, if everything^M^J");
  1233.    host_send("is correct, you will be validated soon.");
  1234.    host_send("^M^J^M^JHit Enter To Continue -=> ");
  1235.    host_input_strn(temporary,1,0);
  1236.  
  1237.                                        // Build new line for password file
  1238.                line_from_file = current_caller;
  1239.                strcat (line_from_file, ";");
  1240.                strcat (line_from_file, password_from_file);
  1241.                strcat (line_from_file, ";1 ───» NEW USER «─── ");
  1242.                date (curtime(), temporary);
  1243.                strcat (line_from_file, temporary);
  1244.  
  1245.                password_file_handle = fopen (password_file, "a+");
  1246.                if (file_ends_in_control_z) {
  1247.                    fseek (password_file_handle, -1, 2);
  1248.                }
  1249.                fwrite (line_from_file, strlen (line_from_file), password_file_handle);
  1250.                fwrite ("^M^J", 2, password_file_handle);
  1251.                fclose (password_file_handle);
  1252.                host_send ("^M^J");
  1253.  
  1254.                return (1);
  1255.            }
  1256.        }
  1257.  
  1258. //////////////////////////////////////////////////////////////////////////////
  1259.  
  1260. password_file_error (int line_number, str line, str error_specifier) {
  1261.  
  1262.    str line_number_string[4];
  1263.  
  1264.    itos (line_number, line_number_string);
  1265.  
  1266.    prints ("");
  1267.    printsc ("* Sysop: Bad line ");
  1268.    printsc (line_number_string);
  1269.    prints (" in password file:");
  1270.    printsc ("   ^"");
  1271.    printsc (line);
  1272.    prints ("^"");
  1273.    prints (error_specifier);
  1274.    prints (" *^M^J");
  1275.    return (1);
  1276. }
  1277.  
  1278. //////////////////////////////////////////////////////////////////////////////
  1279.  
  1280. // Rev 11/25/88 by **Jon Fleming** to not read the lines from the old host mode
  1281. //  configuration file that are no longer applcable.
  1282.  
  1283. read_host_config_file() {
  1284.  
  1285.    str config_file_name[80], buffer [32];
  1286.    int config_file_handle;
  1287.  
  1288.    config_file_name = _telix_dir;
  1289.    strcat(config_file_name, "DBBS.CNF");
  1290.  
  1291.  
  1292.    if (not (config_file_handle = fopen(config_file_name, "r"))) {
  1293.        printsc("Can't open ");
  1294.        prints(config_file_name);
  1295.        return -1;
  1296.    }
  1297.  
  1298.    if (fgets(host_downloads, 80, config_file_handle) == -1) {
  1299.        fclose(config_file_handle);
  1300.        return -1;
  1301.    }
  1302.  
  1303.    if (fgets(host_uploads, 80, config_file_handle) == -1) {
  1304.        fclose(config_file_handle);
  1305.        return -1;
  1306.    }
  1307.  
  1308.    if (fgets(buffer, 80, config_file_handle) == -1) {
  1309.        fclose(config_file_handle);
  1310.        return -1;
  1311.    }
  1312.    direct_connect = (toupper(subchr(buffer, 0)) == 'D');
  1313.  
  1314.    fclose(config_file_handle);
  1315.    return 1;
  1316.  
  1317. }
  1318.  
  1319. //////////////////////////////////////////////////////////////////////////////
  1320.  
  1321. check_directories() {
  1322.  
  1323.    str s[80];
  1324.    int i, a;
  1325.  
  1326.    // first remove trailing slashes
  1327.  
  1328.    s = host_uploads;
  1329.    i = strlen(s);
  1330.    if (i > 0)
  1331.        if (subchr(s, i - 1) == '\' || subchr(s, i - 1) == '/')
  1332.            setchr(s, i - 1, 0);
  1333.    if (s && !(strlen(s) == 2 && subchr(s, 1) == ':')) {
  1334.        a = fileattr(s);
  1335.        if (a == -1 || !(a & 16))
  1336.            return 0;                  // not a directory or doesn't exist
  1337.    }
  1338.  
  1339.    s = host_downloads;
  1340.    i = strlen(s);
  1341.    if (i > 0)
  1342.        if (subchr(s, i - 1) == '\' || subchr(s, i - 1) == '/')
  1343.            setchr(s, i - 1, 0);
  1344.    if (s && !(strlen(s) == 2 && subchr(s, 1) == ':')) {
  1345.        a = fileattr(s);
  1346.        if (a == -1 || !(a & 16))
  1347.            return 0;                  // not a directory or doesn't exist
  1348.    }
  1349.  
  1350.    return 1;
  1351.  
  1352. }
  1353.  
  1354. //////////////////////////////////////////////////////////////////////////////
  1355. // returns TRUE if passed filespec is just a filename. Also handles the
  1356. // forward slash as a path separator.
  1357.  
  1358. just_filename(str filespec) {
  1359.  
  1360.    int slash, space;
  1361.  
  1362.    if (strpos(filespec, ":", 0) != -1)
  1363.        return 0;
  1364.    if (strpos(filespec, "\", 0) != -1)
  1365.        return 0;
  1366.    if ((slash = strpos(filespec, "/")) == -1)
  1367.        return 1;
  1368.  
  1369.    space = strpos(filespec, " ");
  1370.    if (space == -1)
  1371.        return 0;
  1372.    if (space < slash)
  1373.        return 1;
  1374.  
  1375.    return 0;
  1376.  
  1377. }
  1378.  
  1379. // End of DBBS...
  1380.