home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 September / PCO_0998.ISO / filesbbs / dos / sbbs_src.exe / SBBS / ECHO / ECHOCFG.C next >
Encoding:
C/C++ Source or Header  |  1997-06-03  |  36.1 KB  |  1,128 lines

  1. /* ECHOCFG.C */
  2.  
  3. /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
  4.  
  5. /* Portions written by Allen Christiansen 1994-1996                         */
  6.  
  7. #include <uifc.h>
  8. #include <sys\stat.h>
  9. #include "gen_defs.h"
  10. #include "sbbsdefs.h"
  11. #include "sbbsecho.h"
  12.  
  13. char **opt;
  14.  
  15. void bail(int code);
  16. void main();
  17. char fexist(char *filespec);
  18. char *faddrtoa(faddr_t addr);
  19.  
  20. uchar node_swap=1;
  21. long misc=0;
  22. config_t cfg;
  23.  
  24. unsigned _stklen=16000;
  25.  
  26. void bail(int code)
  27. {
  28.  
  29. if(code)
  30.     getch();
  31. uifcbail();
  32. exit(code);
  33. }
  34.  
  35. #define lprintf cprintf
  36.  
  37. void main(int argc, char **argv)
  38. {
  39.     char str[256],*p;
  40.     int i,j,k,x,file,dflt,nodeop=0;
  41.     FILE *stream;
  42.     echolist_t savlistcfg;
  43.     nodecfg_t savnodecfg;
  44.     arcdef_t savarcdef;
  45.  
  46. fprintf(stderr,"\nSBBSecho Configuration  Version %s  Developed 1995-1997 "
  47.     "Rob Swindell\n\n",SBBSECHO_VER);
  48.  
  49. memset(&cfg,0,sizeof(config_t));
  50. if(argc>1)
  51.     strcpy(str,argv[1]);
  52. else {
  53.     p=getenv("SBBSCTRL");
  54.     if(!p) {
  55.         p=getenv("SBBSNODE");
  56.         if(!p) {
  57.             printf("usage: echocfg [cfg_file]\n");
  58.             exit(1); }
  59.         strcpy(str,p);
  60.         if(str[strlen(str)-1]!='\\')
  61.             strcat(str,"\\");
  62.         strcat(str,"..\\CTRL\\SBBSECHO.CFG"); }
  63.     else {
  64.         strcpy(str,p);
  65.         if(str[strlen(str)-1]!='\\')
  66.             strcat(str,"\\");
  67.         strcat(str,"SBBSECHO.CFG"); } }
  68. strcpy(cfg.cfgfile,str);
  69. strupr(cfg.cfgfile);
  70.  
  71. read_cfg();
  72.  
  73. savnum=0;
  74. if((opt=(char **)MALLOC(sizeof(char *)*300))==NULL) {
  75.     cputs("memory allocation error\r\n");
  76.     bail(1); }
  77. for(i=0;i<300;i++)
  78.     if((opt[i]=(char *)MALLOC(MAX_OPLN))==NULL) {
  79.         cputs("memory allocation error\r\n");
  80.         bail(1); }
  81. uifcini();
  82. sprintf(str,"SBBSecho Configuration v%s",SBBSECHO_VER);
  83. uscrn(str);
  84.  
  85. dflt=0;
  86. while(1) {
  87.     helpbuf=
  88. " SBBSecho Configuration \r\n\r\n"
  89. "Move through the various options using the arrow keys.  Select the\r\n"
  90. "highlighted options by pressing ENTER.\r\n\r\n";
  91.     i=0;
  92.     sprintf(opt[i++],"%-30.30s %s","Mailer Type"
  93.         ,misc&FLO_MAILER ? "Binkley/FLO":"FrontDoor/Attach");
  94.     sprintf(opt[i++],"%-30.30s %luK","Maximum Packet Size"
  95.         ,cfg.maxpktsize/1024UL);
  96.     sprintf(opt[i++],"%-30.30s %luK","Maximum Bundle Size"
  97.         ,cfg.maxbdlsize/1024UL);
  98.     if(cfg.notify)
  99.         sprintf(str,"User #%u",cfg.notify);
  100.     else
  101.         strcpy(str,"Disabled");
  102.     sprintf(opt[i++],"%-30.30s %s","Areafix Failure Notification",str);
  103.     sprintf(opt[i++],"Nodes...");
  104.     sprintf(opt[i++],"Paths...");
  105.     sprintf(opt[i++],"Log Options...");
  106.     sprintf(opt[i++],"Toggle Options...");
  107.     sprintf(opt[i++],"Archive Programs...");
  108.     sprintf(opt[i++],"Additional Echo Lists...");
  109.     opt[i][0]=NULL;
  110.     switch(ulist(WIN_ORG|WIN_MID|WIN_ACT|WIN_ESC,0,0,52,&dflt,0
  111.     ,cfg.cfgfile,opt)) {
  112.  
  113.         case 0:
  114.             misc^=FLO_MAILER;
  115.             break;
  116.  
  117.         case 1:
  118. helpbuf=
  119. " Maximum Packet Size \r\n\r\n"
  120. "This is the maximum file size that SBBSecho will create when placing\r\n"
  121. "outgoing messages into packets.  The default size is 250k.\r\n";
  122.             sprintf(str,"%lu",cfg.maxpktsize);
  123.             uinput(WIN_MID|WIN_BOT,0,0,"Maximum Packet Size",str
  124.                 ,9,K_EDIT|K_NUMBER);
  125.             cfg.maxpktsize=atol(str);
  126.             break;
  127.  
  128.         case 2:
  129. helpbuf=
  130. " Maximum Bundle Size \r\n\r\n"
  131. "This is the maximum file size that SBBSecho will create when placing\r\n"
  132. "outgoing packets into bundles.  The default size is 250k.\r\n";
  133.             sprintf(str,"%lu",cfg.maxbdlsize);
  134.             uinput(WIN_MID|WIN_BOT,0,0,"Maximum Bundle Size",str
  135.                 ,9,K_EDIT|K_NUMBER);
  136.             cfg.maxbdlsize=atol(str);
  137.             break;
  138.  
  139.         case 3:
  140. helpbuf=
  141. " Areafix Failure Notification \r\n\r\n"
  142. "Setting this option to a user number (usually #1), enables the\r\n"
  143. "automatic notification of that user, via e-mail, of failed areafix\r\n"
  144. "attempts. Setting this option to 0, disables this feature.\r\n";
  145.             sprintf(str,"%u",cfg.notify);
  146.             uinput(WIN_MID|WIN_BOT,0,0,"Areafix Notification User Number",str
  147.                 ,5,K_EDIT|K_NUMBER);
  148.             cfg.notify=atoi(str);
  149.             break;
  150.  
  151.         case 4:
  152. helpbuf=
  153. " Nodes... \r\n\r\n"
  154. "From this menu you can configure the area manager options for your\r\n"
  155. "uplink nodes.\r\n";
  156.             i=0;
  157.             while(1) {
  158.                 for(j=0;j<cfg.nodecfgs;j++)
  159.                     strcpy(opt[j],faddrtoa(cfg.nodecfg[j].faddr));
  160.                 opt[j][0]=0;
  161.                 i=ulist(WIN_ORG|WIN_INS|WIN_DEL|WIN_ACT|WIN_GET|WIN_PUT
  162.                     |WIN_INSACT|WIN_DELACT|WIN_XTR
  163.                     ,0,0,0,&i,0,"Nodes",opt);
  164.                 if(i==-1)
  165.                     break;
  166.                 if((i&MSK_ON)==MSK_INS) {
  167.                     i&=MSK_OFF;
  168.                     str[0]=0;
  169. helpbuf=
  170. " Address \r\n\r\n"
  171. "This is the FidoNet style address of the node you wish to add\r\n";
  172.                     if(uinput(WIN_MID,0,0
  173.                         ,"Node Address (ALL wildcard allowed)",str
  174.                         ,25,K_EDIT)<1)
  175.                         continue;
  176.                     if((cfg.nodecfg=(nodecfg_t *)REALLOC(cfg.nodecfg
  177.                         ,sizeof(nodecfg_t)*(cfg.nodecfgs+1)))==NULL) {
  178.                         printf("\nMemory Allocation Error\n");
  179.                         exit(1); }
  180.                     for(j=cfg.nodecfgs;j>i;j--)
  181.                         memcpy(&cfg.nodecfg[j],&cfg.nodecfg[j-1]
  182.                             ,sizeof(nodecfg_t));
  183.                     cfg.nodecfgs++;
  184.                     memset(&cfg.nodecfg[i],0,sizeof(nodecfg_t));
  185.                     cfg.nodecfg[i].faddr=atofaddr(str);
  186.                     continue; }
  187.  
  188.                 if((i&MSK_ON)==MSK_DEL) {
  189.                     i&=MSK_OFF;
  190.                     cfg.nodecfgs--;
  191.                     if(cfg.nodecfgs<=0) {
  192.                         cfg.nodecfgs=0;
  193.                         continue; }
  194.                     for(j=i;j<cfg.nodecfgs;j++)
  195.                         memcpy(&cfg.nodecfg[j],&cfg.nodecfg[j+1]
  196.                             ,sizeof(nodecfg_t));
  197.                     if((cfg.nodecfg=(nodecfg_t *)REALLOC(cfg.nodecfg
  198.                         ,sizeof(nodecfg_t)*(cfg.nodecfgs)))==NULL) {
  199.                         printf("\nMemory Allocation Error\n");
  200.                         exit(1); }
  201.                     continue; }
  202.                 if((i&MSK_ON)==MSK_GET) {
  203.                     i&=MSK_OFF;
  204.                     memcpy(&savnodecfg,&cfg.nodecfg[i],sizeof(nodecfg_t));
  205.                     continue; }
  206.                 if((i&MSK_ON)==MSK_PUT) {
  207.                     i&=MSK_OFF;
  208.                     memcpy(&cfg.nodecfg[i],&savnodecfg,sizeof(nodecfg_t));
  209.                     continue; }
  210.                 while(1) {
  211. helpbuf=
  212. " Node Options \r\n\r\n"
  213. "These are the configurable options available for this node.\r\n";
  214.                     j=0;
  215.                     sprintf(opt[j++],"%-20.20s %s","Address"
  216.                         ,faddrtoa(cfg.nodecfg[i].faddr));
  217.                     sprintf(opt[j++],"%-20.20s %s","Archive Type"
  218.                         ,cfg.nodecfg[i].arctype>cfg.arcdefs ?
  219.                         "None":cfg.arcdef[cfg.nodecfg[i].arctype].name);
  220.                     sprintf(opt[j++],"%-20.20s %s","Packet Type"
  221.                         ,cfg.nodecfg[i].pkt_type==PKT_TWO ? "2"
  222.                         :cfg.nodecfg[i].pkt_type==PKT_TWO_TWO ? "2.2":"2+");
  223.                     sprintf(opt[j++],"%-20.20s %s","Packet Password"
  224.                         ,cfg.nodecfg[i].pktpwd);
  225.                     sprintf(opt[j++],"%-20.20s %s","Areafix Password"
  226.                         ,cfg.nodecfg[i].password);
  227.                     str[0]=0;
  228.                     for(k=0;k<cfg.nodecfg[i].numflags;k++) {
  229.                         strcat(str,cfg.nodecfg[i].flag[k].flag);
  230.                         strcat(str," "); }
  231.                     sprintf(opt[j++],"%-20.20s %s","Areafix Flags",str);
  232.                     sprintf(opt[j++],"%-20.20s %s","Status"
  233.                         ,cfg.nodecfg[i].attr&ATTR_CRASH ? "Crash"
  234.                         :cfg.nodecfg[i].attr&ATTR_HOLD ? "Hold" : "None");
  235.                     sprintf(opt[j++],"%-20.20s %s","Direct"
  236.                         ,cfg.nodecfg[i].attr&ATTR_DIRECT ? "Yes":"No");
  237.                     sprintf(opt[j++],"%-20.20s %s","Passive"
  238.                         ,cfg.nodecfg[i].attr&ATTR_PASSIVE ? "Yes":"No");
  239.                     sprintf(opt[j++],"%-20.20s %s","Send Notify List"
  240.                         ,cfg.nodecfg[i].attr&SEND_NOTIFY ? "Yes" : "No");
  241.                     if(misc&FLO_MAILER)
  242.                         sprintf(opt[j++],"%-20.20s %s","Route To"
  243.                             ,cfg.nodecfg[i].route.zone
  244.                             ? faddrtoa(cfg.nodecfg[i].route) : "Disabled");
  245.                     opt[j][0]=0;
  246.                     k=ulist(WIN_MID|WIN_ACT,0,0,40,&nodeop,0
  247.                         ,faddrtoa(cfg.nodecfg[i].faddr),opt);
  248.                     if(k==-1)
  249.                         break;
  250.                     switch(k) {
  251.                         case 0:
  252. helpbuf=
  253. " Address \r\n\r\n"
  254. "This is the FidoNet style address of this node.\r\n";
  255.                             strcpy(str,faddrtoa(cfg.nodecfg[i].faddr));
  256.                             uinput(WIN_MID|WIN_SAV,0,0
  257.                                 ,"Node Address (ALL wildcard allowed)",str
  258.                                 ,25,K_EDIT|K_UPPER);
  259.                             cfg.nodecfg[i].faddr=atofaddr(str);
  260.                             break;
  261.                         case 1:
  262. helpbuf=
  263. " Archive Type \r\n\r\n"
  264. "This is the compression type that will be used for compressing packets\r\n"
  265. "to and decompressing packets from this node.\r\n";
  266.                             for(j=0;j<cfg.arcdefs;j++)
  267.                                 strcpy(opt[j],cfg.arcdef[j].name);
  268.                             strcpy(opt[j++],"None");
  269.                             opt[j][0]=0;
  270.                             if(cfg.nodecfg[i].arctype<j)
  271.                                 j=cfg.nodecfg[i].arctype;
  272.                             k=ulist(WIN_RHT|WIN_SAV,0,0,0,&j,0
  273.                                 ,"Archive Type",opt);
  274.                             if(k==-1)
  275.                                 break;
  276.                             if(k>=cfg.arcdefs)
  277.                                 cfg.nodecfg[i].arctype=0xffff;
  278.                             else
  279.                                 cfg.nodecfg[i].arctype=k;
  280.                             break;
  281.                         case 2:
  282. helpbuf=
  283. " Packet Type \r\n\r\n"
  284. "This is the packet header type that will be used in mail packets to\r\n"
  285. "this node.  SBBSecho defaults to using type 2.2.\r\n";
  286.                             j=0;
  287.                             strcpy(opt[j++],"2+");
  288.                             strcpy(opt[j++],"2.2");
  289.                             strcpy(opt[j++],"2");
  290.                             opt[j][0]=0;
  291.                             j=cfg.nodecfg[i].pkt_type;
  292.                             k=ulist(WIN_RHT|WIN_SAV,0,0,0,&j,0,"Packet Type"
  293.                                 ,opt);
  294.                             if(k==-1)
  295.                                 break;
  296.                             cfg.nodecfg[i].pkt_type=k;
  297.                             break;
  298.                         case 3:
  299. helpbuf=
  300. " Packet Password \r\n\r\n"
  301. "This is an optional password that SBBSecho will place into packets\r\n"
  302. "destined for this node.\r\n";
  303.                             uinput(WIN_MID|WIN_SAV,0,0
  304.                                 ,"Packet Password (optional)"
  305.                                 ,cfg.nodecfg[i].pktpwd,8,K_EDIT|K_UPPER);
  306.                             break;
  307.                         case 4:
  308. helpbuf=
  309. " Areafix Password \r\n\r\n"
  310. "This is the password that will be used by this node when doing remote\r\n"
  311. "areamanager functions.\r\n";
  312.                             uinput(WIN_MID|WIN_SAV,0,0
  313.                                 ,"Areafix Password"
  314.                                 ,cfg.nodecfg[i].password,8,K_EDIT|K_UPPER);
  315.                             break;
  316.                         case 5:
  317. helpbuf=
  318. " Areafix Flag \r\n\r\n"
  319. "This is a flag to to be given to this node allowing access to one or\r\n"
  320. "more of the configured echo lists\r\n";
  321.                             while(1) {
  322.                                 for(j=0;j<cfg.nodecfg[i].numflags;j++)
  323.                                     strcpy(opt[j],cfg.nodecfg[i].flag[j].flag);
  324.                                 opt[j][0]=0;
  325.                                 k=ulist(WIN_SAV|WIN_INS|WIN_DEL|WIN_ACT|
  326.                                     WIN_XTR|WIN_INSACT|WIN_DELACT|WIN_RHT
  327.                                     ,0,0,0,&k,0,"Areafix Flags",opt);
  328.                                 if(k==-1)
  329.                                     break;
  330.                                 if((k&MSK_ON)==MSK_INS) {
  331.                                     k&=MSK_OFF;
  332.                                     str[0]=0;
  333.                                     if(uinput(WIN_MID|WIN_SAV,0,0
  334.                                         ,"Areafix Flag",str,4
  335.                                         ,K_EDIT|K_UPPER)<1)
  336.                                         continue;
  337.                                     if((cfg.nodecfg[i].flag=(flag_t *)
  338.                                         REALLOC(cfg.nodecfg[i].flag
  339.                                         ,sizeof(flag_t)*
  340.                                         (cfg.nodecfg[i].numflags+1)))==NULL) {
  341.                                         printf("\nMemory Allocation Error\n");
  342.                                         exit(1); }
  343.                                     for(j=cfg.nodecfg[i].numflags;j>i;j--)
  344.                                         memcpy(&cfg.nodecfg[i].flag[j]
  345.                                             ,&cfg.nodecfg[i].flag[j-1]
  346.                                             ,sizeof(flag_t));
  347.                                     cfg.nodecfg[i].numflags++;
  348.                                     memset(&cfg.nodecfg[i].flag[k].flag
  349.                                         ,0,sizeof(flag_t));
  350.                                     strcpy(cfg.nodecfg[i].flag[k].flag,str);
  351.                                     continue; }
  352.  
  353.                                 if((k&MSK_ON)==MSK_DEL) {
  354.                                     k&=MSK_OFF;
  355.                                     cfg.nodecfg[i].numflags--;
  356.                                     if(cfg.nodecfg[i].numflags<=0) {
  357.                                         cfg.nodecfg[i].numflags=0;
  358.                                         continue; }
  359.                                     for(j=k;j<cfg.nodecfg[i].numflags;j++)
  360.                                         strcpy(cfg.nodecfg[i].flag[j].flag
  361.                                             ,cfg.nodecfg[i].flag[j+1].flag);
  362.                                     if((cfg.nodecfg[i].flag=(flag_t *)
  363.                                         REALLOC(cfg.nodecfg[i].flag
  364.                                         ,sizeof(flag_t)*
  365.                                         (cfg.nodecfg[i].numflags)))==NULL) {
  366.                                         printf("\nMemory Allocation Error\n");
  367.                                         exit(1); }
  368.                                     continue; }
  369.                                 strcpy(str,cfg.nodecfg[i].flag[k].flag);
  370.                                 uinput(WIN_MID|WIN_SAV,0,0,"Areafix Flag"
  371.                                     ,str,4,K_EDIT|K_UPPER);
  372.                                 strcpy(cfg.nodecfg[i].flag[k].flag,str);
  373.                                 continue; }
  374.                             break;
  375.                         case 6:
  376.                             if(cfg.nodecfg[i].attr&ATTR_CRASH) {
  377.                                 cfg.nodecfg[i].attr^=ATTR_CRASH;
  378.                                 cfg.nodecfg[i].attr|=ATTR_HOLD;
  379.                                 break; }
  380.                             if(cfg.nodecfg[i].attr&ATTR_HOLD) {
  381.                                 cfg.nodecfg[i].attr^=ATTR_HOLD;
  382.                                 break; }
  383.                             cfg.nodecfg[i].attr|=ATTR_CRASH;
  384.                             break;
  385.                         case 7:
  386.                             cfg.nodecfg[i].attr^=ATTR_DIRECT;
  387.                             break;
  388.                         case 8:
  389.                             cfg.nodecfg[i].attr^=ATTR_PASSIVE;
  390.                             break;
  391.                         case 9:
  392.                             cfg.nodecfg[i].attr^=SEND_NOTIFY;
  393.                             break;
  394.                         case 10:
  395. helpbuf=
  396. " Route To \r\n\r\n"
  397. "When using a FLO type mailer, this is the node number of an address\r\n"
  398. "to route mail to for this node.\r\n";
  399.                             strcpy(str,faddrtoa(cfg.nodecfg[i].route));
  400.                             uinput(WIN_MID|WIN_SAV,0,0
  401.                                 ,"Node Address to Route To",str
  402.                                 ,25,K_EDIT);
  403.                                 if(str[0])
  404.                                     cfg.nodecfg[i].route=atofaddr(str);
  405.                             break;
  406.                             } } }
  407.             break;
  408.  
  409.         case 5:
  410. helpbuf=
  411. " Paths... \r\n\r\n"
  412. "From this menu you can configure the paths that SBBSecho will use\r\n"
  413. "when importing and exporting.\r\n";
  414.             j=0;
  415.             while(1) {
  416.                 i=0;
  417.                 sprintf(opt[i++],"%-30.30s %s","Inbound Directory"
  418.                     ,cfg.inbound[0] ? cfg.inbound : "<Specified in SCFG>");
  419.                 sprintf(opt[i++],"%-30.30s %s","Secure Inbound (optional)"
  420.                     ,cfg.secure[0] ? cfg.secure : "None Specified");
  421.                 sprintf(opt[i++],"%-30.30s %s","Outbound Directory"
  422.                     ,cfg.outbound);
  423.                 sprintf(opt[i++],"%-30.30s %s","Area File"
  424.                     ,cfg.areafile[0] ? cfg.areafile
  425.                     : "SCFG->DATA\\AREAS.BBS");
  426.                 sprintf(opt[i++],"%-30.30s %s","Log File"
  427.                     ,cfg.logfile[0] ? cfg.logfile
  428.                     : "SCFG->DATA\\SBBSECHO.LOG");
  429.                 opt[i][0]=NULL;
  430.                 j=ulist(WIN_MID|WIN_ACT,0,0,60,&j,0
  431.                     ,"Paths and Filenames",opt);
  432.                 if(j==-1)
  433.                     break;
  434.                 switch(j) {
  435.                     case 0:
  436. helpbuf=
  437. " Inbound Directory \r\n\r\n"
  438. "This is the complete path (drive and directory) where your front\r\n"
  439. "end mailer stores, and where SBBSecho will look for, incoming message\r\n"
  440. "bundles and packets.";
  441.                         uinput(WIN_MID|WIN_SAV,0,0,"Inbound",cfg.inbound
  442.                             ,50,K_EDIT|K_UPPER);
  443.                         break;
  444.  
  445.                     case 1:
  446. helpbuf=
  447. " Secure Inbound Directory \r\n\r\n"
  448. "This is the complete path (drive and directory) where your front\r\n"
  449. "end mailer stores, and where SBBSecho will look for, incoming message\r\n"
  450. "bundles and packets for SECURE sessions.";
  451.                         uinput(WIN_MID|WIN_SAV,0,0,"Secure Inbound",cfg.secure
  452.                             ,50,K_EDIT|K_UPPER);
  453.                         break;
  454.  
  455.                     case 2:
  456. helpbuf=
  457. " Outbound Directory \r\n\r\n"
  458. "This is the complete path (drive and directory) where your front\r\n"
  459. "end mailer will look for, and where SBBSecho will place, outgoing\r\n"
  460. "message bundles and packets.";
  461.                         uinput(WIN_MID|WIN_SAV,0,0,"Outbound",cfg.outbound
  462.                             ,50,K_EDIT|K_UPPER);
  463.                         break;
  464.  
  465.                     case 3:
  466. helpbuf=
  467. " Area File \r\n\r\n"
  468. "This is the complete path (drive, directory, and filename) of the\r\n"
  469. "file SBBSecho will use as your AREAS.BBS file.";
  470.                         uinput(WIN_MID|WIN_SAV,0,0,"Areafile",cfg.areafile
  471.                             ,50,K_EDIT|K_UPPER);
  472.                         break;
  473.  
  474.                     case 4:
  475. helpbuf=
  476. " Log File \r\n\r\n"
  477. "This is the complete path (drive, directory, and filename) of the\r\n"
  478. "file SBBSecho will use to log information each time it is run.";
  479.                         uinput(WIN_MID|WIN_SAV,0,0,"Logfile",cfg.logfile
  480.                             ,50,K_EDIT|K_UPPER);
  481.                         break; } }
  482.             break;
  483.         case 6:
  484. helpbuf=
  485. " Log Options \r\n"
  486. "\r\n"
  487. "Each loggable item can be toggled off or on from this menu. You must run\r\n"
  488. "SBBSecho with the /L command line option for any of these items to be\r\n"
  489. "logged.";
  490.             j=0;
  491.             while(1) {
  492.                 i=0;
  493.                 strcpy(opt[i++],"ALL");
  494.                 strcpy(opt[i++],"NONE");
  495.                 strcpy(opt[i++],"DEFAULT");
  496.                 sprintf(opt[i++],"%-35.35s%-3.3s","Ignored NetMail Messages"
  497.                     ,cfg.log&LOG_IGNORED ? "Yes":"No");
  498.                 sprintf(opt[i++],"%-35.35s%-3.3s","NetMail for Unknown Users"
  499.                     ,cfg.log&LOG_UNKNOWN ? "Yes":"No");
  500.                 sprintf(opt[i++],"%-35.35s%-3.3s","Areafix NetMail Messages"
  501.                     ,cfg.log&LOG_AREAFIX ? "Yes":"No");
  502.                 sprintf(opt[i++],"%-35.35s%-3.3s","Imported NetMail Messages"
  503.                     ,cfg.log&LOG_IMPORTED ? "Yes":"No");
  504.                 sprintf(opt[i++],"%-35.35s%-3.3s","Packing Out-bound NetMail"
  505.                     ,cfg.log&LOG_PACKING ? "Yes":"No");
  506.                 sprintf(opt[i++],"%-35.35s%-3.3s","Routing Out-bound NetMail"
  507.                     ,cfg.log&LOG_ROUTING ? "Yes":"No");
  508.                 sprintf(opt[i++],"%-35.35s%-3.3s","In-bound Packet Information"
  509.                     ,cfg.log&LOG_PACKETS ? "Yes":"No");
  510.                 sprintf(opt[i++],"%-35.35s%-3.3s","In-bound Security Violations"
  511.                     ,cfg.log&LOG_SECURITY ? "Yes":"No");
  512.                 sprintf(opt[i++],"%-35.35s%-3.3s","In-bound Grunged Messages"
  513.                     ,cfg.log&LOG_GRUNGED ? "Yes":"No");
  514.                 sprintf(opt[i++],"%-35.35s%-3.3s","Disallowed Private EchoMail"
  515.                     ,cfg.log&LOG_PRIVATE ? "Yes":"No");
  516.                 sprintf(opt[i++],"%-35.35s%-3.3s","Circular EchoMail Messages"
  517.                     ,cfg.log&LOG_CIRCULAR ? "Yes":"No");
  518.                 sprintf(opt[i++],"%-35.35s%-3.3s","Duplicate EchoMail Messages"
  519.                     ,cfg.log&LOG_DUPES ? "Yes":"No");
  520.                 sprintf(opt[i++],"%-35.35s%-3.3s","Area Totals"
  521.                     ,cfg.log&LOG_AREA_TOTALS ? "Yes":"No");
  522.                 sprintf(opt[i++],"%-35.35s%-3.3s","Over-All Totals"
  523.                     ,cfg.log&LOG_TOTALS ? "Yes":"No");
  524.                 opt[i][0]=NULL;
  525.                 j=ulist(0,0,0,43,&j,0,"Log Options",opt);
  526.                 if(j==-1)
  527.                     break;
  528.                 switch(j) {
  529.                     case 0:
  530.                         cfg.log=~0L;
  531.                         break;
  532.                     case 1:
  533.                         cfg.log=0;
  534.                         break;
  535.                     case 2:
  536.                         cfg.log=LOG_DEFAULTS;
  537.                         break;
  538.                     case 3:
  539.                         cfg.log^=LOG_IGNORED;
  540.                         break;
  541.                     case 4:
  542.                         cfg.log^=LOG_UNKNOWN;
  543.                         break;
  544.                     case 5:
  545.                         cfg.log^=LOG_AREAFIX;
  546.                         break;
  547.                     case 6:
  548.                         cfg.log^=LOG_IMPORTED;
  549.                         break;
  550.                     case 7:
  551.                         cfg.log^=LOG_PACKING;
  552.                         break;
  553.                     case 8:
  554.                         cfg.log^=LOG_ROUTING;
  555.                         break;
  556.                     case 9:
  557.                         cfg.log^=LOG_PACKETS;
  558.                         break;
  559.                     case 10:
  560.                         cfg.log^=LOG_SECURITY;
  561.                         break;
  562.                     case 11:
  563.                         cfg.log^=LOG_GRUNGED;
  564.                         break;
  565.                     case 12:
  566.                         cfg.log^=LOG_PRIVATE;
  567.                         break;
  568.                     case 13:
  569.                         cfg.log^=LOG_CIRCULAR;
  570.                         break;
  571.                     case 14:
  572.                         cfg.log^=LOG_DUPES;
  573.                         break;
  574.                     case 15:
  575.                         cfg.log^=LOG_AREA_TOTALS;
  576.                         break;
  577.                     case 16:
  578.                         cfg.log^=LOG_TOTALS;
  579.                         break; } }
  580.             break;
  581.  
  582.  
  583.         case 7:
  584. helpbuf=
  585. "Secure Operation tells SBBSecho to check the AREAS.BBS file to insure\r\n"
  586. "    that the packet origin exists there as well as check the password of\r\n"
  587. "    that node (if configured).\r\n\r\n"
  588. "Swap for Executables tells SBBSecho whether or not it should swap\r\n"
  589. "    out of memory when executing external executables.\r\n\r\n"
  590. "Fuzzy Zone Operation when set to yes if SBBSecho receives an inbound\r\n"
  591. "    netmail with no international zone information, it will compare the\r\n"
  592. "    net/node of the destination to the net/node information in your AKAs\r\n"
  593. "    and assume the zone of a matching AKA.\r\n\r\n"
  594. "Store PATH/SEEN-BY/Unkown Kludge Lines in Message Base allows you to\r\n"
  595. "    determine whether or not SBBSecho will store this information from\r\n"
  596. "    incoming messages in the Synchronet message base.\r\n\r\n"
  597. "Allow Nodes to Add Areas in the AREAS.BBS List when set to YES allows\r\n"
  598. "    uplinks to add areas listed in the AREAS.BBS file\r\n";
  599.             j=0;
  600.             while(1) {
  601.                 i=0;
  602.                 sprintf(opt[i++],"%-50.50s%-3.3s","Secure Operation"
  603.                     ,misc&SECURE ? "Yes":"No");
  604.                 sprintf(opt[i++],"%-50.50s%-3.3s","Swap for Executables"
  605.                     ,node_swap ? "Yes":"No");
  606.                 sprintf(opt[i++],"%-50.50s%-3.3s","Fuzzy Zone Operation"
  607.                     ,misc&FUZZY_ZONE ? "Yes":"No");
  608.                 sprintf(opt[i++],"%-50.50s%-3.3s","Store PATH Lines in "
  609.                     "Message Base",misc&STORE_SEENBY ? "Yes":"No");
  610.                 sprintf(opt[i++],"%-50.50s%-3.3s","Store SEEN-BY Lines in "
  611.                     "Message Base",misc&STORE_PATH ? "Yes":"No");
  612.                 sprintf(opt[i++],"%-50.50s%-3.3s","Store Unknown Kludge Lines "
  613.                     "in Message Base",misc&STORE_KLUDGE ? "Yes":"No");
  614.                 sprintf(opt[i++],"%-50.50s%-3.3s","Allow Nodes to Add Areas "
  615.                     "in the AREAS.BBS List",misc&ELIST_ONLY?"No":"Yes");
  616.                 sprintf(opt[i++],"%-50.50s%-3.3s","Kill/Ignore Empty NetMail "
  617.                     "Messages",misc&KILL_EMPTY_MAIL ? "Yes":"No");
  618.                 opt[i][0]=NULL;
  619.                 j=ulist(0,0,0,60,&j,0,"Toggle Options",opt);
  620.                 if(j==-1)
  621.                     break;
  622.                 switch(j) {
  623.                     case 0:
  624.                         misc^=SECURE;
  625.                         break;
  626.                     case 1:
  627.                         if(node_swap)
  628.                             node_swap=0;
  629.                         else
  630.                             node_swap=1;
  631.                         break;
  632.                     case 2:
  633.                         misc^=FUZZY_ZONE;
  634.                         break;
  635.                     case 3:
  636.                         misc^=STORE_SEENBY;
  637.                         break;
  638.                     case 4:
  639.                         misc^=STORE_PATH;
  640.                         break;
  641.                     case 5:
  642.                         misc^=STORE_KLUDGE;
  643.                         break;
  644.                     case 6:
  645.                         misc^=ELIST_ONLY;
  646.                         break;
  647.                     case 7:
  648.                         misc^=KILL_EMPTY_MAIL;
  649.                         } }
  650.             break;
  651.         case 8:
  652. helpbuf=
  653. " Archive Programs \r\n\r\n"
  654. "These are the archiving programs (types) which are available for\r\n"
  655. "compressing outgoing packets.\r\n";
  656.             i=0;
  657.             while(1) {
  658.                 for(j=0;j<cfg.arcdefs;j++)
  659.                     sprintf(opt[j],"%-30.30s",cfg.arcdef[j].name);
  660.                 opt[j][0]=0;
  661.                 i=ulist(WIN_ORG|WIN_INS|WIN_DEL|WIN_ACT|WIN_GET|WIN_PUT
  662.                     |WIN_INSACT|WIN_DELACT|WIN_XTR
  663.                     ,0,0,0,&i,0,"Archive Programs",opt);
  664.                 if(i==-1)
  665.                     break;
  666.                 if((i&MSK_ON)==MSK_INS) {
  667.                     i&=MSK_OFF;
  668.                     str[0]=0;
  669. helpbuf=
  670. " Packer Name \r\n\r\n"
  671. "This is the identifying name of the archiving program\r\n";
  672.                     if(uinput(WIN_MID,0,0
  673.                         ,"Packer Name",str,25,K_EDIT|K_UPPER)<1)
  674.                         continue;
  675.                     if((cfg.arcdef=(arcdef_t *)REALLOC(cfg.arcdef
  676.                         ,sizeof(arcdef_t)*(cfg.arcdefs+1)))==NULL) {
  677.                         printf("\nMemory Allocation Error\n");
  678.                         exit(1); }
  679.                     for(j=cfg.arcdefs;j>i;j--)
  680.                         memcpy(&cfg.arcdef[j],&cfg.arcdef[j-1]
  681.                             ,sizeof(arcdef_t));
  682.                         strcpy(cfg.arcdef[j].name
  683.                             ,cfg.arcdef[j-1].name);
  684.                     cfg.arcdefs++;
  685.                     memset(&cfg.arcdef[i],0,sizeof(arcdef_t));
  686.                     strcpy(cfg.arcdef[i].name,str);
  687.                     continue; }
  688.  
  689.                 if((i&MSK_ON)==MSK_DEL) {
  690.                     i&=MSK_OFF;
  691.                     cfg.arcdefs--;
  692.                     if(cfg.arcdefs<=0) {
  693.                         cfg.arcdefs=0;
  694.                         continue; }
  695.                     for(j=i;j<cfg.arcdefs;j++)
  696.                         memcpy(&cfg.arcdef[j],&cfg.arcdef[j+1]
  697.                             ,sizeof(arcdef_t));
  698.                     if((cfg.arcdef=(arcdef_t *)REALLOC(cfg.arcdef
  699.                         ,sizeof(arcdef_t)*(cfg.arcdefs)))==NULL) {
  700.                         printf("\nMemory Allocation Error\n");
  701.                         exit(1); }
  702.                     continue; }
  703.                 if((i&MSK_ON)==MSK_GET) {
  704.                     i&=MSK_OFF;
  705.                     memcpy(&savarcdef,&cfg.arcdef[i],sizeof(arcdef_t));
  706.                     continue; }
  707.                 if((i&MSK_ON)==MSK_PUT) {
  708.                     i&=MSK_OFF;
  709.                     memcpy(&cfg.arcdef[i],&savarcdef,sizeof(arcdef_t));
  710.                     continue; }
  711.                 while(1) {
  712.                     j=0;
  713.                     sprintf(opt[j++],"%-20.20s %s","Packer Name"
  714.                         ,cfg.arcdef[i].name);
  715.                     sprintf(opt[j++],"%-20.20s %s","Hexadecimal ID"
  716.                         ,cfg.arcdef[i].hexid);
  717.                     sprintf(opt[j++],"%-20.20s %u","Offset to Hex ID"
  718.                         ,cfg.arcdef[i].byteloc);
  719.                     sprintf(opt[j++],"%-20.20s %s","Pack Command Line"
  720.                         ,cfg.arcdef[i].pack);
  721.                     sprintf(opt[j++],"%-20.20s %s","Unpack Command Line"
  722.                         ,cfg.arcdef[i].unpack);
  723.                     opt[j][0]=0;
  724.                     sprintf(str,"%.30s",cfg.arcdef[i].name);
  725.                     k=ulist(WIN_MID|WIN_ACT,0,0,60,&nodeop,0,str,opt);
  726.                     if(k==-1)
  727.                         break;
  728.                     switch(k) {
  729.                         case 0:
  730.                             uinput(WIN_MID|WIN_SAV,0,0
  731.                                 ,"Packer Name",cfg.arcdef[i].name,25
  732.                                 ,K_EDIT|K_UPPER);
  733.                             break;
  734.                         case 1:
  735.                             uinput(WIN_MID|WIN_SAV,0,0
  736.                                 ,"Hexadecimal ID",cfg.arcdef[i].hexid,25
  737.                                 ,K_EDIT|K_UPPER);
  738.                             break;
  739.                         case 2:
  740.                             sprintf(str,"%u",cfg.arcdef[i].byteloc);
  741.                             uinput(WIN_MID|WIN_SAV,0,0
  742.                                 ,"Offset to Hex ID",str,5
  743.                                 ,K_NUMBER|K_EDIT);
  744.                             cfg.arcdef[i].byteloc=atoi(str);
  745.                             break;
  746.                         case 3:
  747.                             uinput(WIN_MID|WIN_SAV,0,0
  748.                                 ,"Pack Command Line",cfg.arcdef[i].pack,50
  749.                                 ,K_EDIT);
  750.                             break;
  751.                         case 4:
  752.                             uinput(WIN_MID|WIN_SAV,0,0
  753.                                 ,"Unpack Command Line",cfg.arcdef[i].unpack,50
  754.                                 ,K_EDIT);
  755.                             break;
  756.                             } } }
  757.             break;
  758.         case 9:
  759. helpbuf=
  760. " Additional Echo Lists \r\n\r\n"
  761. "This feature allows you to specify echo lists (in addition to your\r\n"
  762. "AREAS.BBS file) for SBBSecho to search for area add requests.\r\n";
  763.             i=0;
  764.             while(1) {
  765.                 for(j=0;j<cfg.listcfgs;j++)
  766.                     sprintf(opt[j],"%-50.50s",cfg.listcfg[j].listpath);
  767.                 opt[j][0]=0;
  768.                 i=ulist(WIN_ORG|WIN_INS|WIN_DEL|WIN_ACT|WIN_GET|WIN_PUT
  769.                     |WIN_INSACT|WIN_DELACT|WIN_XTR
  770.                     ,0,0,0,&i,0,"Additional Echo Lists",opt);
  771.                 if(i==-1)
  772.                     break;
  773.                 if((i&MSK_ON)==MSK_INS) {
  774.                     i&=MSK_OFF;
  775.                     str[0]=0;
  776. helpbuf=
  777. " Echo List \r\n\r\n"
  778. "This is the path and filename of the echo list file you wish\r\n"
  779. "to add.\r\n";
  780.                     if(uinput(WIN_MID|WIN_SAV,0,0
  781.                         ,"Echo List Path/Name",str,50,K_EDIT|K_UPPER)<1)
  782.                         continue;
  783.                     if((cfg.listcfg=(echolist_t *)REALLOC(cfg.listcfg
  784.                         ,sizeof(echolist_t)*(cfg.listcfgs+1)))==NULL) {
  785.                         printf("\nMemory Allocation Error\n");
  786.                         exit(1); }
  787.                     for(j=cfg.listcfgs;j>i;j--)
  788.                         memcpy(&cfg.listcfg[j],&cfg.listcfg[j-1]
  789.                             ,sizeof(echolist_t));
  790.                     cfg.listcfgs++;
  791.                     memset(&cfg.listcfg[i],0,sizeof(echolist_t));
  792.                     strcpy(cfg.listcfg[i].listpath,str);
  793.                     continue; }
  794.  
  795.                 if((i&MSK_ON)==MSK_DEL) {
  796.                     i&=MSK_OFF;
  797.                     cfg.listcfgs--;
  798.                     if(cfg.listcfgs<=0) {
  799.                         cfg.listcfgs=0;
  800.                         continue; }
  801.                     for(j=i;j<cfg.listcfgs;j++)
  802.                         memcpy(&cfg.listcfg[j],&cfg.listcfg[j+1]
  803.                             ,sizeof(echolist_t));
  804.                     if((cfg.listcfg=(echolist_t *)REALLOC(cfg.listcfg
  805.                         ,sizeof(echolist_t)*(cfg.listcfgs)))==NULL) {
  806.                         printf("\nMemory Allocation Error\n");
  807.                         exit(1); }
  808.                     continue; }
  809.                 if((i&MSK_ON)==MSK_GET) {
  810.                     i&=MSK_OFF;
  811.                     memcpy(&savlistcfg,&cfg.listcfg[i],sizeof(echolist_t));
  812.                     continue; }
  813.                 if((i&MSK_ON)==MSK_PUT) {
  814.                     i&=MSK_OFF;
  815.                     memcpy(&cfg.listcfg[i],&savlistcfg,sizeof(echolist_t));
  816.                     continue; }
  817.                 while(1) {
  818.                     j=0;
  819.                     sprintf(opt[j++],"%-20.20s %.19s","Echo List Path/Name"
  820.                         ,cfg.listcfg[i].listpath);
  821.                     sprintf(opt[j++],"%-20.20s %s","Hub Address"
  822.                         ,(cfg.listcfg[i].forward.zone) ?
  823.                          faddrtoa(cfg.listcfg[i].forward) : "None");
  824.                     sprintf(opt[j++],"%-20.20s %s","Forward Password"
  825.                         ,(cfg.listcfg[i].password[0]) ?
  826.                          cfg.listcfg[i].password : "None");
  827.                     sprintf(opt[j++],"%-20.20s %s","Forward Requests"
  828.                         ,(cfg.listcfg[i].misc&NOFWD) ? "No" : "Yes");
  829.                     str[0]=0;
  830.                     for(k=0;k<cfg.listcfg[i].numflags;k++) {
  831.                         strcat(str,cfg.listcfg[i].flag[k].flag);
  832.                         strcat(str," "); }
  833.                     sprintf(opt[j++],"%-20.20s %s","Echo List Flags",str);
  834.                     opt[j][0]=0;
  835.                     k=ulist(WIN_MID|WIN_ACT,0,0,60,&nodeop,0,"Echo List",opt);
  836.                     if(k==-1)
  837.                         break;
  838.                     switch(k) {
  839.                         case 0:
  840.                             strcpy(str,cfg.listcfg[i].listpath);
  841.                             if(uinput(WIN_MID|WIN_SAV,0,0
  842.                                 ,"Echo List Path/Name",str,50
  843.                                 ,K_EDIT|K_UPPER)<1)
  844.                                 continue;
  845.                             strcpy(cfg.listcfg[i].listpath,str);
  846.                             break;
  847.                         case 1:
  848.                             if(cfg.listcfg[i].forward.zone)
  849.                                 strcpy(str,faddrtoa(cfg.listcfg[i].forward));
  850.                             else
  851.                                 str[0]=0;
  852.                             uinput(WIN_MID|WIN_SAV,0,0
  853.                                 ,"Hub Address",str
  854.                                 ,25,K_EDIT);
  855.                             if(str[0])
  856.                                 cfg.listcfg[i].forward=atofaddr(str);
  857.                             else
  858.                                 memset(&cfg.listcfg[i].forward,0
  859.                                     ,sizeof(faddr_t));
  860.                             break;
  861.                         case 2:
  862.                             uinput(WIN_MID|WIN_SAV,0,0
  863.                                 ,"Password to use when forwarding requests"
  864.                                 ,cfg.listcfg[i].password,25,K_EDIT|K_UPPER);
  865.                             break;
  866.                         case 3:
  867.                             cfg.listcfg[i].misc^=NOFWD;
  868.                             if(cfg.listcfg[i].misc&NOFWD)
  869.                                 cfg.listcfg[i].password[0]=0;
  870.                             break;
  871.                         case 4:
  872.                             while(1) {
  873.                                 for(j=0;j<cfg.listcfg[i].numflags;j++)
  874.                                     strcpy(opt[j],cfg.listcfg[i].flag[j].flag);
  875.                                 opt[j][0]=0;
  876.                                 x=ulist(WIN_SAV|WIN_INS|WIN_DEL|WIN_ACT|
  877.                                     WIN_XTR|WIN_INSACT|WIN_DELACT|WIN_RHT
  878.                                     ,0,0,0,&x,0,"Echo List Flags",opt);
  879.                                 if(x==-1)
  880.                                     break;
  881.                                 if((x&MSK_ON)==MSK_INS) {
  882.                                     x&=MSK_OFF;
  883.                                     str[0]=0;
  884. helpbuf=
  885. " Echo List Flag \r\n\r\n"
  886. "These flags determine which nodes have access to the current\r\n"
  887. "echolist file\r\n";
  888.                                     if(uinput(WIN_MID|WIN_SAV,0,0
  889.                                         ,"Echo List Flag",str,4
  890.                                         ,K_EDIT|K_UPPER)<1)
  891.                                         continue;
  892.                                     if((cfg.listcfg[i].flag=(flag_t *)
  893.                                         REALLOC(cfg.listcfg[i].flag
  894.                                         ,sizeof(flag_t)*
  895.                                         (cfg.listcfg[i].numflags+1)))==NULL) {
  896.                                         printf("\nMemory Allocation Error\n");
  897.                                         exit(1); }
  898.                                     for(j=cfg.listcfg[i].numflags;j>x;j--)
  899.                                         memcpy(&cfg.listcfg[i].flag[j]
  900.                                             ,&cfg.listcfg[i].flag[j-1]
  901.                                             ,sizeof(flag_t));
  902.                                     cfg.listcfg[i].numflags++;
  903.                                     memset(&cfg.listcfg[i].flag[x].flag
  904.                                         ,0,sizeof(flag_t));
  905.                                     strcpy(cfg.listcfg[i].flag[x].flag,str);
  906.                                     continue; }
  907.  
  908.                                 if((x&MSK_ON)==MSK_DEL) {
  909.                                     x&=MSK_OFF;
  910.                                     cfg.listcfg[i].numflags--;
  911.                                     if(cfg.listcfg[i].numflags<=0) {
  912.                                         cfg.listcfg[i].numflags=0;
  913.                                         continue; }
  914.                                     for(j=x;j<cfg.listcfg[i].numflags;j++)
  915.                                         strcpy(cfg.listcfg[i].flag[j].flag
  916.                                             ,cfg.listcfg[i].flag[j+1].flag);
  917.                                     if((cfg.listcfg[i].flag=(flag_t *)
  918.                                         REALLOC(cfg.listcfg[i].flag
  919.                                         ,sizeof(flag_t)*
  920.                                         (cfg.listcfg[i].numflags)))==NULL) {
  921.                                         printf("\nMemory Allocation Error\n");
  922.                                         exit(1); }
  923.                                     continue; }
  924.                                 strcpy(str,cfg.listcfg[i].flag[x].flag);
  925. helpbuf=
  926. " Echo List Flag \r\n\r\n"
  927. "These flags determine which nodes have access to the current\r\n"
  928. "echolist file\r\n";
  929.                                     uinput(WIN_MID|WIN_SAV,0,0,"Echo List Flag"
  930.                                         ,str,4,K_EDIT|K_UPPER);
  931.                                     strcpy(cfg.listcfg[i].flag[x].flag,str);
  932.                                     continue; }
  933.                             break;
  934.                             } } }
  935.             break;
  936.  
  937.         case -1:
  938. helpbuf=
  939. " Save Configuration File \r\n\r\n"
  940. "Select Yes to save the config file, No to quit without saving,\r\n"
  941. "or hit  ESC  to go back to the menu.\r\n\r\n";
  942.             i=0;
  943.             strcpy(opt[0],"Yes");
  944.             strcpy(opt[1],"No");
  945.             opt[2][0]=0;
  946.             i=ulist(WIN_MID,0,0,0,&i,0,"Save Config File",opt);
  947.             if(i==-1) break;
  948.             if(i) bail(0);
  949.             if((file=open(cfg.cfgfile
  950.                 ,O_WRONLY|O_BINARY|O_CREAT|O_DENYALL|O_TRUNC,S_IWRITE))==-1) {
  951.                 textattr(LIGHTGRAY);
  952.                 clrscr();
  953.                 lprintf("Error opening %s\r\n",cfg.cfgfile);
  954.                 bail(1); }
  955.             if((stream=fdopen(file,"wb"))==NULL) {
  956.                 textattr(LIGHTGRAY);
  957.                 clrscr();
  958.                 lprintf("Error fdopen %s\r\n",cfg.cfgfile);
  959.                 bail(1); }
  960.             if(!node_swap)
  961.                 fprintf(stream,"NOSWAP\r\n");
  962.             if(cfg.notify)
  963.                 fprintf(stream,"NOTIFY %u\r\n",cfg.notify);
  964.             if(misc&SECURE)
  965.                 fprintf(stream,"SECURE_ECHOMAIL\r\n");
  966.             if(misc&KILL_EMPTY_MAIL)
  967.                 fprintf(stream,"KILL_EMPTY\r\n");
  968.             if(misc&STORE_SEENBY)
  969.                 fprintf(stream,"STORE_SEENBY\r\n");
  970.             if(misc&STORE_PATH)
  971.                 fprintf(stream,"STORE_PATH\r\n");
  972.             if(misc&STORE_KLUDGE)
  973.                 fprintf(stream,"STORE_KLUDGE\r\n");
  974.             if(misc&FUZZY_ZONE)
  975.                 fprintf(stream,"FUZZY_ZONE\r\n");
  976.             if(misc&FLO_MAILER)
  977.                 fprintf(stream,"FLO_MAILER\r\n");
  978.             if(misc&ELIST_ONLY)
  979.                 fprintf(stream,"ELIST_ONLY\r\n");
  980.             if(cfg.areafile[0])
  981.                 fprintf(stream,"AREAFILE %s\r\n",cfg.areafile);
  982.             if(cfg.logfile[0])
  983.                 fprintf(stream,"LOGFILE %s\r\n",cfg.logfile);
  984.             if(cfg.log!=LOG_DEFAULTS) {
  985.                 if(cfg.log==0xffffffffUL)
  986.                     fprintf(stream,"LOG ALL\r\n");
  987.                 else if(cfg.log==0L)
  988.                     fprintf(stream,"LOG NONE\r\n");
  989.                 else
  990.                     fprintf(stream,"LOG %08lX\r\n",cfg.log); }
  991.             if(cfg.inbound[0])
  992.                 fprintf(stream,"INBOUND %s\r\n",cfg.inbound);
  993.             if(cfg.secure[0])
  994.                 fprintf(stream,"SECURE_INBOUND %s\r\n",cfg.secure);
  995.             if(cfg.outbound[0])
  996.                 fprintf(stream,"OUTBOUND %s\r\n",cfg.outbound);
  997.             if(cfg.maxbdlsize!=DFLT_BDL_SIZE)
  998.                 fprintf(stream,"ARCSIZE %lu\r\n",cfg.maxbdlsize);
  999.             if(cfg.maxpktsize!=DFLT_PKT_SIZE)
  1000.                 fprintf(stream,"PKTSIZE %lu\r\n",cfg.maxpktsize);
  1001.             for(i=j=0;i<cfg.nodecfgs;i++)
  1002.                 if(cfg.nodecfg[i].attr&SEND_NOTIFY) {
  1003.                     if(!j) fprintf(stream,"SEND_NOTIFY");
  1004.                     fprintf(stream," %s",faddrtoa(cfg.nodecfg[i].faddr));
  1005.                     j++; }
  1006.             if(j) fprintf(stream,"\r\n");
  1007.             for(i=j=0;i<cfg.nodecfgs;i++)
  1008.                 if(cfg.nodecfg[i].attr&ATTR_HOLD) {
  1009.                     if(!j) fprintf(stream,"HOLD");
  1010.                     fprintf(stream," %s",faddrtoa(cfg.nodecfg[i].faddr));
  1011.                     j++; }
  1012.             if(j) fprintf(stream,"\r\n");
  1013.             for(i=j=0;i<cfg.nodecfgs;i++)
  1014.                 if(cfg.nodecfg[i].attr&ATTR_DIRECT) {
  1015.                     if(!j) fprintf(stream,"DIRECT");
  1016.                     fprintf(stream," %s",faddrtoa(cfg.nodecfg[i].faddr));
  1017.                     j++; }
  1018.             if(j) fprintf(stream,"\r\n");
  1019.             for(i=j=0;i<cfg.nodecfgs;i++)
  1020.                 if(cfg.nodecfg[i].attr&ATTR_CRASH) {
  1021.                     if(!j) fprintf(stream,"CRASH");
  1022.                     fprintf(stream," %s",faddrtoa(cfg.nodecfg[i].faddr));
  1023.                     j++; }
  1024.             if(j) fprintf(stream,"\r\n");
  1025.             for(i=j=0;i<cfg.nodecfgs;i++)
  1026.                 if(cfg.nodecfg[i].attr&ATTR_PASSIVE) {
  1027.                     if(!j) fprintf(stream,"PASSIVE");
  1028.                     fprintf(stream," %s",faddrtoa(cfg.nodecfg[i].faddr));
  1029.                     j++; }
  1030.             if(j) fprintf(stream,"\r\n");
  1031.  
  1032.             for(i=0;i<cfg.nodecfgs;i++)
  1033.                 if(cfg.nodecfg[i].pktpwd[0])
  1034.                     fprintf(stream,"PKTPWD %s %s\r\n"
  1035.                         ,faddrtoa(cfg.nodecfg[i].faddr),cfg.nodecfg[i].pktpwd);
  1036.  
  1037.             for(i=0;i<cfg.nodecfgs;i++)
  1038.                 if(cfg.nodecfg[i].pkt_type)
  1039.                     fprintf(stream,"PKTTYPE %s %s\r\n"
  1040.                         ,cfg.nodecfg[i].pkt_type==PKT_TWO_TWO ? "2.2":"2"
  1041.                         ,faddrtoa(cfg.nodecfg[i].faddr));
  1042.  
  1043.             for(i=0;i<cfg.arcdefs;i++)
  1044.                 fprintf(stream,"PACKER %s %u %s\r\n  PACK %s\r\n"
  1045.                     "  UNPACK %s\r\nEND\r\n"
  1046.                     ,cfg.arcdef[i].name
  1047.                     ,cfg.arcdef[i].byteloc
  1048.                     ,cfg.arcdef[i].hexid
  1049.                     ,cfg.arcdef[i].pack
  1050.                     ,cfg.arcdef[i].unpack
  1051.                     );
  1052.             for(i=0;i<cfg.arcdefs;i++) {
  1053.                 for(j=k=0;j<cfg.nodecfgs;j++)
  1054.                     if(cfg.nodecfg[j].arctype==i) {
  1055.                         if(!k)
  1056.                             fprintf(stream,"%-10s %s","USEPACKER"
  1057.                                 ,cfg.arcdef[i].name);
  1058.                         k++;
  1059.                         fprintf(stream," %s",faddrtoa(cfg.nodecfg[j].faddr)); }
  1060.                 if(k)
  1061.                     fprintf(stream,"\r\n"); }
  1062.  
  1063.             for(i=j=0;i<cfg.nodecfgs;i++)
  1064.                 if(cfg.nodecfg[i].arctype==0xffff) {
  1065.                     if(!j)
  1066.                         fprintf(stream,"%-10s %s","USEPACKER","NONE");
  1067.                     j++;
  1068.                     fprintf(stream," %s",faddrtoa(cfg.nodecfg[i].faddr)); }
  1069.             if(j)
  1070.                 fprintf(stream,"\r\n");
  1071.  
  1072.             for(i=0;i<cfg.listcfgs;i++) {
  1073.                 fprintf(stream,"%-10s","ECHOLIST");
  1074.                 if(cfg.listcfg[i].password[0])
  1075.                     fprintf(stream," FORWARD %s %s"
  1076.                         ,faddrtoa(cfg.listcfg[i].forward)
  1077.                         ,cfg.listcfg[i].password);
  1078.                 else if(cfg.listcfg[i].misc&NOFWD &&
  1079.                     cfg.listcfg[i].forward.zone)
  1080.                     fprintf(stream," HUB %s"
  1081.                         ,faddrtoa(cfg.listcfg[i].forward));
  1082.                 fprintf(stream," %s",cfg.listcfg[i].listpath);
  1083.                 for(j=0;j<cfg.listcfg[i].numflags;j++)
  1084.                     fprintf(stream," %s",cfg.listcfg[i].flag[j].flag);
  1085.                 fprintf(stream,"\r\n"); }
  1086.  
  1087.             for(i=0;i<cfg.nodecfgs;i++)
  1088.                 if(cfg.nodecfg[i].password[0]) {
  1089.                     fprintf(stream,"%-10s %s %s","AREAFIX"
  1090.                         ,faddrtoa(cfg.nodecfg[i].faddr)
  1091.                         ,cfg.nodecfg[i].password);
  1092.                     for(j=0;j<cfg.nodecfg[i].numflags;j++)
  1093.                         fprintf(stream," %s",cfg.nodecfg[i].flag[j].flag);
  1094.                     fprintf(stream,"\r\n"); }
  1095.  
  1096.             for(i=0;i<cfg.nodecfgs;i++)
  1097.                 if(cfg.nodecfg[i].route.zone) {
  1098.                     fprintf(stream,"%-10s %s","ROUTE_TO"
  1099.                         ,faddrtoa(cfg.nodecfg[i].route));
  1100.                     fprintf(stream," %s"
  1101.                         ,faddrtoa(cfg.nodecfg[i].faddr));
  1102.                     for(j=i+1;j<cfg.nodecfgs;j++)
  1103.                         if(!memcmp(&cfg.nodecfg[j].route,&cfg.nodecfg[i].route
  1104.                             ,sizeof(faddr_t))) {
  1105.                             fprintf(stream," %s"
  1106.                                 ,faddrtoa(cfg.nodecfg[j].faddr));
  1107.                             cfg.nodecfg[j].route.zone=0; }
  1108.                     fprintf(stream,"\r\n"); }
  1109.  
  1110.             fclose(stream);
  1111.             bail(0);
  1112.     }
  1113. }
  1114. }
  1115. /****************************************************************************/
  1116. /* Checks the disk drive for the existance of a file. Returns 1 if it         */
  1117. /* exists, 0 if it doesn't.                                                    */
  1118. /* Called from upload                                                        */
  1119. /****************************************************************************/
  1120. char fexist(char *filespec)
  1121. {
  1122.     struct ffblk f;
  1123.  
  1124. if(findfirst(filespec,&f,0)==NULL)
  1125.     return(1);
  1126. return(0);
  1127. }
  1128.