home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / LO241SRV.ZIP / LSETUP4.C < prev    next >
Text File  |  1998-05-17  |  63KB  |  1,709 lines

  1.  
  2. // LoraBBS Version 2.41 Free Edition
  3. // Copyright (C) 1987-98 Marco Maccaferri
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation; either version 2 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <io.h>
  23. #include <share.h>
  24. #include <fcntl.h>
  25. #include <ctype.h>
  26. #include <sys\stat.h>
  27.  
  28. #include "lsetup.h"
  29. #include "lprot.h"
  30.  
  31. #include <cxl\cxlvid.h>
  32. #include <cxl\cxlwin.h>
  33. #include <cxl\cxlstr.h>
  34. #include <cxl\cxlkey.h>
  35.  
  36. extern struct _configuration config;
  37.  
  38. void start_update (void);
  39. void stop_update (void);
  40. char *get_priv_text (int);
  41. void create_path (char *);
  42. int sh_open (char *file, int shmode, int omode, int fmode);
  43. void update_message (void);
  44. long window_get_flags (int y, int x, int type, long f);
  45. int winputs (int wy, int wx, char *stri, char *fmt, int mode, char pad, int fieldattr, int textattr);
  46.  
  47. static void edit_single_area (struct _sys *);
  48. static void select_area_list (int, struct _sys *);
  49.  
  50. void bbs_newusers ()
  51. {
  52.    int wh, i = 1;
  53.    char string[128];
  54.  
  55.    wh = wopen (4, 5, 21, 69, 1, LCYAN|_BLACK, CYAN|_BLACK);
  56.    wactiv (wh);
  57.    wshadow (DGREY|_BLACK);
  58.    wtitle (" New users ", TRIGHT, YELLOW|_BLUE);
  59.  
  60.    do {
  61.       stop_update ();
  62.       wclear ();
  63.  
  64.       wmenubegc ();
  65.       wmenuitem ( 1,  1," New user sec. level ", 0, 1, 0, NULL, 0, 0);
  66.       wmenuitem ( 2,  1," New user A flags    ", 0, 2, 0, NULL, 0, 0);
  67.       wmenuitem ( 3,  1," New user B flags    ", 0, 3, 0, NULL, 0, 0);
  68.       wmenuitem ( 4,  1," New user C flags    ", 0, 4, 0, NULL, 0, 0);
  69.       wmenuitem ( 5,  1," New user D flags    ", 0, 5, 0, NULL, 0, 0);
  70.       wmenuitem ( 6,  1," Ask birthdate          ", 0, 6, 0, NULL, 0, 0);
  71.       wmenuitem ( 6, 32," Ask voice phone number ", 0, 7, 0, NULL, 0, 0);
  72.       wmenuitem ( 7,  1," Ask data phone number  ", 0, 8, 0, NULL, 0, 0);
  73.       wmenuitem ( 7, 32," Ask IBM character set  ", 0, 9, 0, NULL, 0, 0);
  74.       wmenuitem ( 8,  1," Ask alias name         ", 0, 20, 0, NULL, 0, 0);
  75.       wmenuitem ( 8, 32," Ask default protocol   ", 0, 21, 0, NULL, 0, 0);
  76.       wmenuitem ( 9,  1," Ask default packer     ", 0, 22, 0, NULL, 0, 0);
  77.       wmenuitem ( 9, 32," FileBOX default        ", 0, 23, 0, NULL, 0, 0);
  78.       wmenuitem (10,  1," More prompts           ", 0, 10, 0, NULL, 0, 0);
  79.       wmenuitem (10, 32," Mail check             ", 0, 12, 0, NULL, 0, 0);
  80.       wmenuitem (11,  1," New files check        ", 0, 11, 0, NULL, 0, 0);
  81.       wmenuitem (11, 32," Screen clears          ", 0, 13, 0, NULL, 0, 0);
  82.       wmenuitem (12,  1," Hotkeys                ", 0, 14, 0, NULL, 0, 0);
  83.       wmenuitem (12, 32," Ansi graphics          ", 0, 15, 0, NULL, 0, 0);
  84.       wmenuitem (13,  1," Avatar graphics        ", 0, 16, 0, NULL, 0, 0);
  85.       wmenuitem (13, 32," Full screen editor     ", 0, 17, 0, NULL, 0, 0);
  86.       wmenuitem (14,  1," Rookie calls           ", 0, 18, 0, NULL, 0, 0);
  87.       wmenuitem (14, 32," Random birthdate check ", 0, 19, 0, NULL, 0, 0);
  88.       wmenuend (i, M_OMNI|M_SAVE, 0, 0, LGREY|_BLACK, LGREY|_BLACK, LGREY|_BLACK, BLUE|_LGREY);
  89.  
  90.       wprints ( 1, 22, CYAN|_BLACK, get_priv_text (config.logon_level));
  91.       wprints ( 2, 23, CYAN|_BLACK, get_flagA_text ((config.logon_flags >> 24) & 0xFF));
  92.       wprints ( 3, 23, CYAN|_BLACK, get_flagB_text ((config.logon_flags >> 16) & 0xFF));
  93.       wprints ( 4, 23, CYAN|_BLACK, get_flagC_text ((config.logon_flags >> 8) & 0xFF));
  94.       wprints ( 5, 23, CYAN|_BLACK, get_flagD_text (config.logon_flags & 0xFF));
  95.       wprints ( 6, 26, CYAN|_BLACK, config.birthdate ? "Yes" : "No");
  96.       wprints ( 6, 57, CYAN|_BLACK, config.voicephone ? "Yes" : "No");
  97.       wprints ( 7, 26, CYAN|_BLACK, config.dataphone ? "Yes" : "No");
  98.       wprints ( 7, 57, CYAN|_BLACK, config.ibmset ? "Yes" : "No");
  99.       wprints ( 8, 26, CYAN|_BLACK, config.ask_alias ? "Yes" : "No");
  100.       wprints ( 8, 57, CYAN|_BLACK, config.ask_protocol ? "Yes" : "No");
  101.       wprints ( 9, 26, CYAN|_BLACK, config.ask_packer ? "Yes" : "No");
  102.       wprints ( 9, 57, CYAN|_BLACK, config.filebox ? "Yes" : "No");
  103.       wprints (10, 26, CYAN|_BLACK, config.moreprompt == 1 ? "Yes" : (config.moreprompt == 2 ? "Ask" : "No"));
  104.       wprints (10, 57, CYAN|_BLACK, config.mailcheck == 1 ? "Yes" : (config.mailcheck == 2 ? "Ask" : "No"));
  105.       wprints (11, 26, CYAN|_BLACK, config.newfilescheck == 1 ? "Yes" : (config.newfilescheck == 2 ? "Ask" : "No"));
  106.       wprints (11, 57, CYAN|_BLACK, config.screenclears == 1 ? "Yes" : (config.screenclears == 2 ? "Ask" : "No"));
  107.       wprints (12, 26, CYAN|_BLACK, config.hotkeys == 1 ? "Yes" : (config.hotkeys == 2 ? "Ask" : "No"));
  108.       wprints (12, 57, CYAN|_BLACK, config.ansigraphics == 1 ? "Yes" : (config.ansigraphics == 2 ? "Ask" : "No"));
  109.       wprints (13, 26, CYAN|_BLACK, config.avatargraphics == 1 ? "Yes" : (config.avatargraphics == 2 ? "Ask" : "No"));
  110.       wprints (13, 57, CYAN|_BLACK, config.fullscrnedit == 1 ? "Yes" : (config.fullscrnedit == 2 ? "Ask" : "No"));
  111.       sprintf (string, "%d", config.rookie_calls);
  112.       wprints (14, 26, CYAN|_BLACK, string);
  113.       wprints (14, 57, CYAN|_BLACK, config.random_birth ? "Yes" : "No");
  114.  
  115.       start_update ();
  116.       i = wmenuget ();
  117.  
  118.       switch (i) {
  119.          case 1:
  120.             config.logon_level = select_level (config.logon_level, 37, 4);
  121.             break;
  122.  
  123.          case 2:
  124.             config.logon_flags = window_get_flags (3, 35, 1, config.logon_flags);
  125.             break;
  126.  
  127.          case 3:
  128.             config.logon_flags = window_get_flags (3, 35, 2, config.logon_flags);
  129.             break;
  130.  
  131.          case 4:
  132.             config.logon_flags = window_get_flags (3, 35, 3, config.logon_flags);
  133.             break;
  134.  
  135.          case 5:
  136.             config.logon_flags = window_get_flags (3, 35, 4, config.logon_flags);
  137.             break;
  138.  
  139.          case 6:
  140.             config.birthdate ^= 1;
  141.             break;
  142.  
  143.          case 7:
  144.             config.voicephone ^= 1;
  145.             break;
  146.  
  147.          case 8:
  148.             config.dataphone ^= 1;
  149.             break;
  150.  
  151.          case 9:
  152.             config.ibmset ^= 1;
  153.             break;
  154.  
  155.          case 10:
  156.             if ( ++config.moreprompt == 3)
  157.                config.moreprompt = 0;
  158.             break;
  159.  
  160.          case 11:
  161.             if ( ++config.newfilescheck == 3)
  162.                config.newfilescheck = 0;
  163.             break;
  164.  
  165.          case 12:
  166.             if ( ++config.mailcheck == 3)
  167.                config.mailcheck = 0;
  168.             break;
  169.  
  170.          case 13:
  171.             if ( ++config.screenclears == 3)
  172.                config.screenclears = 0;
  173.             break;
  174.  
  175.          case 14:
  176.             if ( ++config.hotkeys == 3)
  177.                config.hotkeys = 0;
  178.             break;
  179.  
  180.          case 15:
  181.             if ( ++config.ansigraphics == 3)
  182.                config.ansigraphics = 0;
  183.             break;
  184.  
  185.          case 16:
  186.             if ( ++config.avatargraphics == 3)
  187.                config.avatargraphics = 0;
  188.             break;
  189.  
  190.          case 17:
  191.             if ( ++config.fullscrnedit == 3)
  192.                config.fullscrnedit = 0;
  193.             break;
  194.  
  195.          case 18:
  196.             sprintf (string, "%d", config.rookie_calls);
  197.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  198.             winpdef (14, 26, string, "?????", 0, 1, NULL, 0);
  199.             if (winpread () != W_ESCPRESS)
  200.                config.rookie_calls = atoi (strbtrim (string));
  201.             break;
  202.  
  203.          case 19:
  204.             config.random_birth ^= 1;
  205.             break;
  206.  
  207.          case 20:
  208.             config.ask_alias ^= 1;
  209.             break;
  210.  
  211.          case 21:
  212.             config.ask_protocol ^= 1;
  213.             break;
  214.  
  215.          case 22:
  216.             config.ask_packer ^= 1;
  217.             break;
  218.  
  219.          case 23:
  220.             config.filebox ^= 1;
  221.             break;
  222.       }
  223.  
  224.       hidecur ();
  225.  
  226.    } while (i != -1);
  227.  
  228.    wclose ();
  229. }
  230.  
  231. void bbs_general ()
  232. {
  233.    int wh, i = 1;
  234.    char string[128];
  235.  
  236.    wh = wopen (2, 4, 23, 76, 1, LCYAN|_BLACK, CYAN|_BLACK);
  237.    wactiv (wh);
  238.    wshadow (DGREY|_BLACK);
  239.    wtitle (" General options ", TRIGHT, YELLOW|_BLUE);
  240.  
  241.    do {
  242.       stop_update ();
  243.       wclear ();
  244.  
  245.       wmenubegc ();
  246.       wmenuitem (1, 1," Users file       ", 0, 1, 0, NULL, 0, 0);
  247.       wmenuitem (2, 1," Menu dir         ", 0, 2, 0, NULL, 0, 0);
  248.       wmenuitem (3, 1," General text dir ", 0, 3, 0, NULL, 0, 0);
  249.       wmenuitem (4, 1," Full scr. editor ", 0, 4, 0, NULL, 0, 0);
  250.       wmenuitem (5, 1," Quote header     ", 0, 25, 0, NULL, 0, 0);
  251.       wmenuitem (6, 1," Upload check     ", 0, 28, 0, NULL, 0, 0);
  252.       wmenuitem (8, 1," ANSI at logon      ", 0, 5, 0, NULL, 0, 0);
  253.       wmenuitem (8, 30," Aftercaller exit   ", 0, 9, 0, NULL, 0, 0);
  254.       wmenuitem (9, 1," Areachange keys    ", 0, 10, 0, NULL, 0, 0);
  255.       wmenuitem (9, 30," Date format        ", 0, 11, 0, NULL, 0, 0);
  256.       wmenuitem (10, 1," Snoop on-line user ", 0, 8, 0, NULL, 0, 0);
  257.       wmenuitem (10, 30," Time format        ", 0, 12, 0, NULL, 0, 0);
  258.       wmenuitem (11, 1," Download counter   ", 0, 13, 0, NULL, 0, 0);
  259.       wmenuitem (11, 30," Uploader name      ", 0, 14, 0, NULL, 0, 0);
  260.       wmenuitem (12, 1," └ Counter limits   ", 0, 15, 0, NULL, 0, 0);
  261.       wmenuitem (12, 30," Login check city   ", 0, 16, 0, NULL, 0, 0);
  262.       wmenuitem (13, 1, " Inactivity timeout ", 0, 17, 0, NULL, 0, 0);
  263.       wmenuitem (13, 30, " IEMSI logins       ", 0, 18, 0, NULL, 0, 0);
  264.       wmenuitem (14, 1, " Show missing files ", 0, 19, 0, NULL, 0, 0);
  265.       wmenuitem (14, 30, " ZModem protocol    ", 0, 20, 0, NULL, 0, 0);
  266.       wmenuitem (15, 1, " XModem protocol    ", 0, 21, 0, NULL, 0, 0);
  267.       wmenuitem (15, 30, " 1K-XModem protocol ", 0, 22, 0, NULL, 0, 0);
  268.       wmenuitem (16, 1, " SEAlink protocol   ", 0, 23, 0, NULL, 0, 0);
  269.       wmenuitem (16, 30, " Quote string       ", 0, 24, 0, NULL, 0, 0);
  270.       wmenuitem (17, 1, " Min. upload space  ", 0, 26, 0, NULL, 0, 0);
  271.       wmenuitem (17, 30, " Input date format  ", 0, 27, 0, NULL, 0, 0);
  272.       wmenuitem (18, 1, " CD-ROM Downl. swap ", 0, 29,0, NULL, 0, 0);
  273.  
  274.       wmenuend (i, M_OMNI|M_SAVE, 0, 0, LGREY|_BLACK, LGREY|_BLACK, LGREY|_BLACK, BLUE|_LGREY);
  275.  
  276.       wprints (1, 20, CYAN|_BLACK, config.user_file);
  277.       wprints (2, 20, CYAN|_BLACK, config.menu_path);
  278.       wprints (3, 20, CYAN|_BLACK, config.glob_text_path);
  279.       wprints (4, 20, CYAN|_BLACK, config.external_editor);
  280.       wprints (5, 20, CYAN|_BLACK, config.quote_header);
  281.       wprints (6, 20, CYAN|_BLACK, config.upload_check);
  282.       if (config.ansilogon == 0)
  283.          wprints (8, 22, CYAN|_BLACK, "No");
  284.       else if (config.ansilogon == 1)
  285.          wprints (8, 22, CYAN|_BLACK, "Auto");
  286.       else if (config.ansilogon == 2)
  287.          wprints (8, 22, CYAN|_BLACK, "Ask");
  288.       else if (config.ansilogon == 3)
  289.          wprints (8, 22, CYAN|_BLACK, "Yes");
  290.       wprints (10, 22, CYAN|_BLACK, config.snooping ? "Yes" : "No");
  291.       sprintf (string, "%d", config.aftercaller_exit);
  292.       wprints (8, 51, CYAN|_BLACK, string);
  293.       wprints (9, 22, CYAN|_BLACK, config.areachange_key);
  294.       wprints (9, 51, CYAN|_BLACK, config.dateformat);
  295.       wprints (10, 51, CYAN|_BLACK, config.timeformat);
  296.       wprints (11, 22, CYAN|_BLACK, config.keep_dl_count ? "Yes" : "No");
  297.       wprints (11, 51, CYAN|_BLACK, config.put_uploader ? "Yes" : "No");
  298.       wprints (12, 22, CYAN|_BLACK, config.dl_counter_limits);
  299.       wprints (12, 51, CYAN|_BLACK, config.check_city ? "Yes" : "No");
  300.       sprintf (string, "%d", config.inactivity_timeout);
  301.       wprints (13, 22, CYAN|_BLACK, string);
  302.       wprints (13, 51, CYAN|_BLACK, config.use_iemsi ? "Yes" : "No");
  303.       wprints (14, 22, CYAN|_BLACK, config.show_missing ? "Yes" : "No");
  304.       wprints (14, 51, CYAN|_BLACK, config.prot_zmodem ? "Yes" : "No");
  305.       wprints (15, 22, CYAN|_BLACK, config.prot_xmodem ? "Yes" : "No");
  306.       wprints (15, 51, CYAN|_BLACK, config.prot_1kxmodem ? "Yes" : "No");
  307.       wprints (16, 22, CYAN|_BLACK, config.prot_sealink ? "Yes" : "No");
  308.       wprints (16, 51, CYAN|_BLACK, config.quote_string);
  309.       sprintf (string, "%d", config.ul_free_space);
  310.       wprints (17, 22, CYAN|_BLACK, string);
  311.       if (config.inp_dateformat == 0)
  312.          wprints (17, 51, CYAN|_BLACK, "DD-MM-YY");
  313.       else if (config.inp_dateformat == 1)
  314.          wprints (17, 51, CYAN|_BLACK, "MM-DD-YY");
  315.       else if (config.inp_dateformat == 2)
  316.          wprints (17, 51, CYAN|_BLACK, "YY-MM-DD");
  317.       wprints (18, 22, CYAN|_BLACK, config.cdrom_swap ? "Yes" : "No");
  318.  
  319.  
  320.       start_update ();
  321.       i = wmenuget ();
  322.  
  323.       switch (i) {
  324.          case 1:
  325.             strcpy (string, config.user_file);
  326.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  327.             winpdef (1, 20, string, "??????????????????????????????????????", 0, 2, NULL, 0);
  328.             if (winpread () != W_ESCPRESS)
  329.                strcpy (config.user_file, strbtrim (string));
  330.             break;
  331.  
  332.          case 2:
  333.             strcpy (string, config.menu_path);
  334.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  335.             winpdef (2, 20, string, "??????????????????????????????????????", 0, 2, NULL, 0);
  336.             if (winpread () != W_ESCPRESS) {
  337.                strcpy (config.menu_path, strbtrim (string));
  338.                if (config.menu_path[0] && config.menu_path[strlen (config.menu_path) - 1] != '\\')
  339.                   strcat (config.menu_path, "\\");
  340.                create_path (config.menu_path);
  341.             }
  342.             break;
  343.  
  344.          case 3:
  345.             strcpy (string, config.glob_text_path);
  346.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  347.             winpdef (3, 20, string, "??????????????????????????????????????", 0, 2, NULL, 0);
  348.             if (winpread () != W_ESCPRESS) {
  349.                strcpy (config.glob_text_path, strbtrim (string));
  350.                if (config.glob_text_path[0] && config.glob_text_path[strlen (config.glob_text_path) - 1] != '\\')
  351.                   strcat (config.glob_text_path, "\\");
  352.                create_path (config.glob_text_path);
  353.             }
  354.             break;
  355.  
  356.          case 4:
  357.             strcpy (string, config.external_editor);
  358.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  359.             winpdef (4, 20, string, "?????????????????????????????????????????????????", 0, 2, NULL, 0);
  360.             if (winpread () != W_ESCPRESS)
  361.                strcpy (config.external_editor, strbtrim (string));
  362.             break;
  363.  
  364.          case 25:
  365.             strcpy (string, config.quote_header);
  366.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  367.             winpdef (5, 20, string, "?????????????????????????????????????????????????", 0, 2, NULL, 0);
  368.             if (winpread () != W_ESCPRESS)
  369.                strcpy (config.quote_header, strtrim (string));
  370.             break;
  371.  
  372.          case 28:
  373.             strcpy (string, config.upload_check);
  374.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  375.             winpdef (6, 20, string, "?????????????????????????????????????????????????", 0, 2, NULL, 0);
  376.             if (winpread () != W_ESCPRESS)
  377.                strcpy (config.upload_check, strtrim (string));
  378.             break;
  379.  
  380.          case 5:
  381.             if (config.ansilogon == 1)
  382.                config.ansilogon = 3;
  383.             else if (config.ansilogon == 3)
  384.                config.ansilogon = 0;
  385.             else if (config.ansilogon == 0)
  386.                config.ansilogon = 2;
  387.             else if (config.ansilogon == 2)
  388.                config.ansilogon = 1;
  389.             break;
  390.  
  391.          case 8:
  392.             config.snooping ^= 1;
  393.             break;
  394.  
  395.          case 9:
  396.             sprintf (string, "%d", config.aftercaller_exit);
  397.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  398.             winpdef (8, 51, string, "???", 0, 1, NULL, 0);
  399.             if (winpread () != W_ESCPRESS)
  400.                config.aftercaller_exit = atoi (string);
  401.             break;
  402.  
  403.          case 10:
  404.             strcpy (string, config.areachange_key);
  405.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  406.             winpdef (9, 22, string, "???", 0, 1, NULL, 0);
  407.             if (winpread () != W_ESCPRESS)
  408.                strcpy (config.areachange_key, string);
  409.             break;
  410.  
  411.          case 11:
  412.             strcpy (string, config.dateformat);
  413.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  414.             winpdef (9, 51, string, "??????????????????", 0, 1, NULL, 0);
  415.             if (winpread () != W_ESCPRESS)
  416.                strcpy (config.dateformat, strbtrim (string));
  417.             break;
  418.  
  419.          case 12:
  420.             strcpy (string, config.timeformat);
  421.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  422.             winpdef (10, 51, string, "??????????????????", 0, 1, NULL, 0);
  423.             if (winpread () != W_ESCPRESS)
  424.                strcpy (config.timeformat, strbtrim (string));
  425.             break;
  426.  
  427.          case 13:
  428.             config.keep_dl_count ^= 1;
  429.             break;
  430.  
  431.          case 14:
  432.             config.put_uploader ^= 1;
  433.             break;
  434.  
  435.          case 15:
  436.             strcpy (string, config.dl_counter_limits);
  437.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  438.             winpdef (12, 22, string, "??", 0, 1, NULL, 0);
  439.             if (winpread () != W_ESCPRESS)
  440.                strcpy (config.dl_counter_limits, strbtrim (string));
  441.             break;
  442.  
  443.          case 16:
  444.             config.check_city ^= 1;
  445.             break;
  446.  
  447.          case 17:
  448.             sprintf (string, "%d", config.inactivity_timeout);
  449.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  450.             winpdef (13, 22, string, "???", 0, 1, NULL, 0);
  451.             if (winpread () != W_ESCPRESS)
  452.                config.inactivity_timeout = atoi (strbtrim (string));
  453.             break;
  454.  
  455.          case 18:
  456.             config.use_iemsi ^= 1;
  457.             break;
  458.  
  459.          case 19:
  460.             config.show_missing ^= 1;
  461.             break;
  462.  
  463.          case 20:
  464.             config.prot_zmodem ^= 1;
  465.             break;
  466.  
  467.          case 21:
  468.             config.prot_xmodem ^= 1;
  469.             break;
  470.  
  471.          case 22:
  472.             config.prot_1kxmodem ^= 1;
  473.             break;
  474.  
  475.          case 23:
  476.             config.prot_sealink ^= 1;
  477.             break;
  478.  
  479.          case 24:
  480.             strcpy (string, config.quote_string);
  481.             if (winputs (16, 51, string, "?????", 1, '▒', BLUE|_GREEN, BLUE|_GREEN) != W_ESCPRESS)
  482.                strcpy (config.quote_string, string);
  483.             break;
  484.  
  485.          case 26:
  486.             sprintf (string, "%d", config.ul_free_space);
  487.             if (winputs (17, 22, string, "?????", 1, ' ', BLUE|_GREEN, BLUE|_GREEN) != W_ESCPRESS)
  488.                config.ul_free_space = atoi (strbtrim (string));
  489.             break;
  490.  
  491.          case 27:
  492.             if (++config.inp_dateformat == 3)
  493.                config.inp_dateformat = 0;
  494.             break;
  495.  
  496.          case 29:
  497.             config.cdrom_swap ^= 1;
  498.             break;      }
  499.  
  500.       hidecur ();
  501.    } while (i != -1);
  502.  
  503.    wclose ();
  504. }
  505.  
  506. void bbs_message ()
  507. {
  508.    int fd, fdi, fdx, wh, wh1, i = 1, saved;
  509.    char string[128], filename[80];
  510.    long pos;
  511.    struct _sys sys, bsys;
  512.    struct _sys_idx sysidx;
  513.  
  514.    sprintf (string, "%sSYSMSG.IDX", config.sys_path);
  515.    fd = sh_open (string, SH_DENYWR, O_RDWR|O_BINARY|O_CREAT, S_IREAD|S_IWRITE);
  516.    if (fd == -1)
  517.       return;
  518.    close (fd);
  519.  
  520.    sprintf (string, "%sSYSMSG.DAT", config.sys_path);
  521.    fd = sh_open (string, SH_DENYWR, O_RDWR|O_BINARY|O_CREAT, S_IREAD|S_IWRITE);
  522.    if (fd == -1)
  523.       return;
  524.    memset ((char *)&sys, 0, SIZEOF_MSGAREA);
  525.    read (fd, (char *)&sys, SIZEOF_MSGAREA);
  526.  
  527.    gotoxy_ (24, 1);
  528.    clreol_ ();
  529.    prints (24, 1, LGREY|_BLACK, "PgUp/PgDn-Next/Previous  E-Edit  A-Add New Area  C-Copy  L-List  D-Delete");
  530.    prints (24, 1, YELLOW|_BLACK, "PgUp/PgDn");
  531.    prints (24, 26, YELLOW|_BLACK, "E");
  532.    prints (24, 34, YELLOW|_BLACK, "A");
  533.    prints (24, 50, YELLOW|_BLACK, "C");
  534.    prints (24, 58, YELLOW|_BLACK, "L");
  535.    prints (24, 66, YELLOW|_BLACK, "D");
  536.  
  537.     wh = wopen (1, 0, 22, 77, 1, LCYAN|_BLACK, CYAN|_BLACK);
  538.     wactiv (wh);
  539.     wshadow (DGREY|_BLACK);
  540.     wtitle (" Message areas ", TRIGHT, YELLOW|_BLUE);
  541.  
  542.     do {
  543.         stop_update ();
  544.         wclear ();
  545.  
  546.         wprints (1, 1, LGREY|_BLACK," Number       ");
  547.         wprints (1, 28, LGREY|_BLACK," QWK Name     ");
  548.         wprints (2, 1, LGREY|_BLACK," Name         ");
  549.         wprints (3, 1, LGREY|_BLACK," Type         ");
  550.         wprints (3, 28, LGREY|_BLACK," Echo-Tag     ");
  551.         wprints (4, 1, LGREY|_BLACK," Flags        ");
  552.         wprints (5, 1, LGREY|_BLACK," Storage      ");
  553.         wprints (4, 28, LGREY|_BLACK," Group        ");
  554.         wprints (6, 1, LGREY|_BLACK," Path/Board   ");
  555.         wprints (7, 1, LGREY|_BLACK," Aka          ");
  556.         wprints (8, 1, LGREY|_BLACK," Origin       ");
  557.         wprints (9, 1, LGREY|_BLACK," Max messages ");
  558.         wprints (10, 22, LGREY|_BLACK, "days");
  559.         wprints (10, 1, LGREY|_BLACK," Message age  ");
  560.         wprints (10, 28, LGREY|_BLACK," Age received ");
  561.         wprints (10, 49, LGREY|_BLACK, "days");
  562.         wprints (11, 1, LGREY|_BLACK," Read level   ");
  563.         wprints (12, 1, LGREY|_BLACK," A Flag       ");
  564.         wprints (13, 1, LGREY|_BLACK," B Flag       ");
  565.         wprints (14, 1, LGREY|_BLACK," C Flag       ");
  566.         wprints (15, 1, LGREY|_BLACK," D Flag       ");
  567.         wprints (11, 28, LGREY|_BLACK," Write level  ");
  568.         wprints (12, 28, LGREY|_BLACK," A Flag       ");
  569.         wprints (13, 28, LGREY|_BLACK," B Flag       ");
  570.         wprints (14, 28, LGREY|_BLACK," C Flag       ");
  571.         wprints (15, 28, LGREY|_BLACK," D Flag       ");
  572.         wprints (11, 55, LGREY|_BLACK," Afx level ");
  573.         wprints (12, 55, LGREY|_BLACK," A Flag    ");
  574.         wprints (13, 55, LGREY|_BLACK," B Flag    ");
  575.         wprints (14, 55, LGREY|_BLACK," C Flag    ");
  576.         wprints (15, 55, LGREY|_BLACK," D Flag    ");
  577.         wprints (16, 1, LGREY|_BLACK," Forward to:");
  578.         wprints (17, 1, LGREY|_BLACK," 1 ");
  579.         wprints (18, 1, LGREY|_BLACK," 2 ");
  580.         wprints (19, 1, LGREY|_BLACK," 3 ");
  581.  
  582.         sprintf (string, "%d", sys.msg_num);
  583.         wprints (1, 16, CYAN|_BLACK, string);
  584.  
  585.         wprints (1, 43, CYAN|_BLACK, sys.qwk_name);
  586.  
  587.         sys.msg_name[55] = '\0';
  588.         wprints (2, 16, CYAN|_BLACK, sys.msg_name);
  589.  
  590.         if (sys.netmail)
  591.             wprints (3, 16, CYAN|_BLACK, "Netmail");
  592.         else if (sys.echomail)
  593.             wprints (3, 16, CYAN|_BLACK, "Echomail");
  594.         else if (sys.internet_mail)
  595.             wprints (3, 16, CYAN|_BLACK, "Internet");
  596.         else
  597.             wprints (3, 16, CYAN|_BLACK, "Local");
  598.  
  599.         wprints (3, 43, CYAN|_BLACK, sys.echotag);
  600.  
  601.         strcpy (string, "......");  // P=Public, V=Private,
  602.                                           // A=Allow alias, G=Group restricted,
  603.                                           // T=Tiny seen-by
  604.  
  605.         if (sys.public)
  606.             string[0] = 'P';
  607.         if (sys.private)
  608.             string[1] = 'V';
  609.         if (sys.anon_ok)
  610.             string[2] = 'A';
  611.         if (sys.msg_restricted)
  612.             string[3] = 'G';
  613.         if (sys.sendonly)
  614.             string[4] = 'S';
  615.         if (sys.receiveonly)
  616.             string[5] = 'R';
  617.         wprints (4, 16, CYAN|_BLACK, string);
  618.  
  619.         if (sys.passthrough)
  620.             wprints (5, 16, CYAN|_BLACK, "Passthrough");
  621.         else if (sys.quick_board)
  622.             wprints (5, 16, CYAN|_BLACK, "QuickBBS");
  623.         else if (sys.gold_board)
  624.             wprints (5, 16, CYAN|_BLACK, "GoldBase");
  625.         else if (sys.pip_board)
  626.             wprints (5, 16, CYAN|_BLACK, "Pip-Base");
  627.         else if (sys.squish)
  628.             wprints (5, 16, CYAN|_BLACK, "Squish");
  629.         else
  630.             wprints (5, 16, CYAN|_BLACK, "Fido");
  631.  
  632.         sprintf (string, "%d", sys.msg_sig);
  633.         wprints (4, 43, CYAN|_BLACK, string);
  634.  
  635.         if (sys.quick_board)
  636.             sprintf (string, "%d", sys.quick_board);
  637.         else if (sys.gold_board)
  638.             sprintf (string, "%d", sys.gold_board);
  639.         else if (sys.pip_board)
  640.             sprintf (string, "%d", sys.pip_board);
  641.         else
  642.             strcpy (string, sys.msg_path);
  643.         wprints (6, 16, CYAN|_BLACK, string);
  644.  
  645.         sprintf (string, "%d:%d/%d.%d", config.alias[sys.use_alias].zone, config.alias[sys.use_alias].net, config.alias[sys.use_alias].node, config.alias[sys.use_alias].point);
  646.         wprints (7, 16, CYAN|_BLACK, string);
  647.  
  648.         wprints (8, 16, CYAN|_BLACK, sys.origin);
  649.  
  650.         sprintf (string, "%d", sys.max_msgs);
  651.         wprints (9, 16, CYAN|_BLACK, string);
  652.  
  653.         sprintf (string, "%d", sys.max_age);
  654.         wprints (10, 16, CYAN|_BLACK, string);
  655.  
  656.         sprintf (string, "%d", sys.age_rcvd);
  657.         wprints (10, 43, CYAN|_BLACK, string);
  658.  
  659.         wprints (11, 15, CYAN|_BLACK, get_priv_text (sys.msg_priv));
  660.         wprints (12, 16, CYAN|_BLACK, get_flagA_text ((sys.msg_flags >> 24) & 0xFF));
  661.         wprints (13, 16, CYAN|_BLACK, get_flagB_text ((sys.msg_flags >> 16) & 0xFF));
  662.         wprints (14, 16, CYAN|_BLACK, get_flagC_text ((sys.msg_flags >> 8) & 0xFF));
  663.         wprints (15, 16, CYAN|_BLACK, get_flagD_text (sys.msg_flags & 0xFF));
  664.  
  665.         wprints (11, 42, CYAN|_BLACK, get_priv_text (sys.write_priv));
  666.         wprints (12, 43, CYAN|_BLACK, get_flagA_text ((sys.write_flags >> 24) & 0xFF));
  667.         wprints (13, 43, CYAN|_BLACK, get_flagB_text ((sys.write_flags >> 16) & 0xFF));
  668.         wprints (14, 43, CYAN|_BLACK, get_flagC_text ((sys.write_flags >> 8) & 0xFF));
  669.         wprints (15, 43, CYAN|_BLACK, get_flagD_text (sys.write_flags & 0xFF));
  670.  
  671.         sprintf (string, "%d", sys.areafix);
  672.         wprints (11, 67, CYAN|_BLACK, string);
  673.         wprints (12, 67, CYAN|_BLACK, get_flagA_text ((sys.afx_flags >> 24) & 0xFF));
  674.         wprints (13, 67, CYAN|_BLACK, get_flagB_text ((sys.afx_flags >> 16) & 0xFF));
  675.         wprints (14, 67, CYAN|_BLACK, get_flagC_text ((sys.afx_flags >> 8) & 0xFF));
  676.         wprints (15, 67, CYAN|_BLACK, get_flagD_text (sys.afx_flags & 0xFF));
  677.  
  678.         wprints (17, 4, CYAN|_BLACK, sys.forward1);
  679.         wprints (18, 4, CYAN|_BLACK, sys.forward2);
  680.         wprints (19, 4, CYAN|_BLACK, sys.forward3);
  681.         start_update ();
  682.  
  683.         i = getxch ();
  684.         if ( (i & 0xFF) != 0 )
  685.             i &= 0xFF;
  686.  
  687.         switch (i) {
  688.             // PgDn
  689.             case 0x5100:
  690.                 read (fd, (char *)&sys, SIZEOF_MSGAREA);
  691.                 break;
  692.  
  693.             // PgUp
  694.             case 0x4900:
  695.                 if (tell (fd) > SIZEOF_MSGAREA) {
  696.                     lseek (fd, -2L * SIZEOF_MSGAREA, SEEK_CUR);
  697.                     read (fd, (char *)&sys, SIZEOF_MSGAREA);
  698.                 }
  699.                 break;
  700.  
  701.             // E Edit
  702.             case 'E':
  703.             case 'e':
  704.                 saved = sys.msg_num;
  705.                 strcpy (string, sys.qwk_name);
  706.  
  707.                 edit_single_area (&sys);
  708.  
  709.                 lseek (fd, -1L * SIZEOF_MSGAREA, SEEK_CUR);
  710.                 write (fd, (char *)&sys, SIZEOF_MSGAREA);
  711.  
  712.                 if (saved != sys.msg_num || strcmp (string, sys.qwk_name)) {
  713.                     pos = tell (fd) - (long)SIZEOF_MSGAREA;
  714.                     close (fd);
  715.  
  716.                     update_message ();
  717.  
  718.                     sprintf (string, "%sSYSMSG.IDX", config.sys_path);
  719.                     while ((fdx = sh_open (string, SH_DENYRD, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  720.                         ;
  721.                     sprintf (filename, "%sSYSMSG.BAK", config.sys_path);
  722.                     while ((fdi = sh_open (filename, SH_DENYRW, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  723.                         ;
  724.                     sprintf (string, "%sSYSMSG.DAT", config.sys_path);
  725.                     while ((fd = sh_open (string, SH_DENYRD, O_RDWR|O_CREAT|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  726.                         ;
  727.                     saved = 0;
  728.  
  729.                     while (read (fd, (char *)&bsys, SIZEOF_MSGAREA) == SIZEOF_MSGAREA) {
  730.                         if (!saved && bsys.msg_num > sys.msg_num) {
  731.                             pos = tell (fdi);
  732.                             write (fdi, (char *)&sys, SIZEOF_MSGAREA);
  733.                             memset ((char *)&sysidx, 0, sizeof (struct _sys_idx));
  734.                             sysidx.priv = sys.msg_priv;
  735.                             sysidx.flags = sys.msg_flags;
  736.                             sysidx.area = sys.msg_num;
  737.                             sysidx.sig = sys.msg_sig;
  738.                      strcpy (sysidx.key, sys.qwk_name);
  739.                      write (fdx, (char *)&sysidx, sizeof (struct _sys_idx));
  740.                      saved = 1;
  741.                   }
  742.                         if (bsys.msg_num != sys.msg_num) {
  743.                      write (fdi, (char *)&bsys, SIZEOF_MSGAREA);
  744.                      memset ((char *)&sysidx, 0, sizeof (struct _sys_idx));
  745.                      sysidx.priv = bsys.msg_priv;
  746.                      sysidx.flags = bsys.msg_flags;
  747.                      sysidx.area = bsys.msg_num;
  748.                      sysidx.sig = bsys.msg_sig;
  749.                      strcpy (sysidx.key, bsys.qwk_name);
  750.                      write (fdx, (char *)&sysidx, sizeof (struct _sys_idx));
  751.                   }
  752.                }
  753.  
  754.                if (!saved) {
  755.                         pos = tell (fdi);
  756.                   write (fdi, (char *)&sys, SIZEOF_MSGAREA);
  757.                         memset ((char *)&sysidx, 0, sizeof (struct _sys_idx));
  758.                   sysidx.priv = sys.msg_priv;
  759.                   sysidx.flags = sys.msg_flags;
  760.                   sysidx.area = sys.msg_num;
  761.                   sysidx.sig = sys.msg_sig;
  762.                   strcpy (sysidx.key, sys.qwk_name);
  763.                   write (fdx, (char *)&sysidx, sizeof (struct _sys_idx));
  764.                }
  765.  
  766.                lseek (fd, 0L, SEEK_SET);
  767.                chsize (fd, 0L);
  768.                lseek (fdi, 0L, SEEK_SET);
  769.  
  770.                     while (read (fdi, (char *)&bsys, SIZEOF_MSGAREA) == SIZEOF_MSGAREA)
  771.                   write (fd, (char *)&bsys, SIZEOF_MSGAREA);
  772.  
  773.                close (fdx);
  774.                close (fd);
  775.                     close (fdi);
  776.  
  777.                unlink (filename);
  778.  
  779.                sprintf (string, "%sSYSMSG.DAT", config.sys_path);
  780.                while ((fd = sh_open (string, SH_DENYNONE, O_RDWR|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  781.                   ;
  782.                lseek (fd, pos, SEEK_SET);
  783.                read (fd, (char *)&sys, SIZEOF_MSGAREA);
  784.  
  785.                wclose ();
  786.             }
  787.             else {
  788.                     pos = tell (fd) - (long)SIZEOF_MSGAREA;
  789.                i = (int)(pos / (long)SIZEOF_MSGAREA);
  790.  
  791.                sprintf (string, "%sSYSMSG.IDX", config.sys_path);
  792.                while ((fdx = sh_open (string, SH_DENYNONE, O_RDWR|O_CREAT|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  793.                   ;
  794.                lseek (fdx, (long)i * sizeof (struct _sys_idx), SEEK_SET);
  795.                memset ((char *)&sysidx, 0, sizeof (struct _sys_idx));
  796.                sysidx.priv = sys.msg_priv;
  797.                sysidx.flags = sys.msg_flags;
  798.                sysidx.area = sys.msg_num;
  799.                sysidx.sig = sys.msg_sig;
  800.                strcpy (sysidx.key, sys.qwk_name);
  801.                write (fdx, (char *)&sysidx, sizeof (struct _sys_idx));
  802.                     close (fdx);
  803.                 }
  804.  
  805.             break;
  806.  
  807.          // A Add
  808.             case 'A':
  809.          case 'a':
  810.             memcpy ((char *)&bsys, (char *)&sys, sizeof (struct _sys));
  811.             memset ((char *)&sys, 0, sizeof (struct _sys));
  812.             sys.max_age = 14;
  813.             sys.max_msgs = 200;
  814.             sys.msg_priv = sys.write_priv = TWIT;
  815.  
  816.          // C Copy
  817.          case 'C':
  818.          case 'c':
  819.             if (i == 'C' || i == 'c')
  820.                memcpy ((char *)&bsys, (char *)&sys, sizeof (struct _sys));
  821.  
  822.             sys.msg_num = 0;
  823.                 edit_single_area (&sys);
  824.  
  825.             if (sys.msg_num && strcmp (sys.msg_name, "")) {
  826.                pos = tell (fd) - (long)SIZEOF_MSGAREA;
  827.                close (fd);
  828.  
  829.                update_message ();
  830.  
  831.                sprintf (string, "%sSYSMSG.IDX", config.sys_path);
  832.                while ((fdx = sh_open (string, SH_DENYRD, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  833.                   ;
  834.                sprintf (filename, "%sSYSMSG.BAK", config.sys_path);
  835.                while ((fdi = sh_open (filename, SH_DENYRW, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  836.                         ;
  837.                sprintf (string, "%sSYSMSG.DAT", config.sys_path);
  838.                while ((fd = sh_open (string, SH_DENYRD, O_RDWR|O_CREAT|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  839.                   ;
  840.                saved = 0;
  841.  
  842.                while (read (fd, (char *)&bsys, SIZEOF_MSGAREA) == SIZEOF_MSGAREA) {
  843.                   if (!saved && bsys.msg_num > sys.msg_num) {
  844.                      pos = tell (fdi);
  845.                      write (fdi, (char *)&sys, SIZEOF_MSGAREA);
  846.                      memset ((char *)&sysidx, 0, sizeof (struct _sys_idx));
  847.                      sysidx.priv = sys.msg_priv;
  848.                      sysidx.flags = sys.msg_flags;
  849.                      sysidx.area = sys.msg_num;
  850.                      sysidx.sig = sys.msg_sig;
  851.                      strcpy (sysidx.key, sys.qwk_name);
  852.                      write (fdx, (char *)&sysidx, sizeof (struct _sys_idx));
  853.                      saved = 1;
  854.                         }
  855.                   if (bsys.msg_num != sys.msg_num) {
  856.                             write (fdi, (char *)&bsys, SIZEOF_MSGAREA);
  857.                      memset ((char *)&sysidx, 0, sizeof (struct _sys_idx));
  858.                      sysidx.priv = bsys.msg_priv;
  859.                      sysidx.flags = bsys.msg_flags;
  860.                      sysidx.area = bsys.msg_num;
  861.                      sysidx.sig = bsys.msg_sig;
  862.                      strcpy (sysidx.key, bsys.qwk_name);
  863.                      write (fdx, (char *)&sysidx, sizeof (struct _sys_idx));
  864.                   }
  865.                }
  866.  
  867.                if (!saved) {
  868.                   pos = tell (fdi);
  869.                         write (fdi, (char *)&sys, SIZEOF_MSGAREA);
  870.                   memset ((char *)&sysidx, 0, sizeof (struct _sys_idx));
  871.                   sysidx.priv = sys.msg_priv;
  872.                   sysidx.flags = sys.msg_flags;
  873.                   sysidx.area = sys.msg_num;
  874.                         sysidx.sig = sys.msg_sig;
  875.                   strcpy (sysidx.key, sys.qwk_name);
  876.                   write (fdx, (char *)&sysidx, sizeof (struct _sys_idx));
  877.                }
  878.  
  879.                lseek (fd, 0L, SEEK_SET);
  880.                chsize (fd, 0L);
  881.                lseek (fdi, 0L, SEEK_SET);
  882.  
  883.                while (read (fdi, (char *)&bsys, SIZEOF_MSGAREA) == SIZEOF_MSGAREA)
  884.                   write (fd, (char *)&bsys, SIZEOF_MSGAREA);
  885.  
  886.                close (fdx);
  887.                     close (fd);
  888.                close (fdi);
  889.  
  890.                unlink (filename);
  891.  
  892.                sprintf (string, "%sSYSMSG.DAT", config.sys_path);
  893.                while ((fd = sh_open (string, SH_DENYNONE, O_RDWR|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  894.                   ;
  895.                lseek (fd, pos, SEEK_SET);
  896.                read (fd, (char *)&sys, SIZEOF_MSGAREA);
  897.  
  898.                wclose ();
  899.             }
  900.             else
  901.                memcpy ((char *)&sys, (char *)&bsys, sizeof (struct _sys));
  902.                 break;
  903.  
  904.          // D Delete
  905.          case 'D':
  906.          case 'd':
  907.                 wh1 = wopen (10, 25, 14, 54, 0, BLACK|_LGREY, BLACK|_LGREY);
  908.             wactiv (wh1);
  909.             wshadow (DGREY|_BLACK);
  910.  
  911.             wcenters (1, BLACK|_LGREY, "Are you sure (Y/n) ?  ");
  912.  
  913.             strcpy (string, "Y");
  914.             winpbeg (BLACK|_LGREY, BLACK|_LGREY);
  915.             winpdef (1, 24, string, "?", 0, 2, NULL, 0);
  916.  
  917.             i = winpread ();
  918.             wclose ();
  919.             hidecur ();
  920.  
  921.             if (i == W_ESCPRESS)
  922.                     break;
  923.  
  924.             if (toupper (string[0]) == 'Y') {
  925.                pos = tell (fd) - (long)SIZEOF_MSGAREA;
  926.                close (fd);
  927.  
  928.                update_message ();
  929.  
  930.                sprintf (string, "%sSYSMSG.IDX", config.sys_path);
  931.                while ((fdx = sh_open (string, SH_DENYRD, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  932.                   ;
  933.                sprintf (filename, "%sSYSMSG.BAK", config.sys_path);
  934.                while ((fdi = sh_open (filename, SH_DENYRW, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  935.                         ;
  936.                sprintf (string, "%sSYSMSG.DAT", config.sys_path);
  937.                while ((fd = sh_open (string, SH_DENYRD, O_RDWR|O_CREAT|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  938.                   ;
  939.  
  940.                     while (read (fd, (char *)&bsys, SIZEOF_MSGAREA) == SIZEOF_MSGAREA) {
  941.                   if (bsys.msg_num != sys.msg_num) {
  942.                      write (fdi, (char *)&bsys, SIZEOF_MSGAREA);
  943.                      memset ((char *)&sysidx, 0, sizeof (struct _sys_idx));
  944.                      sysidx.priv = bsys.msg_priv;
  945.                      sysidx.flags = bsys.msg_flags;
  946.                      sysidx.area = bsys.msg_num;
  947.                      sysidx.sig = bsys.msg_sig;
  948.                      strcpy (sysidx.key, bsys.qwk_name);
  949.                      write (fdx, (char *)&sysidx, sizeof (struct _sys_idx));
  950.                   }
  951.                }
  952.  
  953.                     lseek (fd, 0L, SEEK_SET);
  954.                chsize (fd, 0L);
  955.                     lseek (fdi, 0L, SEEK_SET);
  956.  
  957.                while (read (fdi, (char *)&bsys, SIZEOF_MSGAREA) == SIZEOF_MSGAREA)
  958.                   write (fd, (char *)&bsys, SIZEOF_MSGAREA);
  959.  
  960.                close (fdx);
  961.                close (fd);
  962.                close (fdi);
  963.  
  964.                unlink (filename);
  965.  
  966.                sprintf (string, "%sSYSMSG.DAT", config.sys_path);
  967.                while ((fd = sh_open (string, SH_DENYNONE, O_RDWR|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  968.                         ;
  969.                if (lseek (fd, pos, SEEK_SET) == -1 || pos == filelength (fd)) {
  970.                   lseek (fd, -1l * SIZEOF_MSGAREA, SEEK_END);
  971.                   pos = tell (fd);
  972.                }
  973.                     read (fd, (char *)&sys, SIZEOF_MSGAREA);
  974.  
  975.                wclose ();
  976.             }
  977.             break;
  978.  
  979.          // L List
  980.          case 'L':
  981.          case 'l':
  982.             select_area_list (fd, &sys);
  983.             break;
  984.  
  985.          // ESC Exit
  986.             case 0x1B:
  987.             i = -1;
  988.                 break;
  989.       }
  990.  
  991.    } while (i != -1);
  992.  
  993.    close (fd);
  994.  
  995.     wclose ();
  996.     gotoxy_ (24, 1);
  997.     clreol_ ();
  998. }
  999.  
  1000. static void edit_single_area (sys)
  1001. struct _sys *sys;
  1002. {
  1003.     int i = 1, wh1, m, mx;
  1004.     char string[128], *akas[MAX_ALIAS], temp[42];
  1005.     struct _sys nsys;
  1006.  
  1007.     memcpy ((char *)&nsys, (char *)sys, SIZEOF_MSGAREA);
  1008.  
  1009.     gotoxy_ (24, 1);
  1010.     clreol_ ();
  1011.     prints (24, 1, LGREY|_BLACK, "ESC-Exit/Save  ENTER-Edit");
  1012.     prints (24, 1, YELLOW|_BLACK, "ESC");
  1013.     prints (24, 16, YELLOW|_BLACK, "ENTER");
  1014.  
  1015. continue_editing:
  1016.     do {
  1017.         stop_update ();
  1018.         wclear ();
  1019.  
  1020.         wmenubegc ();
  1021.         wmenuitem (1, 1," Number       ", 0, 1, 0, NULL, 0, 0);
  1022.         wmenuitem (1, 28," QWK Name     ", 0, 25, 0, NULL, 0, 0);
  1023.         wmenuitem (2, 1," Name         ", 0, 2, 0, NULL, 0, 0);
  1024.         wmenuitem (3, 1," Type         ", 0, 3, 0, NULL, 0, 0);
  1025.         wmenuitem (3, 28," Echo-Tag     ", 0, 24, 0, NULL, 0, 0);
  1026.         wmenuitem (4, 1," Flags        ", 0, 4, 0, NULL, 0, 0);
  1027.         wmenuitem (5, 1," Storage      ", 0, 6, 0, NULL, 0, 0);
  1028.         wmenuitem (4, 28," Group        ", 0, 5, 0, NULL, 0, 0);
  1029.         wmenuitem (6, 1," Path/Board   ", 0, 7, 0, NULL, 0, 0);
  1030.         wmenuitem (7, 1," Aka          ", 0, 8, 0, NULL, 0, 0);
  1031.         wmenuitem (8, 1," Origin       ", 0, 9, 0, NULL, 0, 0);
  1032.         wmenuitem (9, 1," Max messages ", 0, 10, 0, NULL, 0, 0);
  1033.         wmenuitem (10, 1," Message age  ", 0, 11, 0, NULL, 0, 0);
  1034.         wprints (10, 22, LGREY|_BLACK, "days");
  1035.         wmenuitem (10, 28," Age received ", 0, 12, 0, NULL, 0, 0);
  1036.         wprints (10, 49, LGREY|_BLACK, "days");
  1037.         wmenuitem (11, 1," Read level   ", 0, 13, 0, NULL, 0, 0);
  1038.         wmenuitem (12, 1," A Flag       ", 0, 14, 0, NULL, 0, 0);
  1039.         wmenuitem (13, 1," B Flag       ", 0, 15, 0, NULL, 0, 0);
  1040.         wmenuitem (14, 1," C Flag       ", 0, 16, 0, NULL, 0, 0);
  1041.         wmenuitem (15, 1," D Flag       ", 0, 17, 0, NULL, 0, 0);
  1042.         wmenuitem (11, 28," Write level  ", 0, 18, 0, NULL, 0, 0);
  1043.         wmenuitem (12, 28," A Flag       ", 0, 19, 0, NULL, 0, 0);
  1044.         wmenuitem (13, 28," B Flag       ", 0, 20, 0, NULL, 0, 0);
  1045.         wmenuitem (14, 28," C Flag       ", 0, 21, 0, NULL, 0, 0);
  1046.         wmenuitem (15, 28," D Flag       ", 0, 22, 0, NULL, 0, 0);
  1047.         wmenuitem (11, 55," Afx level ", 0, 23, 0, NULL, 0, 0);
  1048.         wmenuitem (12, 55," A Flag    ", 0, 29, 0, NULL, 0, 0);
  1049.         wmenuitem (13, 55," B Flag    ", 0, 30, 0, NULL, 0, 0);
  1050.         wmenuitem (14, 55," C Flag    ", 0, 31, 0, NULL, 0, 0);
  1051.         wmenuitem (15, 55," D Flag    ", 0, 32, 0, NULL, 0, 0);
  1052.         wprints (16, 1, LGREY|_BLACK," Forward to:");
  1053.         wmenuitem (17, 1," 1 ", 0, 26, 0, NULL, 0, 0);
  1054.         wmenuitem (18, 1," 2 ", 0, 27, 0, NULL, 0, 0);
  1055.         wmenuitem (19, 1," 3 ", 0, 28, 0, NULL, 0, 0);
  1056.         wmenuend (i, M_OMNI|M_SAVE, 0, 0, LGREY|_BLACK, LGREY|_BLACK, LGREY|_BLACK, BLUE|_LGREY);
  1057.  
  1058.         sprintf (string, "%d", nsys.msg_num);
  1059.         wprints (1, 16, CYAN|_BLACK, string);
  1060.  
  1061.         wprints (1, 43, CYAN|_BLACK, nsys.qwk_name);
  1062.  
  1063.         nsys.msg_name[55] = '\0';
  1064.         wprints (2, 16, CYAN|_BLACK, nsys.msg_name);
  1065.  
  1066.         if (nsys.netmail)
  1067.             wprints (3, 16, CYAN|_BLACK, "Netmail");
  1068.         else if (nsys.echomail)
  1069.             wprints (3, 16, CYAN|_BLACK, "Echomail");
  1070.         else if (nsys.internet_mail)
  1071.             wprints (3, 16, CYAN|_BLACK, "Internet");
  1072.         else
  1073.             wprints (3, 16, CYAN|_BLACK, "Local");
  1074.  
  1075.         wprints (3, 43, CYAN|_BLACK, nsys.echotag);
  1076.  
  1077.         strcpy (string, "......");  // P=Public, V=Private,
  1078.                                           // A=Allow alias, G=Group restricted,
  1079.                                           // T=Tiny seen-by
  1080.  
  1081.         if (nsys.public)
  1082.             string[0] = 'P';
  1083.         if (nsys.private)
  1084.             string[1] = 'V';
  1085.         if (nsys.anon_ok)
  1086.             string[2] = 'A';
  1087.         if (nsys.msg_restricted)
  1088.             string[3] = 'G';
  1089.         if (nsys.sendonly)
  1090.             string[4] = 'S';
  1091.         if (nsys.receiveonly)
  1092.             string[5] = 'R';
  1093.  
  1094.         wprints (4, 16, CYAN|_BLACK, string);
  1095.  
  1096.       if (nsys.passthrough)
  1097.          wprints (5, 16, CYAN|_BLACK, "Passthrough");
  1098.       else if (nsys.quick_board)
  1099.          wprints (5, 16, CYAN|_BLACK, "QuickBBS");
  1100.       else if (nsys.gold_board)
  1101.          wprints (5, 16, CYAN|_BLACK, "GoldBase");
  1102.       else if (nsys.pip_board)
  1103.          wprints (5, 16, CYAN|_BLACK, "Pip-Base");
  1104.       else if (nsys.squish)
  1105.          wprints (5, 16, CYAN|_BLACK, "Squish");
  1106.       else
  1107.          wprints (5, 16, CYAN|_BLACK, "Fido");
  1108.  
  1109.       sprintf (string, "%d", nsys.msg_sig);
  1110.       wprints (4, 43, CYAN|_BLACK, string);
  1111.  
  1112.       if (nsys.quick_board)
  1113.          sprintf (string, "%d", nsys.quick_board);
  1114.       else if (nsys.gold_board)
  1115.          sprintf (string, "%d", nsys.gold_board);
  1116.       else if (nsys.pip_board)
  1117.          sprintf (string, "%d", nsys.pip_board);
  1118.       else
  1119.          strcpy (string, nsys.msg_path);
  1120.       wprints (6, 16, CYAN|_BLACK, string);
  1121.  
  1122.       sprintf (string, "%d:%d/%d.%d", config.alias[nsys.use_alias].zone, config.alias[nsys.use_alias].net, config.alias[nsys.use_alias].node, config.alias[nsys.use_alias].point);
  1123.       wprints (7, 16, CYAN|_BLACK, string);
  1124.  
  1125.       wprints (8, 16, CYAN|_BLACK, nsys.origin);
  1126.  
  1127.       sprintf (string, "%d", nsys.max_msgs);
  1128.       wprints (9, 16, CYAN|_BLACK, string);
  1129.  
  1130.       sprintf (string, "%d", nsys.max_age);
  1131.       wprints (10, 16, CYAN|_BLACK, string);
  1132.  
  1133.       sprintf (string, "%d", nsys.age_rcvd);
  1134.       wprints (10, 43, CYAN|_BLACK, string);
  1135.  
  1136.       wprints (11, 15, CYAN|_BLACK, get_priv_text (nsys.msg_priv));
  1137.       wprints (12, 16, CYAN|_BLACK, get_flagA_text ((nsys.msg_flags >> 24) & 0xFF));
  1138.       wprints (13, 16, CYAN|_BLACK, get_flagB_text ((nsys.msg_flags >> 16) & 0xFF));
  1139.       wprints (14, 16, CYAN|_BLACK, get_flagC_text ((nsys.msg_flags >> 8) & 0xFF));
  1140.       wprints (15, 16, CYAN|_BLACK, get_flagD_text (nsys.msg_flags & 0xFF));
  1141.  
  1142.       wprints (11, 42, CYAN|_BLACK, get_priv_text (nsys.write_priv));
  1143.       wprints (12, 43, CYAN|_BLACK, get_flagA_text ((nsys.write_flags >> 24) & 0xFF));
  1144.       wprints (13, 43, CYAN|_BLACK, get_flagB_text ((nsys.write_flags >> 16) & 0xFF));
  1145.       wprints (14, 43, CYAN|_BLACK, get_flagC_text ((nsys.write_flags >> 8) & 0xFF));
  1146.       wprints (15, 43, CYAN|_BLACK, get_flagD_text (nsys.write_flags & 0xFF));
  1147.  
  1148.       sprintf (string, "%d", nsys.areafix);
  1149.       wprints (11, 67, CYAN|_BLACK, string);
  1150.       wprints (12, 67, CYAN|_BLACK, get_flagA_text ((nsys.afx_flags >> 24) & 0xFF));
  1151.       wprints (13, 67, CYAN|_BLACK, get_flagB_text ((nsys.afx_flags >> 16) & 0xFF));
  1152.       wprints (14, 67, CYAN|_BLACK, get_flagC_text ((nsys.afx_flags >> 8) & 0xFF));
  1153.       wprints (15, 67, CYAN|_BLACK, get_flagD_text (nsys.afx_flags & 0xFF));
  1154.  
  1155.         wprints (17, 4, CYAN|_BLACK, nsys.forward1);
  1156.         wprints (18, 4, CYAN|_BLACK, nsys.forward2);
  1157.         wprints (19, 4, CYAN|_BLACK, nsys.forward3);
  1158.         start_update ();
  1159.  
  1160.         i = wmenuget ();
  1161.  
  1162.         switch (i) {
  1163.             case 1:
  1164.                 sprintf (string, "%d", nsys.msg_num);
  1165.                 winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1166.                 winpdef (1, 16, string, "?????", 0, 2, NULL, 0);
  1167.                 if (winpread () != W_ESCPRESS)
  1168.                     nsys.msg_num = atoi (strbtrim (string));
  1169.               break;
  1170.  
  1171.             case 2:
  1172.                 strcpy (string, nsys.msg_name);
  1173.                 winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1174.                 winpdef (2, 16, string, "????????????????????????????????????????????????????", 0, 2, NULL, 0);
  1175.                 if (winpread () != W_ESCPRESS)
  1176.                     strcpy (nsys.msg_name, strbtrim (string));
  1177.                 break;
  1178.  
  1179.             case 3:
  1180.                 if (nsys.netmail) {
  1181.                     nsys.netmail = 0;
  1182.                     nsys.echomail = 1;
  1183.                 }
  1184.                 else if (nsys.echomail) {
  1185.                     nsys.echomail = 0;
  1186.                     nsys.internet_mail = 1;
  1187.                 }
  1188.                 else if (nsys.internet_mail)
  1189.                     nsys.internet_mail = 0;
  1190.                 else {
  1191.                     nsys.internet_mail = 0;
  1192.                     nsys.netmail = 1;
  1193.                 }
  1194.                 break;
  1195.  
  1196.             case 4:
  1197.                 wh1 = wopen (8, 28, 17, 53, 1, LCYAN|_BLACK, CYAN|_BLACK);
  1198.                 wactiv (wh1);
  1199.                 wshadow (DGREY|_BLACK);
  1200.                 wtitle (" Flags ", TRIGHT, YELLOW|_BLUE);
  1201.                 m = 1;
  1202.  
  1203.                 do {
  1204.                     wmenubegc ();
  1205.                     wmenuitem (1, 1, " Public only      ", 0, 1, 0, NULL, 0, 0);
  1206.                     wmenuitem (2, 1, " Private only     ", 0, 2, 0, NULL, 0, 0);
  1207.                     wmenuitem (3, 1, " Allow alias      ", 0, 3, 0, NULL, 0, 0);
  1208.                     wmenuitem (4, 1, " Group restricted ", 0, 4, 0, NULL, 0, 0);
  1209. //               wmenuitem (4, 1, "Tiny SEEN-BY    ", 0, 5, 0, NULL, 0, 0);
  1210.                     wmenuitem (5, 1, " Send only        ", 0, 5, 0, NULL, 0, 0);
  1211.                     wmenuitem (6, 1, " Receive only     ", 0, 6, 0, NULL, 0, 0);
  1212.                     wmenuend (m, M_OMNI|M_SAVE, 0, 0, LGREY|_BLACK, LGREY|_BLACK, LGREY|_BLACK, BLUE|_LGREY);
  1213.  
  1214.                     if (nsys.public)
  1215.                         wprints (1, 20, CYAN|_BLACK, "Yes");
  1216.                     else
  1217.                         wprints (1, 20, CYAN|_BLACK, "No ");
  1218.                     if (nsys.private)
  1219.                         wprints (2, 20, CYAN|_BLACK, "Yes");
  1220.                     else
  1221.                         wprints (2, 20, CYAN|_BLACK, "No ");
  1222.                     if (nsys.anon_ok)
  1223.                         wprints (3, 20, CYAN|_BLACK, "Yes");
  1224.                     else
  1225.                         wprints (3, 20, CYAN|_BLACK, "No ");
  1226.                     if (nsys.msg_restricted)
  1227.                         wprints (4, 20, CYAN|_BLACK, "Yes");
  1228.                     else
  1229.                         wprints (4, 20, CYAN|_BLACK, "No ");
  1230.                     if (nsys.sendonly)
  1231.                         wprints (5, 20, CYAN|_BLACK, "Yes");
  1232.                     else
  1233.                         wprints (5, 20, CYAN|_BLACK, "No ");
  1234.                     if (nsys.receiveonly)
  1235.                         wprints (6, 20, CYAN|_BLACK, "Yes");
  1236.                     else
  1237.                         wprints (6, 20, CYAN|_BLACK, "No ");
  1238.  
  1239.                     m = wmenuget ();
  1240.  
  1241.                     switch (m) {
  1242.                         case 1:
  1243.                             nsys.public = nsys.public ? 0 : 1;
  1244.                             if (nsys.public)
  1245.                                 nsys.private = 0;
  1246.                             break;
  1247.                         case 2:
  1248.                             nsys.private = nsys.private ? 0 : 1;
  1249.                             if (nsys.private)
  1250.                                 nsys.public = 0;
  1251.                             break;
  1252.                         case 3:
  1253.                             nsys.anon_ok = nsys.anon_ok ? 0 : 1;
  1254.                             break;
  1255.                         case 4:
  1256.                             nsys.msg_restricted = nsys.msg_restricted ? 0 : 1;
  1257.                             break;
  1258.                         case 5:
  1259.                             nsys.sendonly = nsys.sendonly ? 0 : 1;
  1260.                             break;
  1261.                         case 6:
  1262.                             nsys.receiveonly = nsys.receiveonly ? 0 : 1;
  1263.                             break;
  1264.                     }
  1265.  
  1266.                 } while (m != -1);
  1267.  
  1268.                 wclose ();
  1269.                 break;
  1270.  
  1271.             case 5:
  1272.                 sprintf (string, "%d", nsys.msg_sig);
  1273.                 winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1274.                 winpdef (4, 43, string, "???", 0, 1, NULL, 0);
  1275.                 if (winpread () != W_ESCPRESS)
  1276.                     nsys.msg_sig = atoi (strbtrim (string));
  1277.                 break;
  1278.  
  1279.             case 6:
  1280.                 if (nsys.passthrough) {
  1281.                     if ((nsys.quick_board = sys->quick_board) == 0)
  1282.                         nsys.quick_board = 199;
  1283.                     nsys.passthrough = 0;
  1284.                 }
  1285.                 else if (nsys.quick_board) {
  1286.                     if ((nsys.gold_board = sys->gold_board) == 0)
  1287.                   nsys.gold_board = 499;
  1288.                nsys.quick_board = 0;
  1289.                 }
  1290.             else if (nsys.gold_board) {
  1291.                if ((nsys.pip_board = sys->pip_board) == 0)
  1292.                   nsys.pip_board = 1;
  1293.                nsys.gold_board = 0;
  1294.             }
  1295.             else if (nsys.pip_board) {
  1296.                nsys.pip_board = 0;
  1297.                nsys.squish = 1;
  1298.             }
  1299.             else if (nsys.squish)
  1300.                nsys.squish = 0;
  1301.                 else
  1302.                nsys.passthrough = 1;
  1303.             break;
  1304.  
  1305.          case 7:
  1306.             if (nsys.quick_board) {
  1307.                do {
  1308.                   sprintf (string, "%d", nsys.quick_board);
  1309.                   winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1310.                   winpdef (6, 16, string, "???", 0, 2, NULL, 0);
  1311.                   if (winpread () != W_ESCPRESS)
  1312.                      nsys.quick_board = atoi (strbtrim (string));
  1313.                   else
  1314.                      break;
  1315.                } while (nsys.quick_board < 1 || nsys.quick_board > 200);
  1316.             }
  1317.             else if (nsys.gold_board) {
  1318.                do {
  1319.                   sprintf (string, "%d", nsys.gold_board);
  1320.                   winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1321.                   winpdef (6, 16, string, "???", 0, 2, NULL, 0);
  1322.                         if (winpread () != W_ESCPRESS)
  1323.                      nsys.gold_board = atoi (strbtrim (string));
  1324.                   else
  1325.                      break;
  1326.                } while (nsys.gold_board < 1 || nsys.gold_board > 500);
  1327.             }
  1328.             else if (nsys.pip_board) {
  1329.                sprintf (string, "%d", nsys.pip_board);
  1330.                winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1331.                     winpdef (6, 16, string, "????", 0, 2, NULL, 0);
  1332.                     if (winpread () != W_ESCPRESS)
  1333.                         nsys.pip_board = atoi (strbtrim (string));
  1334.                 }
  1335.                 else if (nsys.squish) {
  1336.                     strcpy (string, nsys.msg_path);
  1337.                     winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1338.                     winpdef (6, 16, string, "???????????????????????????????????????", 0, 2, NULL, 0);
  1339.                     if (winpread () != W_ESCPRESS) {
  1340.                         strcpy (nsys.msg_path, strbtrim (string));
  1341.                         if (nsys.msg_path[strlen (nsys.msg_path) - 1] == '\\')
  1342.                             nsys.msg_path[strlen (nsys.msg_path) - 1] = '\0';
  1343.                     }
  1344.               }
  1345.               else {
  1346.                     strcpy (string, nsys.msg_path);
  1347.                     winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1348.                     winpdef (6, 16, string, "??????????????????????????????????????", 0, 2, NULL, 0);
  1349.                     if (winpread () != W_ESCPRESS) {
  1350.                         strcpy (nsys.msg_path, strbtrim (string));
  1351.                         if (nsys.msg_path[strlen (nsys.msg_path) - 1] != '\\')
  1352.                             strcat (nsys.msg_path, "\\");
  1353.                         create_path (nsys.msg_path);
  1354.                     }
  1355.                 }
  1356.             break;
  1357.  
  1358.          case 8:
  1359.             mx = 0;
  1360.             for (m = 0; m < MAX_ALIAS && config.alias[m].net; m++) {
  1361.                sprintf (string, "%d:%d/%d.%d", config.alias[m].zone, config.alias[m].net, config.alias[m].node, config.alias[m].point);
  1362.                akas[m] = (char *)malloc (strlen (string) + 1);
  1363.                strcpy (akas[m], string);
  1364.                     if (strlen (string) > mx)
  1365.                   mx = strlen (string);
  1366.             }
  1367.             akas[m] = NULL;
  1368.             /* MM */ // Modificata la gestione del wpickstr, la finestra e'
  1369.                      // a dimensione fissa e non viene piu' calcolata come prima.
  1370.                      // Se necessario aumentare le dimensioni di wopen w wpickstr
  1371.             wh1 = wopen (10, 25, 20, 48, 1, LCYAN|_BLACK, CYAN|_BLACK);
  1372.             wactiv (wh1);
  1373.             wshadow (DGREY|_BLACK);
  1374.             wtitle (" AKAs ", TRIGHT, YELLOW|_BLUE);
  1375.             m = wpickstr (12, 27, 18, 46, 5, LGREY|_BLACK, LGREY|_BLACK, BLUE|_LGREY, akas, nsys.use_alias, NULL);
  1376.             /* MM */            if (m != -1)
  1377.                nsys.use_alias = m;
  1378.             wclose ();
  1379.             for (m = 0; m < MAX_ALIAS && config.alias[m].net; m++)
  1380.                free (akas[m]);
  1381.             break;
  1382.  
  1383.          case 9:
  1384.             strcpy (string, nsys.origin);
  1385.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1386.             winpdef (8, 16, string, "????????????????????????????????????????????????????", 0, 2, NULL, 0);
  1387.             if (winpread () != W_ESCPRESS)
  1388.                strcpy (nsys.origin, strbtrim (string));
  1389.             break;
  1390.  
  1391.          case 10:
  1392.             sprintf (string, "%d", nsys.max_msgs);
  1393.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1394.             winpdef (9, 16, string, "?????", 0, 2, NULL, 0);
  1395.             if (winpread () != W_ESCPRESS)
  1396.                nsys.max_msgs = atoi (strbtrim (string));
  1397.         break;
  1398.  
  1399.          case 11:
  1400.             sprintf (string, "%d", nsys.max_age);
  1401.                 winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1402.             winpdef (10, 16, string, "?????", 0, 2, NULL, 0);
  1403.             if (winpread () != W_ESCPRESS)
  1404.                nsys.max_age = atoi (strbtrim (string));
  1405.         break;
  1406.  
  1407.             case 12:
  1408.             sprintf (string, "%d", nsys.age_rcvd);
  1409.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1410.             winpdef (10, 43, string, "?????", 0, 2, NULL, 0);
  1411.             if (winpread () != W_ESCPRESS)
  1412.                nsys.age_rcvd = atoi (strbtrim (string));
  1413.         break;
  1414.  
  1415.          case 13:
  1416.             nsys.msg_priv = select_level (nsys.msg_priv, 20, 8);
  1417.             break;
  1418.  
  1419.          case 14:
  1420.             nsys.msg_flags = window_get_flags (8, 24, 1, nsys.msg_flags);
  1421.             break;
  1422.  
  1423.          case 15:
  1424.             nsys.msg_flags = window_get_flags (8, 24, 2, nsys.msg_flags);
  1425.             break;
  1426.  
  1427.          case 16:
  1428.             nsys.msg_flags = window_get_flags (8, 24, 3, nsys.msg_flags);
  1429.             break;
  1430.  
  1431.          case 17:
  1432.             nsys.msg_flags = window_get_flags (8, 24, 4, nsys.msg_flags);
  1433.             break;
  1434.  
  1435.          case 18:
  1436.             nsys.write_priv = select_level (nsys.write_priv, 47, 8);
  1437.             break;
  1438.  
  1439.          case 19:
  1440.             nsys.write_flags = window_get_flags (8, 46, 1, nsys.write_flags);
  1441.                 break;
  1442.  
  1443.          case 20:
  1444.             nsys.write_flags = window_get_flags (8, 46, 2, nsys.write_flags);
  1445.             break;
  1446.  
  1447.          case 21:
  1448.             nsys.write_flags = window_get_flags (8, 46, 3, nsys.write_flags);
  1449.             break;
  1450.  
  1451.          case 22:
  1452.             nsys.write_flags = window_get_flags (8, 46, 4, nsys.write_flags);
  1453.             break;
  1454.  
  1455.          case 23:
  1456.             sprintf (string, "%d", nsys.areafix);
  1457.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1458.             winpdef (11, 67, string, "???", 0, 1, NULL, 0);
  1459.             if (winpread () != W_ESCPRESS)
  1460.                nsys.areafix = atoi (strbtrim (string));
  1461.             break;
  1462.  
  1463.          case 24:
  1464.             strcpy (string, nsys.echotag);
  1465.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1466.             winpdef (3, 43, string, "???????????????????????????????", 0, 1, NULL, 0);
  1467.                 if (winpread () != W_ESCPRESS)
  1468.                     strcpy (nsys.echotag, strupr (strbtrim (string)));
  1469.                 break;
  1470.  
  1471.             case 25:
  1472.                 strcpy (string, nsys.qwk_name);
  1473.                 winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1474.                 winpdef (1, 43, string, "????????????", 0, 2, NULL, 0);
  1475.                 if (winpread () != W_ESCPRESS)
  1476.                     strcpy (nsys.qwk_name, strbtrim (string));
  1477.                 break;
  1478.  
  1479.             case 26:
  1480.                 strcpy (string, nsys.forward1);
  1481.                 winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1482.                 winpdef (17, 4, string, "??????????????????????????????????????????????????????????????????????", 0, 2, NULL, 0);
  1483.                 if (winpread () != W_ESCPRESS)
  1484.                     strcpy (nsys.forward1, strbtrim (string));
  1485.                 break;
  1486.  
  1487.             case 27:
  1488.                 strcpy (string, nsys.forward2);
  1489.                 winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1490.                 winpdef (18, 4, string, "??????????????????????????????????????????????????????????????????????", 0, 2, NULL, 0);
  1491.                 if (winpread () != W_ESCPRESS)
  1492.                     strcpy (nsys.forward2, strbtrim (string));
  1493.                 break;
  1494.  
  1495.             case 28:
  1496.                 strcpy (string, nsys.forward3);
  1497.                 winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1498.                 winpdef (19, 4, string, "??????????????????????????????????????????????????????????????????????", 0, 2, NULL, 0);
  1499.                 if (winpread () != W_ESCPRESS)
  1500.                     strcpy (nsys.forward3, strbtrim (string));
  1501.                 break;
  1502.  
  1503.             case 29:
  1504.                 nsys.afx_flags = window_get_flags (8, 66, 1, nsys.afx_flags);
  1505.                 break;
  1506.  
  1507.          case 30:
  1508.             nsys.afx_flags = window_get_flags (8, 66, 2, nsys.afx_flags);
  1509.                 break;
  1510.  
  1511.          case 31:
  1512.             nsys.afx_flags = window_get_flags (8, 66, 3, nsys.afx_flags);
  1513.             break;
  1514.  
  1515.          case 32:
  1516.             nsys.afx_flags = window_get_flags (8, 66, 4, nsys.afx_flags);
  1517.             break;
  1518.       }
  1519.  
  1520.       hidecur ();
  1521.    } while (i != -1);
  1522.  
  1523.    if (memcmp ((char *)&nsys, (char *)sys, SIZEOF_MSGAREA)) {
  1524.       wh1 = wopen (10, 25, 14, 54, 0, BLACK|_LGREY, BLACK|_LGREY);
  1525.       wactiv (wh1);
  1526.       wshadow (DGREY|_BLACK);
  1527.  
  1528.       wcenters (1, BLACK|_LGREY, "Save changes (Y/n) ?  ");
  1529.  
  1530.       strcpy (string, "Y");
  1531.       winpbeg (BLACK|_LGREY, BLACK|_LGREY);
  1532.       winpdef (1, 24, string, "?", 0, 2, NULL, 0);
  1533.  
  1534.       i = winpread ();
  1535.       wclose ();
  1536.       hidecur ();
  1537.  
  1538.       if (i == W_ESCPRESS)
  1539.          goto continue_editing;
  1540.  
  1541.         if (toupper (string[0]) == 'Y')
  1542.             memcpy ((char *)sys, (char *)&nsys, SIZEOF_MSGAREA);
  1543.     }
  1544.  
  1545.    gotoxy_ (24, 1);
  1546.    clreol_ ();
  1547.    prints (24, 1, LGREY|_BLACK, "PgUp/PgDn-Next/Previous  E-Edit  A-Add New Area  C-Copy  L-List  D-Delete");
  1548.    prints (24, 1, YELLOW|_BLACK, "PgUp/PgDn");
  1549.    prints (24, 26, YELLOW|_BLACK, "E");
  1550.    prints (24, 34, YELLOW|_BLACK, "A");
  1551.    prints (24, 50, YELLOW|_BLACK, "C");
  1552.    prints (24, 58, YELLOW|_BLACK, "L");
  1553.    prints (24, 66, YELLOW|_BLACK, "D");
  1554. }
  1555.  
  1556. static void select_area_list (fd, osys)
  1557. int fd;
  1558. struct _sys *osys;
  1559. {
  1560.    int wh, i, x, start;
  1561.    char string[80], **array;
  1562.    struct _sys sys;
  1563.    long pos;
  1564.  
  1565.    wh = wopen (4, 0, 20, 77, 1, LCYAN|_BLACK, CYAN|_BLACK);
  1566.    wactiv (wh);
  1567.    wshadow (DGREY|_BLACK);
  1568.    wtitle (" Select area ", TRIGHT, YELLOW|_BLUE);
  1569.  
  1570.    wprints (0, 1, LGREY|_BLACK, "Area# Name                                                   Level");
  1571.    whline (1, 0, 76, 0, BLUE|_BLACK);
  1572.  
  1573.    gotoxy_ (24, 1);
  1574.    clreol_ ();
  1575.    prints (24, 1, LGREY|_BLACK, "-Move bar  ENTER-Select");
  1576.    prints (24, 1, YELLOW|_BLACK, "");
  1577.    prints (24, 14, YELLOW|_BLACK, "ENTER");
  1578.  
  1579.    i = (int)(filelength (fd) / SIZEOF_MSGAREA);
  1580.    i += 2;
  1581.    if ((array = (char **)malloc (i * sizeof (char *))) == NULL)
  1582.       return;
  1583.  
  1584.    pos = tell (fd) - SIZEOF_MSGAREA;
  1585.    lseek (fd, 0L, SEEK_SET);
  1586.    i = 0;
  1587.    start = 0;
  1588.  
  1589.    while (read (fd, (char *)&sys, SIZEOF_MSGAREA) == SIZEOF_MSGAREA) {
  1590.       sprintf (string, " %-4d %-33.33s %-20.20s%-13s ", sys.msg_num, sys.msg_name, sys.echotag, get_priv_text (sys.msg_priv));
  1591.       array[i] = (char *)malloc (strlen (string) + 1);
  1592.       if (array[i] == NULL)
  1593.          break;
  1594.       if (osys->msg_num == sys.msg_num)
  1595.          start = i;
  1596.       strcpy (array[i++], string);
  1597.    }
  1598.    array[i] = NULL;
  1599.  
  1600.    x = wpickstr (7, 2, 19, 75, 5, LGREY|_BLACK, CYAN|_BLACK, BLUE|_LGREY, array, start, NULL);
  1601.  
  1602.    if (x == -1)
  1603.       lseek (fd, pos, SEEK_SET);
  1604.    else
  1605.       lseek (fd, (long)x * SIZEOF_MSGAREA, SEEK_SET);
  1606.    read (fd, (char *)osys, SIZEOF_MSGAREA);
  1607.  
  1608.    wclose ();
  1609.  
  1610.    i = 0;
  1611.    while (array[i] != NULL)
  1612.       free (array[i++]);
  1613.    free (array);
  1614.  
  1615.    gotoxy_ (24, 1);
  1616.    clreol_ ();
  1617.    prints (24, 1, LGREY|_BLACK, "PgUp/PgDn-Next/Previous  E-Edit  A-Add New Area  C-Copy  L-List  D-Delete");
  1618.    prints (24, 1, YELLOW|_BLACK, "PgUp/PgDn");
  1619.    prints (24, 26, YELLOW|_BLACK, "E");
  1620.    prints (24, 34, YELLOW|_BLACK, "A");
  1621.    prints (24, 50, YELLOW|_BLACK, "C");
  1622.    prints (24, 58, YELLOW|_BLACK, "L");
  1623.    prints (24, 66, YELLOW|_BLACK, "D");
  1624. }
  1625.  
  1626. void bbs_login_limits ()
  1627. {
  1628.    int wh, i = 1;
  1629.    char string[128];
  1630.  
  1631.    wh = wopen (7, 15, 17, 48, 1, LCYAN|_BLACK, CYAN|_BLACK);
  1632.    wactiv (wh);
  1633.    wshadow (DGREY|_BLACK);
  1634.    wtitle (" Login limits ", TRIGHT, YELLOW|_BLUE);
  1635.  
  1636.    do {
  1637.       stop_update ();
  1638.       wclear ();
  1639.  
  1640.       wmenubegc ();
  1641.       wmenuitem ( 1,  1," Minimum sec. level ", 0, 1, 0, NULL, 0, 0);
  1642.       wmenuitem ( 2,  1," Minimum A flags    ", 0, 2, 0, NULL, 0, 0);
  1643.       wmenuitem ( 3,  1," Minimum B flags    ", 0, 3, 0, NULL, 0, 0);
  1644.       wmenuitem ( 4,  1," Minimum C flags    ", 0, 4, 0, NULL, 0, 0);
  1645.       wmenuitem ( 5,  1," Minimum D flags    ", 0, 5, 0, NULL, 0, 0);
  1646.       wmenuitem ( 6,  1," Minimum age        ", 0, 6, 0, NULL, 0, 0);
  1647.       wmenuitem ( 7,  1," Time to login      ", 0, 7, 0, NULL, 0, 0);
  1648.       wmenuend (i, M_OMNI|M_SAVE, 0, 0, LGREY|_BLACK, LGREY|_BLACK, LGREY|_BLACK, BLUE|_LGREY);
  1649.  
  1650.       wprints ( 1, 21, CYAN|_BLACK, get_priv_text (config.min_login_level));
  1651.       wprints ( 2, 22, CYAN|_BLACK, get_flagA_text ((config.min_login_flags >> 24) & 0xFF));
  1652.       wprints ( 3, 22, CYAN|_BLACK, get_flagB_text ((config.min_login_flags >> 16) & 0xFF));
  1653.       wprints ( 4, 22, CYAN|_BLACK, get_flagC_text ((config.min_login_flags >> 8) & 0xFF));
  1654.       wprints ( 5, 22, CYAN|_BLACK, get_flagD_text (config.min_login_flags & 0xFF));
  1655.       sprintf (string, "%d", config.min_login_age);
  1656.       wprints ( 6, 22, CYAN|_BLACK, string);
  1657.       sprintf (string, "%d", config.login_timeout);
  1658.       wprints ( 7, 22, CYAN|_BLACK, string);
  1659.  
  1660.       start_update ();
  1661.       i = wmenuget ();
  1662.  
  1663.       switch (i) {
  1664.          case 1:
  1665.             config.min_login_level = select_level (config.min_login_level, 37, 4);
  1666.             break;
  1667.  
  1668.          case 2:
  1669.             config.min_login_flags = window_get_flags (5, 45, 1, config.min_login_flags);
  1670.             break;
  1671.  
  1672.          case 3:
  1673.             config.min_login_flags = window_get_flags (5, 45, 2, config.min_login_flags);
  1674.             break;
  1675.  
  1676.          case 4:
  1677.             config.min_login_flags = window_get_flags (5, 45, 3, config.min_login_flags);
  1678.             break;
  1679.  
  1680.          case 5:
  1681.             config.min_login_flags = window_get_flags (5, 45, 4, config.min_login_flags);
  1682.             break;
  1683.  
  1684.          case 6:
  1685.             sprintf (string, "%d", config.min_login_age);
  1686.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1687.             winpdef (6, 22, string, "???", 0, 1, NULL, 0);
  1688.             if (winpread () != W_ESCPRESS)
  1689.                config.min_login_age = atoi (strbtrim (string));
  1690.             break;
  1691.  
  1692.          case 7:
  1693.             sprintf (string, "%d", config.login_timeout);
  1694.             winpbeg (BLUE|_GREEN, BLUE|_GREEN);
  1695.             winpdef (7, 22, string, "???", 0, 1, NULL, 0);
  1696.             if (winpread () != W_ESCPRESS)
  1697.                config.login_timeout = atoi (strbtrim (string));
  1698.             break;
  1699.       }
  1700.  
  1701.       hidecur ();
  1702.  
  1703.    } while (i != -1);
  1704.  
  1705.    wclose ();
  1706. }
  1707.  
  1708.  
  1709.