home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 September / PCO_0998.ISO / filesbbs / dos / sbbs_src.exe / SBBS / SCFG / SCFGXFR1.C < prev    next >
Encoding:
Text File  |  1997-04-13  |  29.6 KB  |  977 lines

  1. #line 2 "SCFGXFR1.C"
  2.  
  3. /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
  4.  
  5. #include "scfg.h"
  6.  
  7. void xfer_opts()
  8. {
  9.     static int xfr_dflt;
  10.     char str[81],done;
  11.     int i,j,k,l,dflt,bar;
  12.     static fextr_t savfextr;
  13.     static fview_t savfview;
  14.     static ftest_t savftest;
  15.     static fcomp_t savfcomp;
  16.     static prot_t savprot;
  17.     static dlevent_t savdlevent;
  18.     static char savaltpath[LEN_DIR+1];
  19.  
  20. while(1) {
  21.     i=0;
  22.     sprintf(opt[i++],"%-33.33s%uk","Min Bytes Free Disk Space",min_dspace);
  23.     sprintf(opt[i++],"%-33.33s%u","Max Files in Batch UL Queue"
  24.         ,max_batup);
  25.     sprintf(opt[i++],"%-33.33s%u","Max Files in Batch DL Queue"
  26.         ,max_batdn);
  27.     sprintf(opt[i++],"%-33.33s%u","Max Users in User Transfers",max_userxfer);
  28.     sprintf(opt[i++],"%-33.33s%u%%","Default Credit on Upload"
  29.         ,cdt_up_pct);
  30.     sprintf(opt[i++],"%-33.33s%u%%","Default Credit on Download"
  31.         ,cdt_dn_pct);
  32.     if(leech_pct)
  33.         sprintf(str,"%u%% after %u seconds",leech_pct,leech_sec);
  34.     else
  35.         strcpy(str,"Disabled");
  36.     sprintf(opt[i++],"%-33.33s%s","Leech Protocol Detection",str);
  37.     strcpy(opt[i++],"Viewable Files...");
  38.     strcpy(opt[i++],"Testable Files...");
  39.     strcpy(opt[i++],"Download Events...");
  40.     strcpy(opt[i++],"Extractable Files...");
  41.     strcpy(opt[i++],"Compressable Files...");
  42.     strcpy(opt[i++],"Transfer Protocols...");
  43.     strcpy(opt[i++],"Alternate File Paths...");
  44.     opt[i][0]=0;
  45.     SETHELP(WHERE);
  46. /*
  47. File Transfer Configuration:
  48.  
  49. This menu has options and sub-menus that pertain specifically to the
  50. file transfer section of the BBS.
  51. */
  52.     switch(ulist(WIN_ORG|WIN_ACT|WIN_CHE,0,0,72,&xfr_dflt,0
  53.         ,"File Transfer Configuration",opt)) {
  54.         case -1:
  55.             i=save_changes(WIN_MID);
  56.             if(i==-1)
  57.                 break;
  58.             if(!i)
  59.                 write_file_cfg();
  60.             return;
  61.         case 0:
  62.             SETHELP(WHERE);
  63. /*
  64. Minimum Kilobytes Free Disk Space to Allow Uploads:
  65.  
  66. This is the minimum free space in a file directory to allow user
  67. uploads.
  68. */
  69.             uinput(WIN_MID,0,0
  70.                 ,"Minimum Kilobytes Free Disk Space to Allow Uploads"
  71.                 ,itoa(min_dspace,tmp,10),5,K_EDIT|K_NUMBER);
  72.             min_dspace=atoi(tmp);
  73.             break;
  74.         case 1:
  75.             SETHELP(WHERE);
  76. /*
  77. Maximum Files in Batch Upload Queue:
  78.  
  79. This is the maximum number of files that can be placed in the batch
  80. upload queue.
  81. */
  82.             uinput(WIN_MID,0,0,"Maximum Files in Batch Upload Queue"
  83.                 ,itoa(max_batup,tmp,10),5,K_EDIT|K_NUMBER);
  84.             max_batup=atoi(tmp);
  85.             break;
  86.         case 2:
  87.             SETHELP(WHERE);
  88. /*
  89. Maximum Files in Batch Download Queue:
  90.  
  91. This is the maximum number of files that can be placed in the batch
  92. download queue.
  93. */
  94.             uinput(WIN_MID,0,0,"Maximum Files in Batch Download Queue"
  95.                 ,itoa(max_batdn,tmp,10),5,K_EDIT|K_NUMBER);
  96.             max_batdn=atoi(tmp);
  97.             break;
  98.         case 3:
  99.             SETHELP(WHERE);
  100. /*
  101. Maximum Destination Users in User to User Transfer:
  102.  
  103. This is the maximum number of users allowed in the destination user list
  104. of a user to user upload.
  105. */
  106.             uinput(WIN_MID,0,0
  107.                 ,"Maximum Destination Users in User to User Transfers"
  108.                 ,itoa(max_userxfer,tmp,10),5,K_EDIT|K_NUMBER);
  109.             max_userxfer=atoi(tmp);
  110.             break;
  111.         case 4:
  112. SETHELP(WHERE);
  113. /*
  114. Default Percentage of Credits to Credit Uploader on Upload:
  115.  
  116. This is the default setting that will be used when new file
  117. directories are created.
  118. */
  119.             uinput(WIN_MID,0,0
  120.                 ,"Default Percentage of Credits to Credit Uploader on Upload"
  121.                 ,itoa(cdt_up_pct,tmp,10),4,K_EDIT|K_NUMBER);
  122.             cdt_up_pct=atoi(tmp);
  123.             break;
  124.         case 5:
  125. SETHELP(WHERE);
  126. /*
  127. Default Percentage of Credits to Credit Uploader on Download:
  128.  
  129. This is the default setting that will be used when new file
  130. directories are created.
  131. */
  132.             uinput(WIN_MID,0,0
  133.                 ,"Default Percentage of Credits to Credit Uploader on Download"
  134.                 ,itoa(cdt_dn_pct,tmp,10),4,K_EDIT|K_NUMBER);
  135.             cdt_dn_pct=atoi(tmp);
  136.             break;
  137.         case 6:
  138.             SETHELP(WHERE);
  139. /*
  140. Leech Protocol Detection Percentage:
  141.  
  142. This value is the sensitivity of the leech protocol detection feature of
  143. Synchronet. If the transfer is apparently unsuccessful, but the transfer
  144. time was at least this percentage of the estimated transfer time (based
  145. on the estimated CPS of the connection result code), then a leech
  146. protocol error is issued and the user's leech download counter is
  147. incremented. Setting this value to 0 disables leech protocol detection.
  148. */
  149.             savnum=0;
  150.             uinput(WIN_MID|WIN_SAV,0,0
  151.                 ,"Leech Protocol Detection Percentage (0=Disabled)"
  152.                 ,itoa(leech_pct,tmp,10),3,K_EDIT|K_NUMBER);
  153.             leech_pct=atoi(tmp);
  154.             if(!leech_pct)
  155.                 break;
  156.             SETHELP(WHERE);
  157. /*
  158. Leech Protocol Minimum Time (in Seconds):
  159.  
  160. This option allows you to adjust the sensitivity of the leech protocol
  161. detection feature. This value is the minimum length of transfer time
  162. (in seconds) that must elapse before an aborted tranfser will be
  163. considered a possible leech attempt.
  164. */
  165.             uinput(WIN_MID,0,0
  166.                 ,"Leech Protocol Minimum Time (in Seconds)"
  167.                 ,itoa(leech_sec,tmp,10),3,K_EDIT|K_NUMBER);
  168.             leech_sec=atoi(tmp);
  169.             break;
  170.         case 7:     /* Viewable file types */
  171.             dflt=bar=0;
  172.             while(1) {
  173.                 for(i=0;i<total_fviews && i<MAX_OPTS;i++)
  174.                     sprintf(opt[i],"%-3.3s  %-40s",fview[i]->ext,fview[i]->cmd);
  175.                 opt[i][0]=0;
  176.                 i=WIN_ACT|WIN_SAV;    /* save cause size can change */
  177.                 if(total_fviews<MAX_OPTS)
  178.                     i|=WIN_INS;
  179.                 if(total_fviews)
  180.                     i|=WIN_DEL|WIN_GET;
  181.                 if(savfview.cmd[0])
  182.                     i|=WIN_PUT;
  183.                 savnum=0;
  184.                 SETHELP(WHERE);
  185. /*
  186. Viewable File Types:
  187.  
  188. This is a list of file types that have content information that can be
  189. viewed through the execution of an external program. Here are a couple of
  190. command line examples for a few file types.
  191. */
  192.                 i=ulist(i,0,0,50,&dflt,&bar,"Viewable File Types",opt);
  193.                 if(i==-1)
  194.                     break;
  195.                 if((i&MSK_ON)==MSK_DEL) {
  196.                     i&=MSK_OFF;
  197.                     FREE(fview[i]);
  198.                     total_fviews--;
  199.                     while(i<total_fviews) {
  200.                         fview[i]=fview[i+1];
  201.                         i++; }
  202.                     changes=1;
  203.                     continue; }
  204.                 if((i&MSK_ON)==MSK_INS) {
  205.                     i&=MSK_OFF;
  206.                     if((fview=(fview_t **)REALLOC(fview
  207.                         ,sizeof(fview_t *)*(total_fviews+1)))==NULL) {
  208.                         errormsg(WHERE,ERR_ALLOC,nulstr,total_fviews+1);
  209.                         total_fviews=0;
  210.                         bail(1);
  211.                         continue; }
  212.                     if(!total_fviews) {
  213.                         if((fview[0]=(fview_t *)MALLOC(
  214.                             sizeof(fview_t)))==NULL) {
  215.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fview_t));
  216.                             continue; }
  217.                         memset(fview[0],0,sizeof(fview_t));
  218.                         strcpy(fview[0]->ext,"ZIP");
  219.                         strcpy(fview[0]->cmd,"%!pkunzip -v %f"); }
  220.                     else {
  221.                         for(j=total_fviews;j>i;j--)
  222.                             fview[j]=fview[j-1];
  223.                         if((fview[i]=(fview_t *)MALLOC(
  224.                             sizeof(fview_t)))==NULL) {
  225.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fview_t));
  226.                             continue; }
  227.                         *fview[i]=*fview[i+1]; }
  228.                     total_fviews++;
  229.                     changes=1;
  230.                     continue; }
  231.                 if((i&MSK_ON)==MSK_GET) {
  232.                     i&=MSK_OFF;
  233.                     savfview=*fview[i];
  234.                     continue; }
  235.                 if((i&MSK_ON)==MSK_PUT) {
  236.                     i&=MSK_OFF;
  237.                     *fview[i]=savfview;
  238.                     changes=1;
  239.                     continue; }
  240.                 k=0;
  241.                 done=0;
  242.                 while(!done) {
  243.                     j=0;
  244.                     sprintf(opt[j++],"%-22.22s%s","File Extension"
  245.                         ,fview[i]->ext);
  246.                     sprintf(opt[j++],"%-22.22s%-40s","Command Line"
  247.                         ,fview[i]->cmd);
  248.                     sprintf(opt[j++],"%-22.22s%s","Access Requirements"
  249.                         ,fview[i]->ar);
  250.                     opt[j][0]=0;
  251.                     savnum=1;
  252.                     switch(ulist(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&k,0
  253.                         ,"Viewable File Type",opt)) {
  254.                         case -1:
  255.                             done=1;
  256.                             break;
  257.                         case 0:
  258.                             uinput(WIN_MID|WIN_SAV,0,0
  259.                                 ,"Viewable File Type Extension"
  260.                                 ,fview[i]->ext,3,K_UPPER|K_EDIT);
  261.                             break;
  262.                         case 1:
  263.                             uinput(WIN_MID|WIN_SAV,0,0
  264.                                 ,"Command Line"
  265.                                 ,fview[i]->cmd,50,K_EDIT);
  266.                             break;
  267.                         case 2:
  268.                             savnum=2;
  269.                             sprintf(str,"Viewable File Type %s"
  270.                                 ,fview[i]->ext);
  271.                             getar(str,fview[i]->ar);
  272.                             break; } } }
  273.             break;
  274.         case 8:    /* Testable file types */
  275.             dflt=bar=0;
  276.             while(1) {
  277.                 for(i=0;i<total_ftests && i<MAX_OPTS;i++)
  278.                     sprintf(opt[i],"%-3.3s  %-40s",ftest[i]->ext,ftest[i]->cmd);
  279.                 opt[i][0]=0;
  280.                 i=WIN_ACT|WIN_SAV;    /* save cause size can change */
  281.                 if(total_ftests<MAX_OPTS)
  282.                     i|=WIN_INS;
  283.                 if(total_ftests)
  284.                     i|=WIN_DEL|WIN_GET;
  285.                 if(savftest.cmd[0])
  286.                     i|=WIN_PUT;
  287.                 savnum=0;
  288.                 SETHELP(WHERE);
  289. /*
  290. Testable File Types:
  291.  
  292. This is a list of file types that will have a command line executed to
  293. test the file integrity upon their upload. The file types are specified
  294. by extension and if one file extension is listed more than once, each
  295. command line will be executed. The command lines must return a DOS error
  296. code of 0 (no error) in order for the file to pass the test. This method
  297. of file testing upon upload is also known as an upload event. This test
  298. or event, can do more than just test the file, it can perform any
  299. function that the sysop wishes. Such as adding comments to an archived
  300. file, or extracting an archive and performing a virus scan. While the
  301. external program is executing, a text string is displayed to the user.
  302. This working string can be set for each file type and command line
  303. listed.
  304. */
  305.                 i=ulist(i,0,0,50,&dflt,&bar,"Testable File Types",opt);
  306.                 if(i==-1)
  307.                     break;
  308.                 if((i&MSK_ON)==MSK_DEL) {
  309.                     i&=MSK_OFF;
  310.                     FREE(ftest[i]);
  311.                     total_ftests--;
  312.                     while(i<total_ftests) {
  313.                         ftest[i]=ftest[i+1];
  314.                         i++; }
  315.                     changes=1;
  316.                     continue; }
  317.                 if((i&MSK_ON)==MSK_INS) {
  318.                     i&=MSK_OFF;
  319.                     if((ftest=(ftest_t **)REALLOC(ftest
  320.                         ,sizeof(ftest_t *)*(total_ftests+1)))==NULL) {
  321.                         errormsg(WHERE,ERR_ALLOC,nulstr,total_ftests+1);
  322.                         total_ftests=0;
  323.                         bail(1);
  324.                         continue; }
  325.                     if(!total_ftests) {
  326.                         if((ftest[0]=(ftest_t *)MALLOC(
  327.                             sizeof(ftest_t)))==NULL) {
  328.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(ftest_t));
  329.                             continue; }
  330.                         memset(ftest[0],0,sizeof(ftest_t));
  331.                         strcpy(ftest[0]->ext,"ZIP");
  332.                         strcpy(ftest[0]->cmd,"%!pkunzip -t %f");
  333.                         strcpy(ftest[0]->workstr,"Testing ZIP Integrity..."); }
  334.                     else {
  335.  
  336.                         for(j=total_ftests;j>i;j--)
  337.                             ftest[j]=ftest[j-1];
  338.                         if((ftest[i]=(ftest_t *)MALLOC(
  339.                             sizeof(ftest_t)))==NULL) {
  340.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(ftest_t));
  341.                             continue; }
  342.                         *ftest[i]=*ftest[i+1]; }
  343.                     total_ftests++;
  344.                     changes=1;
  345.                     continue; }
  346.                 if((i&MSK_ON)==MSK_GET) {
  347.                     i&=MSK_OFF;
  348.                     savftest=*ftest[i];
  349.                     continue; }
  350.                 if((i&MSK_ON)==MSK_PUT) {
  351.                     i&=MSK_OFF;
  352.                     *ftest[i]=savftest;
  353.                     changes=1;
  354.                     continue; }
  355.                 done=0;
  356.                 k=0;
  357.                 while(!done) {
  358.                     j=0;
  359.                     sprintf(opt[j++],"%-22.22s%s","File Extension"
  360.                         ,ftest[i]->ext);
  361.                     sprintf(opt[j++],"%-22.22s%-40s","Command Line"
  362.                         ,ftest[i]->cmd);
  363.                     sprintf(opt[j++],"%-22.22s%s","Working String"
  364.                         ,ftest[i]->workstr);
  365.                     sprintf(opt[j++],"%-22.22s%s","Access Requirements"
  366.                         ,ftest[i]->ar);
  367.                     opt[j][0]=0;
  368.                     savnum=1;
  369.                     switch(ulist(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&k,0
  370.                         ,"Testable File Type",opt)) {
  371.                         case -1:
  372.                             done=1;
  373.                             break;
  374.                         case 0:
  375.                             uinput(WIN_MID|WIN_SAV,0,0
  376.                                 ,"Testable File Type Extension"
  377.                                 ,ftest[i]->ext,3,K_UPPER|K_EDIT);
  378.                             break;
  379.                         case 1:
  380.                             uinput(WIN_MID|WIN_SAV,0,0
  381.                                 ,"Command Line"
  382.                                 ,ftest[i]->cmd,50,K_EDIT);
  383.                             break;
  384.                         case 2:
  385.                             uinput(WIN_MID|WIN_SAV,0,0
  386.                                 ,"Working String"
  387.                                 ,ftest[i]->workstr,40,K_EDIT|K_MSG);
  388.                             break;
  389.                         case 3:
  390.                             savnum=2;
  391.                             sprintf(str,"Testable File Type %s",ftest[i]->ext);
  392.                             getar(str,ftest[i]->ar);
  393.                             break; } } }
  394.             break;
  395.         case 9:    /* Download Events */
  396.             dflt=bar=0;
  397.             while(1) {
  398.                 for(i=0;i<total_dlevents && i<MAX_OPTS;i++)
  399.                     sprintf(opt[i],"%-3.3s  %-40s",dlevent[i]->ext,dlevent[i]->cmd);
  400.                 opt[i][0]=0;
  401.                 i=WIN_ACT|WIN_SAV;    /* save cause size can change */
  402.                 if(total_dlevents<MAX_OPTS)
  403.                     i|=WIN_INS;
  404.                 if(total_dlevents)
  405.                     i|=WIN_DEL|WIN_GET;
  406.                 if(savdlevent.cmd[0])
  407.                     i|=WIN_PUT;
  408.                 savnum=0;
  409.                 SETHELP(WHERE);
  410. /*
  411. Download Events:
  412.  
  413. This is a list of file types that will have a command line executed to
  414. perform an event upon their download (e.g. trigger a download event).
  415. The file types are specified by extension and if one file extension
  416. is listed more than once, each command line will be executed. The
  417. command lines must return a DOS error code of 0 (no error) in order
  418. for the file to pass the test. This test or event, can do more than
  419. just test the file, it can perform any function that the sysop wishes.
  420. Such as adding comments to an archived file, or extracting an archive
  421. and performing a virus scan. While the external program is executing,
  422. a text string is displayed to the user. This working string can be set
  423. for each file type and command line listed.
  424. */
  425.                 i=ulist(i,0,0,50,&dflt,&bar,"Download Events",opt);
  426.                 if(i==-1)
  427.                     break;
  428.                 if((i&MSK_ON)==MSK_DEL) {
  429.                     i&=MSK_OFF;
  430.                     FREE(dlevent[i]);
  431.                     total_dlevents--;
  432.                     while(i<total_dlevents) {
  433.                         dlevent[i]=dlevent[i+1];
  434.                         i++; }
  435.                     changes=1;
  436.                     continue; }
  437.                 if((i&MSK_ON)==MSK_INS) {
  438.                     i&=MSK_OFF;
  439.                     if((dlevent=(dlevent_t **)REALLOC(dlevent
  440.                         ,sizeof(dlevent_t *)*(total_dlevents+1)))==NULL) {
  441.                         errormsg(WHERE,ERR_ALLOC,nulstr,total_dlevents+1);
  442.                         total_dlevents=0;
  443.                         bail(1);
  444.                         continue; }
  445.                     if(!total_dlevents) {
  446.                         if((dlevent[0]=(dlevent_t *)MALLOC(
  447.                             sizeof(dlevent_t)))==NULL) {
  448.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(dlevent_t));
  449.                             continue; }
  450.                         memset(dlevent[0],0,sizeof(dlevent_t));
  451.                         strcpy(dlevent[0]->ext,"ZIP");
  452.                         strcpy(dlevent[0]->cmd,"%!pkzip -z %f "
  453.                             "< ..\\text\\zipmsg.txt");
  454.                         strcpy(dlevent[0]->workstr,"Adding ZIP Comment..."); }
  455.                     else {
  456.  
  457.                         for(j=total_dlevents;j>i;j--)
  458.                             dlevent[j]=dlevent[j-1];
  459.                         if((dlevent[i]=(dlevent_t *)MALLOC(
  460.                             sizeof(dlevent_t)))==NULL) {
  461.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(dlevent_t));
  462.                             continue; }
  463.                         *dlevent[i]=*dlevent[i+1]; }
  464.                     total_dlevents++;
  465.                     changes=1;
  466.                     continue; }
  467.                 if((i&MSK_ON)==MSK_GET) {
  468.                     i&=MSK_OFF;
  469.                     savdlevent=*dlevent[i];
  470.                     continue; }
  471.                 if((i&MSK_ON)==MSK_PUT) {
  472.                     i&=MSK_OFF;
  473.                     *dlevent[i]=savdlevent;
  474.                     changes=1;
  475.                     continue; }
  476.                 done=0;
  477.                 k=0;
  478.                 while(!done) {
  479.                     j=0;
  480.                     sprintf(opt[j++],"%-22.22s%s","File Extension"
  481.                         ,dlevent[i]->ext);
  482.                     sprintf(opt[j++],"%-22.22s%-40s","Command Line"
  483.                         ,dlevent[i]->cmd);
  484.                     sprintf(opt[j++],"%-22.22s%s","Working String"
  485.                         ,dlevent[i]->workstr);
  486.                     sprintf(opt[j++],"%-22.22s%s","Access Requirements"
  487.                         ,dlevent[i]->ar);
  488.                     opt[j][0]=0;
  489.                     savnum=1;
  490.                     switch(ulist(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&k,0
  491.                         ,"Download Event",opt)) {
  492.                         case -1:
  493.                             done=1;
  494.                             break;
  495.                         case 0:
  496.                             uinput(WIN_MID|WIN_SAV,0,0
  497.                                 ,"Download Event Extension"
  498.                                 ,dlevent[i]->ext,3,K_UPPER|K_EDIT);
  499.                             break;
  500.                         case 1:
  501.                             uinput(WIN_MID|WIN_SAV,0,0
  502.                                 ,"Command Line"
  503.                                 ,dlevent[i]->cmd,50,K_EDIT);
  504.                             break;
  505.                         case 2:
  506.                             uinput(WIN_MID|WIN_SAV,0,0
  507.                                 ,"Working String"
  508.                                 ,dlevent[i]->workstr,40,K_EDIT|K_MSG);
  509.                             break;
  510.                         case 3:
  511.                             savnum=2;
  512.                             sprintf(str,"Download Event %s",dlevent[i]->ext);
  513.                             getar(str,dlevent[i]->ar);
  514.                             break; } } }
  515.             break;
  516.         case 10:     /* Extractable file types */
  517.             dflt=bar=0;
  518.             while(1) {
  519.                 for(i=0;i<total_fextrs && i<MAX_OPTS;i++)
  520.                     sprintf(opt[i],"%-3.3s  %-40s"
  521.                         ,fextr[i]->ext,fextr[i]->cmd);
  522.                 opt[i][0]=0;
  523.                 i=WIN_ACT|WIN_SAV;  /* save cause size can change */
  524.                 if(total_fextrs<MAX_OPTS)
  525.                     i|=WIN_INS;
  526.                 if(total_fextrs)
  527.                     i|=WIN_DEL|WIN_GET;
  528.                 if(savfextr.cmd[0])
  529.                     i|=WIN_PUT;
  530.                 savnum=0;
  531.                 SETHELP(WHERE);
  532. /*
  533. Extractable File Types:
  534.  
  535. This is a list of archive file types that can be extracted to the temp
  536. directory by an external program. The file types are specified by their
  537. extension. For each file type you must specify the command line used to
  538. extract the file(s).
  539. */
  540.                 i=ulist(i,0,0,50,&dflt,&bar,"Extractable File Types",opt);
  541.                 if(i==-1)
  542.                     break;
  543.                 if((i&MSK_ON)==MSK_DEL) {
  544.                     i&=MSK_OFF;
  545.                     FREE(fextr[i]);
  546.                     total_fextrs--;
  547.                     while(i<total_fextrs) {
  548.                         fextr[i]=fextr[i+1];
  549.                         i++; }
  550.                     changes=1;
  551.                     continue; }
  552.                 if((i&MSK_ON)==MSK_INS) {
  553.                     i&=MSK_OFF;
  554.                     if((fextr=(fextr_t **)REALLOC(fextr
  555.                         ,sizeof(fextr_t *)*(total_fextrs+1)))==NULL) {
  556.                         errormsg(WHERE,ERR_ALLOC,nulstr,total_fextrs+1);
  557.                         total_fextrs=0;
  558.                         bail(1);
  559.                         continue; }
  560.                     if(!total_fextrs) {
  561.                         if((fextr[0]=(fextr_t *)MALLOC(
  562.                             sizeof(fextr_t)))==NULL) {
  563.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fextr_t));
  564.                             continue; }
  565.                         memset(fextr[0],0,sizeof(fextr_t));
  566.                         strcpy(fextr[0]->ext,"ZIP");
  567.                         strcpy(fextr[0]->cmd,"%!pkunzip -o %f %g %s"); }
  568.                     else {
  569.  
  570.                         for(j=total_fextrs;j>i;j--)
  571.                             fextr[j]=fextr[j-1];
  572.                         if((fextr[i]=(fextr_t *)MALLOC(
  573.                             sizeof(fextr_t)))==NULL) {
  574.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fextr_t));
  575.                             continue; }
  576.                         *fextr[i]=*fextr[i+1]; }
  577.                     total_fextrs++;
  578.                     changes=1;
  579.                     continue; }
  580.                 if((i&MSK_ON)==MSK_GET) {
  581.                     i&=MSK_OFF;
  582.                     savfextr=*fextr[i];
  583.                     continue; }
  584.                 if((i&MSK_ON)==MSK_PUT) {
  585.                     i&=MSK_OFF;
  586.                     *fextr[i]=savfextr;
  587.                     changes=1;
  588.                     continue; }
  589.                 k=0;
  590.                 done=0;
  591.                 while(!done) {
  592.                     j=0;
  593.                     sprintf(opt[j++],"%-22.22s%s","File Extension"
  594.                         ,fextr[i]->ext);
  595.                     sprintf(opt[j++],"%-22.22s%-40s","Command Line"
  596.                         ,fextr[i]->cmd);
  597.                     sprintf(opt[j++],"%-22.22s%s","Access Requirements"
  598.                         ,fextr[i]->ar);
  599.                     opt[j][0]=0;
  600.                     savnum=1;
  601.                     switch(ulist(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&k,0
  602.                         ,"Extractable File Type",opt)) {
  603.                         case -1:
  604.                             done=1;
  605.                             break;
  606.                         case 0:
  607.                             uinput(WIN_MID|WIN_SAV,0,0
  608.                                 ,"Extractable File Type Extension"
  609.                                 ,fextr[i]->ext,3,K_UPPER|K_EDIT);
  610.                             break;
  611.                         case 1:
  612.                             uinput(WIN_MID|WIN_SAV,0,0
  613.                                 ,"Command Line"
  614.                                 ,fextr[i]->cmd,50,K_EDIT);
  615.                             break;
  616.                         case 2:
  617.                             savnum=2;
  618.                             sprintf(str,"Extractable File Type %s"
  619.                                 ,fextr[i]->ext);
  620.                             getar(str,fextr[i]->ar);
  621.                             break; } } }
  622.             break;
  623.         case 11:     /* Compressable file types */
  624.             dflt=bar=0;
  625.             while(1) {
  626.                 for(i=0;i<total_fcomps && i<MAX_OPTS;i++)
  627.                     sprintf(opt[i],"%-3.3s  %-40s",fcomp[i]->ext,fcomp[i]->cmd);
  628.                 opt[i][0]=0;
  629.                 i=WIN_ACT|WIN_SAV;    /* save cause size can change */
  630.                 if(total_fcomps<MAX_OPTS)
  631.                     i|=WIN_INS;
  632.                 if(total_fcomps)
  633.                     i|=WIN_DEL|WIN_GET;
  634.                 if(savfcomp.cmd[0])
  635.                     i|=WIN_PUT;
  636.                 savnum=0;
  637.                 SETHELP(WHERE);
  638. /*
  639. Compressable File Types:
  640.  
  641. This is a list of compression methods available for different file types.
  642. These will be used for items such as creating QWK packets, temporary
  643. files from the transfer section, and more.
  644. */
  645.                 i=ulist(i,0,0,50,&dflt,&bar,"Compressable File Types",opt);
  646.                 if(i==-1)
  647.                     break;
  648.                 if((i&MSK_ON)==MSK_DEL) {
  649.                     i&=MSK_OFF;
  650.                     FREE(fcomp[i]);
  651.                     total_fcomps--;
  652.                     while(i<total_fcomps) {
  653.                         fcomp[i]=fcomp[i+1];
  654.                         i++; }
  655.                     changes=1;
  656.                     continue; }
  657.                 if((i&MSK_ON)==MSK_INS) {
  658.                     i&=MSK_OFF;
  659.                     if((fcomp=(fcomp_t **)REALLOC(fcomp
  660.                         ,sizeof(fcomp_t *)*(total_fcomps+1)))==NULL) {
  661.                         errormsg(WHERE,ERR_ALLOC,nulstr,total_fcomps+1);
  662.                         total_fcomps=0;
  663.                         bail(1);
  664.                         continue; }
  665.                     if(!total_fcomps) {
  666.                         if((fcomp[0]=(fcomp_t *)MALLOC(
  667.                             sizeof(fcomp_t)))==NULL) {
  668.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fcomp_t));
  669.                             continue; }
  670.                         memset(fcomp[0],0,sizeof(fcomp_t));
  671.                         strcpy(fcomp[0]->ext,"ZIP");
  672.                         strcpy(fcomp[0]->cmd,"%!pkzip %f %s"); }
  673.                     else {
  674.                         for(j=total_fcomps;j>i;j--)
  675.                             fcomp[j]=fcomp[j-1];
  676.                         if((fcomp[i]=(fcomp_t *)MALLOC(
  677.                             sizeof(fcomp_t)))==NULL) {
  678.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fcomp_t));
  679.                             continue; }
  680.                         *fcomp[i]=*fcomp[i+1]; }
  681.                     total_fcomps++;
  682.                     changes=1;
  683.                     continue; }
  684.                 if((i&MSK_ON)==MSK_GET) {
  685.                     i&=MSK_OFF;
  686.                     savfcomp=*fcomp[i];
  687.                     continue; }
  688.                 if((i&MSK_ON)==MSK_PUT) {
  689.                     i&=MSK_OFF;
  690.                     *fcomp[i]=savfcomp;
  691.                     changes=1;
  692.                     continue; }
  693.                 k=0;
  694.                 done=0;
  695.                 while(!done) {
  696.                     j=0;
  697.                     sprintf(opt[j++],"%-22.22s%s","File Extension"
  698.                         ,fcomp[i]->ext);
  699.                     sprintf(opt[j++],"%-22.22s%-40s","Command Line"
  700.                         ,fcomp[i]->cmd);
  701.                     sprintf(opt[j++],"%-22.22s%s","Access Requirements"
  702.                         ,fcomp[i]->ar);
  703.                     opt[j][0]=0;
  704.                     savnum=1;
  705.                     switch(ulist(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&k,0
  706.                         ,"Compressable File Type",opt)) {
  707.                         case -1:
  708.                             done=1;
  709.                             break;
  710.                         case 0:
  711.                             uinput(WIN_MID|WIN_SAV,0,0
  712.                                 ,"Compressable File Type Extension"
  713.                                 ,fcomp[i]->ext,3,K_UPPER|K_EDIT);
  714.                             break;
  715.                         case 1:
  716.                             uinput(WIN_MID|WIN_SAV,0,0
  717.                                 ,"Command Line"
  718.                                 ,fcomp[i]->cmd,50,K_EDIT);
  719.                             break;
  720.                         case 2:
  721.                             savnum=2;
  722.                             sprintf(str,"Compressable File Type %s"
  723.                                 ,fcomp[i]->ext);
  724.                             getar(str,fcomp[i]->ar);
  725.                             break; } } }
  726.             break;
  727.         case 12:    /* Transfer protocols */
  728.             dflt=bar=0;
  729.             while(1) {
  730.                 for(i=0;i<total_prots && i<MAX_OPTS;i++)
  731.                     sprintf(opt[i],"%c  %-40s"
  732.                         ,prot[i]->mnemonic,prot[i]->ulcmd);
  733.                 opt[i][0]=0;
  734.                 i=WIN_ACT|WIN_SAV;    /* save cause size can change */
  735.                 if(total_prots<MAX_OPTS)
  736.                     i|=WIN_INS;
  737.                 if(total_prots)
  738.                     i|=WIN_DEL|WIN_GET;
  739.                 if(savprot.mnemonic)
  740.                     i|=WIN_PUT;
  741.                 savnum=0;
  742.                 SETHELP(WHERE);
  743. /*
  744. File Transfer Protocols:
  745.  
  746. This is a list of file transfer protocols that can be used to transfer
  747. files either to or from a remote user. For each protocol, you can
  748. specify the mnemonic (hot-key) to use to specify that protocol, the
  749. command line to use for uploads, downloads, batch uploads, batch
  750. downloads, bidirectional file transfers, and the support of DSZLOG. If
  751. the protocol doesn't support a certain method of transfer, or you don't
  752. wish it to be available for a certain method of transfer, leave the
  753. command line for that method blank. Be advised, that if you add or
  754. remove any transfer protocols, you will need to edit the protocol menus
  755. (ULPROT, DLPROT, BATUPROT, BATDPROT, and BIPROT) in the TEXT\MENU
  756. directory accordingly.
  757. */
  758.                 i=ulist(i,0,0,50,&dflt,&bar,"File Transfer Protocols",opt);
  759.                 if(i==-1)
  760.                     break;
  761.                 if((i&MSK_ON)==MSK_DEL) {
  762.                     i&=MSK_OFF;
  763.                     FREE(prot[i]);
  764.                     total_prots--;
  765.                     while(i<total_prots) {
  766.                         prot[i]=prot[i+1];
  767.                         i++; }
  768.                     changes=1;
  769.                     continue; }
  770.                 if((i&MSK_ON)==MSK_INS) {
  771.                     i&=MSK_OFF;
  772.                     if((prot=(prot_t **)REALLOC(prot
  773.                         ,sizeof(prot_t *)*(total_prots+1)))==NULL) {
  774.                         errormsg(WHERE,ERR_ALLOC,nulstr,total_prots+1);
  775.                         total_prots=0;
  776.                         bail(1);
  777.                         continue; }
  778.                     if(!total_prots) {
  779.                         if((prot[0]=(prot_t *)MALLOC(
  780.                             sizeof(prot_t)))==NULL) {
  781.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(prot_t));
  782.                             continue; }
  783.                         memset(prot[0],0,sizeof(prot_t));
  784.                         prot[0]->mnemonic='Y';
  785.                         prot[0]->misc=PROT_DSZLOG;
  786.                         strcpy(prot[0]->ulcmd
  787.                             ,"%!dsz port %p estimate 0 %e rb %f");
  788.                         strcpy(prot[0]->dlcmd
  789.                             ,"%!dsz port %p estimate 0 %e sb %f");
  790.                         strcpy(prot[0]->batulcmd
  791.                             ,"%!dsz port %p estimate 0 %e rb %f");
  792.                         strcpy(prot[0]->batdlcmd
  793.                             ,"%!dsz port %p estimate 0 %e sb @%f"); }
  794.                     else {
  795.  
  796.                         for(j=total_prots;j>i;j--)
  797.                             prot[j]=prot[j-1];
  798.                         if((prot[i]=(prot_t *)MALLOC(
  799.                             sizeof(prot_t)))==NULL) {
  800.                             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(prot_t));
  801.                             continue; }
  802.                         *prot[i]=*prot[i+1]; }
  803.                     total_prots++;
  804.                     changes=1;
  805.                     continue; }
  806.                 if((i&MSK_ON)==MSK_GET) {
  807.                     i&=MSK_OFF;
  808.                     savprot=*prot[i];
  809.                     continue; }
  810.                 if((i&MSK_ON)==MSK_PUT) {
  811.                     i&=MSK_OFF;
  812.                     *prot[i]=savprot;
  813.                     changes=1;
  814.                     continue; }
  815.                 done=0;
  816.                 k=0;
  817.                 while(!done) {
  818.                     j=0;
  819.                     sprintf(opt[j++],"%-25.25s%c","Mnemonic (Command Key)"
  820.                         ,prot[i]->mnemonic);
  821.                     sprintf(opt[j++],"%-25.25s%-40s","Protocol Name"
  822.                         ,prot[i]->name);
  823.                     sprintf(opt[j++],"%-25.25s%-40s","Access Requirements"
  824.                         ,prot[i]->ar);
  825.                     sprintf(opt[j++],"%-25.25s%-40s","Upload Command Line"
  826.                         ,prot[i]->ulcmd);
  827.                     sprintf(opt[j++],"%-25.25s%-40s","Download Command Line"
  828.                         ,prot[i]->dlcmd);
  829.                     sprintf(opt[j++],"%-25.25s%-40s","Batch UL Command Line"
  830.                         ,prot[i]->batulcmd);
  831.                     sprintf(opt[j++],"%-25.25s%-40s","Batch DL Command Line"
  832.                         ,prot[i]->batdlcmd);
  833.                     sprintf(opt[j++],"%-25.25s%-40s","Bidir Command Line"
  834.                         ,prot[i]->bicmd);
  835.                     sprintf(opt[j++],"%-25.25s%s","Uses DSZLOG"
  836.                         ,prot[i]->misc&PROT_DSZLOG ? "Yes":"No");
  837.                     opt[j][0]=0;
  838.                     savnum=1;
  839.                     switch(ulist(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&k,0
  840.                         ,"File Transfer Protocol",opt)) {
  841.                         case -1:
  842.                             done=1;
  843.                             break;
  844.                         case 0:
  845.                             str[0]=prot[i]->mnemonic;
  846.                             str[1]=0;
  847.                             uinput(WIN_MID|WIN_SAV,0,0
  848.                                 ,"Mnemonic (Command Key)"
  849.                                 ,str,1,K_UPPER|K_EDIT);
  850.                             if(str[0])
  851.                                 prot[i]->mnemonic=str[0];
  852.                             break;
  853.                         case 1:
  854.                             uinput(WIN_MID|WIN_SAV,0,0
  855.                                 ,"Protocol Name"
  856.                                 ,prot[i]->name,25,K_EDIT);
  857.                             break;
  858.                         case 2:
  859.                             savnum=2;
  860.                             sprintf(str,"Protocol %s",prot[i]->name);
  861.                             getar(str,prot[i]->ar);
  862.                             break;
  863.                         case 3:
  864.                             uinput(WIN_MID|WIN_SAV,0,0
  865.                                 ,"Upload Command"
  866.                                 ,prot[i]->ulcmd,50,K_EDIT);
  867.                             break;
  868.                         case 4:
  869.                             uinput(WIN_MID|WIN_SAV,0,0
  870.                                 ,"Download Command"
  871.                                 ,prot[i]->dlcmd,50,K_EDIT);
  872.                             break;
  873.                         case 5:
  874.                             uinput(WIN_MID|WIN_SAV,0,0
  875.                                 ,"Batch UL Command"
  876.                                 ,prot[i]->batulcmd,50,K_EDIT);
  877.                             break;
  878.                         case 6:
  879.                             uinput(WIN_MID|WIN_SAV,0,0
  880.                                 ,"Batch DL Command"
  881.                                 ,prot[i]->batdlcmd,50,K_EDIT);
  882.                             break;
  883.                         case 7:
  884.                             uinput(WIN_MID|WIN_SAV,0,0
  885.                                 ,"Bi-dir Command"
  886.                                 ,prot[i]->bicmd,50,K_EDIT);
  887.                             break;
  888.                         case 8:
  889.                             strcpy(opt[0],"Yes");
  890.                             strcpy(opt[1],"No");
  891.                             opt[2][0]=0;
  892.                             l=0;
  893.                             savnum=2;
  894.                             l=ulist(WIN_MID|WIN_SAV,0,0,0,&l,0
  895.                                 ,"Uses DSZLOG",opt);
  896.                             if(!l && !(prot[i]->misc&PROT_DSZLOG)) {
  897.                                 prot[i]->misc|=PROT_DSZLOG;
  898.                                 changes=1; }
  899.                             else if(l==1 && prot[i]->misc&PROT_DSZLOG) {
  900.                                 prot[i]->misc&=~PROT_DSZLOG;
  901.                                 changes=1; }
  902.                             break; } } }
  903.             break;
  904.         case 13:    /* Alternate file paths */
  905.             dflt=bar=0;
  906.             while(1) {
  907.                 for(i=0;i<altpaths;i++)
  908.                     sprintf(opt[i],"%3d: %-40s",i+1,altpath[i]);
  909.                 opt[i][0]=0;
  910.                 i=WIN_ACT|WIN_SAV;    /* save cause size can change */
  911.                 if((int)altpaths<MAX_OPTS)
  912.                     i|=WIN_INS;
  913.                 if(altpaths)
  914.                     i|=WIN_DEL|WIN_GET;
  915.                 if(savaltpath[0])
  916.                     i|=WIN_PUT;
  917.                 savnum=0;
  918.                 SETHELP(WHERE);
  919. /*
  920. Alternate File Paths:
  921.  
  922. This option allows the sysop to add and configure alternate file paths
  923. for files stored on drives and directories other than the configured
  924. storage path for a file directory. This command is useful for those who
  925. have file directories where they wish to have files listed from
  926. multiple CD-ROMs or hard disks.
  927. */
  928.                 i=ulist(i,0,0,50,&dflt,&bar,"Alternate File Paths",opt);
  929.                 if(i==-1)
  930.                     break;
  931.                 if((i&MSK_ON)==MSK_DEL) {
  932.                     i&=MSK_OFF;
  933.                     FREE(altpath[i]);
  934.                     altpaths--;
  935.                     while(i<altpaths) {
  936.                         altpath[i]=altpath[i+1];
  937.                         i++; }
  938.                     changes=1;
  939.                     continue; }
  940.                 if((i&MSK_ON)==MSK_INS) {
  941.                     i&=MSK_OFF;
  942.                     if((altpath=(char **)REALLOC(altpath
  943.                         ,sizeof(char *)*(altpaths+1)))==NULL) {
  944.                         errormsg(WHERE,ERR_ALLOC,nulstr,altpaths+1);
  945.                         altpaths=0;
  946.                         bail(1);
  947.                         continue; }
  948.                     if(!altpaths) {
  949.                         if((altpath[0]=(char *)MALLOC(LEN_DIR+1))==NULL) {
  950.                             errormsg(WHERE,ERR_ALLOC,nulstr,LEN_DIR+1);
  951.                             continue; }
  952.                         memset(altpath[0],0,LEN_DIR+1); }
  953.                     else {
  954.                         for(j=altpaths;j>i;j--)
  955.                             altpath[j]=altpath[j-1];
  956.                         if((altpath[i]=(char *)MALLOC(LEN_DIR+1))==NULL) {
  957.                             errormsg(WHERE,ERR_ALLOC,nulstr,LEN_DIR+1);
  958.                             continue; }
  959.                         memcpy(altpath[i],altpath[i+1],LEN_DIR+1); }
  960.                     altpaths++;
  961.                     changes=1;
  962.                     continue; }
  963.                 if((i&MSK_ON)==MSK_GET) {
  964.                     i&=MSK_OFF;
  965.                     memcpy(savaltpath,altpath[i],LEN_DIR+1);
  966.                     continue; }
  967.                 if((i&MSK_ON)==MSK_PUT) {
  968.                     i&=MSK_OFF;
  969.                     memcpy(altpath[i],savaltpath,LEN_DIR+1);
  970.                     changes=1;
  971.                     continue; }
  972.                 sprintf(str,"Path %d",i+1);
  973.                 uinput(WIN_MID|WIN_SAV,0,0,str,altpath[i],50,K_UPPER|K_EDIT); }
  974.             break; } }
  975. }
  976.  
  977.