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

  1. #line 2 "SCFGXFR2.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_cfg()
  8. {
  9.     static int libs_dflt,libs_bar,dflt;
  10.     char str[256],str2[81],done=0,*p;
  11.     int file,j,k,q;
  12.     uint i;
  13.     long ported;
  14.     static lib_t savlib;
  15.     dir_t tmpdir;
  16.     FILE *stream;
  17.  
  18. while(1) {
  19.     for(i=0;i<total_libs && i<MAX_OPTS;i++)
  20.         sprintf(opt[i],"%-25s",lib[i]->lname);
  21.     opt[i][0]=0;
  22.     j=WIN_ACT|WIN_CHE|WIN_ORG;
  23.     if(total_libs)
  24.         j|=WIN_DEL|WIN_GET|WIN_DELACT;
  25.     if(total_libs<MAX_OPTS)
  26.         j|=WIN_INS|WIN_INSACT|WIN_XTR;
  27.     if(savlib.sname[0])
  28.         j|=WIN_PUT;
  29.     SETHELP(WHERE);
  30. /*
  31. File Libraries:
  32.  
  33. This is a listing of file libraries for your BBS. File Libraries are
  34. used to logically separate your file directories into groups. Every
  35. directory belongs to a file library.
  36.  
  37. One popular use for file libraries is to separate CD-ROM and hard disk
  38. directories. One might have an Uploads file library that contains
  39. uploads to the hard disk directories and also have a PC-SIG file
  40. library that contains directories from a PC-SIG CD-ROM. Some sysops
  41. separate directories into more specific areas such as Main, Graphics,
  42. or Adult. If you have many directories that have a common subject
  43. denominator, you may want to have a separate file library for those
  44. directories for a more organized file structure.
  45. */
  46.     i=ulist(j,0,0,45,&libs_dflt,&libs_bar,"File Libraries",opt);
  47.     if((signed)i==-1) {
  48.         j=save_changes(WIN_MID);
  49.         if(j==-1)
  50.             continue;
  51.         if(!j)
  52.             write_file_cfg();
  53.         return; }
  54.     if((i&MSK_ON)==MSK_INS) {
  55.         i&=MSK_OFF;
  56.         strcpy(str,"Main");
  57.         SETHELP(WHERE);
  58. /*
  59. Library Long Name:
  60.  
  61. This is a description of the file library which is displayed when a
  62. user of the system uses the /* command from the file transfer menu.
  63. */*/
  64.         if(uinput(WIN_MID|WIN_SAV,0,0,"Library Long Name",str,LEN_GLNAME
  65.             ,K_EDIT)<1)
  66.             continue;
  67.         sprintf(str2,"%.*s",LEN_GSNAME,str);
  68.         SETHELP(WHERE);
  69. /*
  70. Library Short Name:
  71.  
  72. This is a short description of the file library which is used for the
  73. file transfer menu prompt.
  74. */
  75.         if(uinput(WIN_MID|WIN_SAV,0,0,"Library Short Name",str2,LEN_GSNAME
  76.             ,K_EDIT)<1)
  77.             continue;
  78.         if((lib=(lib_t **)REALLOC(lib,sizeof(lib_t *)*(total_libs+1)))==NULL) {
  79.             errormsg(WHERE,ERR_ALLOC,nulstr,total_libs+1);
  80.             total_libs=0;
  81.             bail(1);
  82.             continue; }
  83.  
  84.         if(total_libs) {
  85.             for(j=total_libs;j>i;j--)
  86.                 lib[j]=lib[j-1];
  87.             for(j=0;j<total_dirs;j++)
  88.                 if(dir[j]->lib>=i)
  89.                     dir[j]->lib++; }
  90.         if((lib[i]=(lib_t *)MALLOC(sizeof(lib_t)))==NULL) {
  91.             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(lib_t));
  92.             continue; }
  93.         memset((lib_t *)lib[i],0,sizeof(lib_t));
  94.         strcpy(lib[i]->lname,str);
  95.         strcpy(lib[i]->sname,str2);
  96.         total_libs++;
  97.         changes=1;
  98.         continue; }
  99.     if((i&MSK_ON)==MSK_DEL) {
  100.         i&=MSK_OFF;
  101.         SETHELP(WHERE);
  102. /*
  103. Delete All Data in Library:
  104.  
  105. If you wish to delete the database files for all directories in this
  106. library, select Yes.
  107. */
  108.         j=1;
  109.         strcpy(opt[0],"Yes");
  110.         strcpy(opt[1],"No");
  111.         opt[2][0]=0;
  112.         j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
  113.             ,"Delete All Library Data Files",opt);
  114.         if(j==-1)
  115.             continue;
  116.         if(j==0)
  117.             for(j=0;j<total_dirs;j++)
  118.                 if(dir[j]->lib==i) {
  119.                     sprintf(str,"%s.*",dir[j]->code);
  120.                     if(!dir[j]->data_dir[0])
  121.                         sprintf(tmp,"%sDIRS\\",data_dir);
  122.                     else
  123.                         strcpy(tmp,dir[j]->data_dir);
  124.                     delfiles(tmp,str); }
  125.         FREE(lib[i]);
  126.         for(j=0;j<total_dirs;) {
  127.             if(dir[j]->lib==i) {
  128.                 FREE(dir[j]);
  129.                 total_dirs--;
  130.                 k=j;
  131.                 while(k<total_dirs) {
  132.                     dir[k]=dir[k+1];
  133.                     k++; } }
  134.             else j++; }
  135.         for(j=0;j<total_dirs;j++)
  136.             if(dir[j]->lib>i)
  137.                 dir[j]->lib--;
  138.         total_libs--;
  139.         while(i<total_libs) {
  140.             lib[i]=lib[i+1];
  141.             i++; }
  142.         changes=1;
  143.         continue; }
  144.     if((i&MSK_ON)==MSK_GET) {
  145.         i&=MSK_OFF;
  146.         savlib=*lib[i];
  147.         continue; }
  148.     if((i&MSK_ON)==MSK_PUT) {
  149.         i&=MSK_OFF;
  150.         *lib[i]=savlib;
  151.         changes=1;
  152.         continue; }
  153.     done=0;
  154.     while(!done) {
  155.         j=0;
  156.         sprintf(opt[j++],"%-27.27s%s","Long Name",lib[i]->lname);
  157.         sprintf(opt[j++],"%-27.27s%s","Short Name",lib[i]->sname);
  158.         sprintf(opt[j++],"%-27.27s%.40s","Access Requirements"
  159.             ,lib[i]->ar);
  160.         strcpy(opt[j++],"Clone Options");
  161.         strcpy(opt[j++],"Export Areas...");
  162.         strcpy(opt[j++],"Import Areas...");
  163.         strcpy(opt[j++],"File Directories...");
  164.         opt[j][0]=0;
  165.         savnum=0;
  166.         sprintf(str,"%s Library",lib[i]->sname);
  167.         SETHELP(WHERE);
  168. /*
  169. File Library Configuration:
  170.  
  171. This menu allows you to configure the security requirments for access
  172. to this file library. You can also add, delete, and configure the
  173. directories of this library by selecting the File Directories... option.
  174. */
  175.         switch(ulist(WIN_ACT,6,4,60,&dflt,0,str,opt)) {
  176.             case -1:
  177.                 done=1;
  178.                 break;
  179.             case 0:
  180.                 SETHELP(WHERE);
  181. /*
  182. Library Long Name:
  183.  
  184. This is a description of the file library which is displayed when a
  185. user of the system uses the /* command from the file transfer menu.
  186. */*/
  187.                 strcpy(str,lib[i]->lname);    /* save */
  188.                 if(!uinput(WIN_MID|WIN_SAV,0,0,"Name to use for Listings"
  189.                     ,lib[i]->lname,LEN_GLNAME,K_EDIT))
  190.                     strcpy(lib[i]->lname,str);    /* restore */
  191.                 break;
  192.             case 1:
  193.                 SETHELP(WHERE);
  194. /*
  195. Library Short Name:
  196.  
  197. This is a short description of the file librarly which is used for the
  198. file transfer menu prompt.
  199. */
  200.                 uinput(WIN_MID|WIN_SAV,0,0,"Name to use for Prompts"
  201.                     ,lib[i]->sname,LEN_GSNAME,K_EDIT);
  202.                 break;
  203.             case 2:
  204.                 sprintf(str,"%s Library",lib[i]->sname);
  205.                 getar(str,lib[i]->ar);
  206.                 break;
  207.             case 3: /* clone options */
  208.                 j=0;
  209.                 strcpy(opt[0],"Yes");
  210.                 strcpy(opt[1],"No");
  211.                 opt[2][0]=0;
  212.                 SETHELP(WHERE);
  213. /*
  214. Clone Directory Options:
  215.  
  216. If you want to clone the options of the first directory of this library
  217. into all directories of this library, select Yes.
  218.  
  219. The options cloned are upload requirments, download requirments,
  220. operator requirements, exempted user requirements, toggle options,
  221. maximum number of files, allowed file extensions, default file
  222. extension, and sort type.
  223. */
  224.                 j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
  225.                     ,"Clone Options of First Directory into All of Library"
  226.                     ,opt);
  227.                 if(j==0) {
  228.                     k=-1;
  229.                     for(j=0;j<total_dirs;j++)
  230.                         if(dir[j]->lib==i) {
  231.                             if(k==-1)
  232.                                 k=j;
  233.                             else {
  234.                                 changes=1;
  235.                                 dir[j]->misc=dir[k]->misc;
  236.                                 strcpy(dir[j]->ul_ar,dir[k]->ul_ar);
  237.                                 strcpy(dir[j]->dl_ar,dir[k]->dl_ar);
  238.                                 strcpy(dir[j]->op_ar,dir[k]->op_ar);
  239.                                 strcpy(dir[j]->ex_ar,dir[k]->ex_ar);
  240.                                 strcpy(dir[j]->exts,dir[k]->exts);
  241.                                 strcpy(dir[j]->data_dir,dir[k]->data_dir);
  242.                                 strcpy(dir[j]->upload_sem,dir[k]->upload_sem);
  243.                                 dir[j]->maxfiles=dir[k]->maxfiles;
  244.                                 dir[j]->maxage=dir[k]->maxage;
  245.                                 dir[j]->up_pct=dir[k]->up_pct;
  246.                                 dir[j]->dn_pct=dir[k]->dn_pct;
  247.                                 dir[j]->seqdev=dir[k]->seqdev;
  248.                                 dir[j]->sort=dir[k]->sort; } } }
  249.                 break;
  250.             case 4:
  251.                 k=0;
  252.                 ported=0;
  253.                 q=changes;
  254.                 strcpy(opt[k++],"DIRS.TXT    (Synchronet)");
  255.                 strcpy(opt[k++],"FILEBONE.NA (Fido)");
  256.                 opt[k][0]=0;
  257.                 SETHELP(WHERE);
  258. /*
  259. Export Area File Format:
  260.  
  261. This menu allows you to choose the format of the area file you wish to
  262. export to.
  263. */
  264.                 k=0;
  265.                 k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0
  266.                     ,"Export Area File Format",opt);
  267.                 if(k==-1)
  268.                     break;
  269.                 if(k==0)
  270.                     sprintf(str,"%sDIRS.TXT",ctrl_dir);
  271.                 else if(k==1)
  272.                     sprintf(str,"FILEBONE.NA");
  273.                 strupr(str);
  274.                 if(uinput(WIN_MID|WIN_SAV,0,0,"Filename"
  275.                     ,str,40,K_UPPER|K_EDIT)<=0) {
  276.                     changes=q;
  277.                     break; }
  278.                 if(fexist(str)) {
  279.                     strcpy(opt[0],"Overwrite");
  280.                     strcpy(opt[1],"Append");
  281.                     opt[2][0]=0;
  282.                     j=0;
  283.                     j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
  284.                         ,"File Exists",opt);
  285.                     if(j==-1)
  286.                         break;
  287.                     if(j==0) j=O_WRONLY|O_TRUNC;
  288.                     else     j=O_WRONLY|O_APPEND; }
  289.                 else
  290.                     j=O_WRONLY|O_CREAT;
  291.                 if((stream=fnopen(&file,str,j))==NULL) {
  292.                     umsg("Open Failure");
  293.                     break; }
  294.                 upop("Exporting Areas...");
  295.                 for(j=0;j<total_dirs;j++) {
  296.                     if(dir[j]->lib!=i)
  297.                         continue;
  298.                     ported++;
  299.                     if(k==1) {
  300.                         fprintf(stream,"Area %-8s  0     !      %s\r\n"
  301.                             ,dir[j]->code,dir[j]->lname);
  302.                         continue; }
  303.                     fprintf(stream,"%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n"
  304.                             "%s\r\n%s\r\n"
  305.                         ,dir[j]->lname
  306.                         ,dir[j]->sname
  307.                         ,dir[j]->code
  308.                         ,dir[j]->data_dir
  309.                         ,dir[j]->ar
  310.                         ,dir[j]->ul_ar
  311.                         ,dir[j]->dl_ar
  312.                         ,dir[j]->op_ar
  313.                         );
  314.                     fprintf(stream,"%s\r\n%s\r\n%u\r\n%s\r\n%lX\r\n%u\r\n"
  315.                             "%u\r\n"
  316.                         ,dir[j]->path
  317.                         ,dir[j]->upload_sem
  318.                         ,dir[j]->maxfiles
  319.                         ,dir[j]->exts
  320.                         ,dir[j]->misc
  321.                         ,dir[j]->seqdev
  322.                         ,dir[j]->sort
  323.                         );
  324.                     fprintf(stream,"%s\r\n%u\r\n%u\r\n%u\r\n"
  325.                         ,dir[j]->ex_ar
  326.                         ,dir[j]->maxage
  327.                         ,dir[j]->up_pct
  328.                         ,dir[j]->dn_pct
  329.                         );
  330.                     fprintf(stream,"***END-OF-DIR***\r\n\r\n"); }
  331.                 fclose(stream);
  332.                 upop(0);
  333.                 sprintf(str,"%lu File Areas Exported Successfully",ported);
  334.                 umsg(str);
  335.                 changes=q;
  336.                 break;
  337.  
  338.             case 5:
  339.                 ported=0;
  340.                 k=0;
  341.                 SETHELP(WHERE);
  342. /*
  343. Import Area File Format:
  344.  
  345. This menu allows you to choose the format of the area file you wish to
  346. import into the current file library.
  347. */
  348.                 strcpy(opt[k++],"DIRS.TXT    (Synchronet)");
  349.                 strcpy(opt[k++],"FILEBONE.NA (Fido)");
  350.                 opt[k][0]=0;
  351.                 k=0;
  352.                 k=ulist(WIN_MID|WIN_SAV,0,0,0,&k,0
  353.                     ,"Import Area File Format",opt);
  354.                 if(k==-1)
  355.                     break;
  356.                 if(k==0)
  357.                     sprintf(str,"%sDIRS.TXT",ctrl_dir);
  358.                 else if(k==1)
  359.                     sprintf(str,"FILEBONE.NA");
  360.                 strupr(str);
  361.                 if(uinput(WIN_MID|WIN_SAV,0,0,"Filename"
  362.                     ,str,40,K_UPPER|K_EDIT)<=0)
  363.                     break;
  364.                 if((stream=fnopen(&file,str,O_RDONLY))==NULL) {
  365.                     umsg("Open Failure");
  366.                     break; }
  367.                 upop("Importing Areas...");
  368.                 while(!feof(stream)) {
  369.                     if(!fgets(str,128,stream)) break;
  370.                     truncsp(str);
  371.                     if(!str[0])
  372.                         continue;
  373.                     if(k) {
  374.                         p=str;
  375.                         while(*p && *p<=SP) p++;
  376.                         if(strnicmp(p,"AREA ",5))
  377.                             continue;
  378.                         memset(&tmpdir,0,sizeof(dir_t));
  379.                         tmpdir.misc|=
  380.                             (DIR_FCHK|DIR_DUPES|DIR_CDTUL|DIR_CDTDL|DIR_DIZ);
  381.                         if(k==1) {
  382.                             p+=5;
  383.                             while(*p && *p<=SP) p++;
  384.                             sprintf(tmpdir.code,"%.8s",p);
  385.                             truncsp(tmpdir.code);
  386.                             while(*p>SP) p++;            /* Skip areaname */
  387.                             while(*p && *p<=SP) p++;    /* Skip space */
  388.                             while(*p>SP) p++;            /* Skip level */
  389.                             while(*p && *p<=SP) p++;    /* Skip space */
  390.                             while(*p>SP) p++;            /* Skip flags */
  391.                             while(*p && *p<=SP) p++;    /* Skip space */
  392.                             sprintf(tmpdir.lname,"%.*s",LEN_SLNAME,p); }
  393.                         ported++; }
  394.                     else {
  395.                         memset(&tmpdir,0,sizeof(dir_t));
  396.                         sprintf(tmpdir.lname,"%.*s",LEN_SLNAME,str);
  397.                         if(!fgets(str,128,stream)) break;
  398.                         truncsp(str);
  399.                         sprintf(tmpdir.sname,"%.*s",LEN_SSNAME,str);
  400.                         if(!fgets(str,128,stream)) break;
  401.                         truncsp(str);
  402.                         sprintf(tmpdir.code,"%.*s",8,str);
  403.                         if(!fgets(str,128,stream)) break;
  404.                         truncsp(str);
  405.                         sprintf(tmpdir.data_dir,"%.*s",LEN_DIR,str);
  406.                         if(!fgets(str,128,stream)) break;
  407.                         truncsp(str);
  408.                         sprintf(tmpdir.ar,"%.*s",LEN_ARSTR,str);
  409.                         if(!fgets(str,128,stream)) break;
  410.                         truncsp(str);
  411.                         sprintf(tmpdir.ul_ar,"%.*s",LEN_ARSTR,str);
  412.                         if(!fgets(str,128,stream)) break;
  413.                         truncsp(str);
  414.                         sprintf(tmpdir.dl_ar,"%.*s",LEN_ARSTR,str);
  415.                         if(!fgets(str,128,stream)) break;
  416.                         truncsp(str);
  417.                         sprintf(tmpdir.op_ar,"%.*s",LEN_ARSTR,str);
  418.                         if(!fgets(str,128,stream)) break;
  419.                         truncsp(str);
  420.                         sprintf(tmpdir.path,"%.*s",LEN_DIR,str);
  421.                         if(!fgets(str,128,stream)) break;
  422.                         truncsp(str);
  423.                         sprintf(tmpdir.upload_sem,"%.*s",LEN_DIR,str);
  424.                         if(!fgets(str,128,stream)) break;
  425.                         truncsp(str);
  426.                         tmpdir.maxfiles=atoi(str);
  427.                         if(!fgets(str,128,stream)) break;
  428.                         truncsp(str);
  429.                         sprintf(tmpdir.exts,"%.*s",40,str);
  430.                         if(!fgets(str,128,stream)) break;
  431.                         truncsp(str);
  432.                         tmpdir.misc=ahtoul(str);
  433.                         if(!fgets(str,128,stream)) break;
  434.                         truncsp(str);
  435.                         tmpdir.seqdev=atoi(str);
  436.                         if(!fgets(str,128,stream)) break;
  437.                         truncsp(str);
  438.                         tmpdir.sort=atoi(str);
  439.                         if(!fgets(str,128,stream)) break;
  440.                         truncsp(str);
  441.                         sprintf(tmpdir.ex_ar,"%.*s",LEN_ARSTR,str);
  442.                         if(!fgets(str,128,stream)) break;
  443.                         truncsp(str);
  444.                         tmpdir.maxage=atoi(str);
  445.                         if(!fgets(str,128,stream)) break;
  446.                         truncsp(str);
  447.                         tmpdir.up_pct=atoi(str);
  448.                         if(!fgets(str,128,stream)) break;
  449.                         truncsp(str);
  450.                         tmpdir.dn_pct=atoi(str);
  451.  
  452.                         ported++;
  453.                         while(!feof(stream)
  454.                             && strcmp(str,"***END-OF-DIR***")) {
  455.                             if(!fgets(str,128,stream)) break;
  456.                             truncsp(str); } }
  457.  
  458.                     for(j=0;j<total_dirs;j++) {
  459.                         if(dir[j]->lib!=i)
  460.                             continue;
  461.                         if(!stricmp(dir[j]->code,tmpdir.code))
  462.                             break; }
  463.                     if(j==total_dirs) {
  464.  
  465.                         if((dir=(dir_t **)REALLOC(dir
  466.                             ,sizeof(dir_t *)*(total_dirs+1)))==NULL) {
  467.                             errormsg(WHERE,ERR_ALLOC,"dir",total_dirs+1);
  468.                             total_dirs=0;
  469.                             bail(1);
  470.                             break; }
  471.  
  472.                         if((dir[j]=(dir_t *)MALLOC(sizeof(dir_t)))
  473.                             ==NULL) {
  474.                             errormsg(WHERE,ERR_ALLOC,"dir",sizeof(dir_t));
  475.                             break; }
  476.                         memset(dir[j],0,sizeof(dir_t)); }
  477.                     if(!k)
  478.                         memcpy(dir[j],&tmpdir,sizeof(dir_t));
  479.                     else {
  480.                         strcpy(dir[j]->code,tmpdir.code);
  481.                         strcpy(dir[j]->sname,tmpdir.code);
  482.                         strcpy(dir[j]->lname,tmpdir.lname);
  483.                         if(j==total_dirs) {
  484.                             dir[j]->maxfiles=1000;
  485.                             dir[j]->up_pct=cdt_up_pct;
  486.                             dir[j]->dn_pct=cdt_dn_pct; }
  487.                         }
  488.                     dir[j]->lib=i;
  489.                     if(j==total_dirs) {
  490.                         dir[j]->misc=tmpdir.misc;
  491.                         total_dirs++; }
  492.                     changes=1; }
  493.                 fclose(stream);
  494.                 upop(0);
  495.                 sprintf(str,"%lu File Areas Imported Successfully",ported);
  496.                 umsg(str);
  497.                 break;
  498.  
  499.             case 6:
  500.                 dir_cfg(i);
  501.                 break; } } }
  502.  
  503. }
  504.  
  505. void dir_cfg(uint libnum)
  506. {
  507.     static int dflt,bar,tog_dflt,tog_bar,adv_dflt,opt_dflt;
  508.     char str[81],str2[81],code[9],path[128],done=0,*p;
  509.     int j,n;
  510.     uint i,dirnum[MAX_OPTS+1];
  511.     static dir_t savdir;
  512.  
  513. while(1) {
  514.     for(i=0,j=0;i<total_dirs && j<MAX_OPTS;i++)
  515.         if(dir[i]->lib==libnum) {
  516.             sprintf(opt[j],"%-25s",dir[i]->lname);
  517.             dirnum[j++]=i; }
  518.     dirnum[j]=total_dirs;
  519.     opt[j][0]=0;
  520.     sprintf(str,"%s Directories",lib[libnum]->sname);
  521.     savnum=0;
  522.     i=WIN_SAV|WIN_ACT;
  523.     if(j)
  524.         i|=WIN_DEL|WIN_GET|WIN_DELACT;
  525.     if(j<MAX_OPTS)
  526.         i|=WIN_INS|WIN_INSACT|WIN_XTR;
  527.     if(savdir.sname[0])
  528.         i|=WIN_PUT;
  529.     SETHELP(WHERE);
  530. /*
  531. File Directories:
  532.  
  533. This is a list of file directories that have been configured for the
  534. selected file library.
  535.  
  536. To add a directory, select the desired position with the arrow keys and
  537. hit  INS .
  538.  
  539. To delete a directory, select it with the arrow keys and hit  DEL .
  540.  
  541. To configure a directory, select it with the arrow keys and hit  ENTER .
  542. */
  543.     i=ulist(i,24,1,45,&dflt,&bar,str,opt);
  544.     savnum=1;
  545.     if((signed)i==-1)
  546.         return;
  547.     if((i&MSK_ON)==MSK_INS) {
  548.         i&=MSK_OFF;
  549.         strcpy(str,"Games");
  550.         SETHELP(WHERE);
  551. /*
  552. Directory Long Name:
  553.  
  554. This is a description of the file directory which is displayed in all
  555. directory listings.
  556. */
  557.         if(uinput(WIN_MID|WIN_SAV,0,0,"Directory Long Name",str,LEN_SLNAME
  558.             ,K_EDIT)<1)
  559.             continue;
  560.         sprintf(str2,"%.*s",LEN_SSNAME,str);
  561.         SETHELP(WHERE);
  562. /*
  563. Directory Short Name:
  564.  
  565. This is a short description of the file directory which is displayed at
  566. the file transfer prompt.
  567. */
  568.         if(uinput(WIN_MID|WIN_SAV,0,0,"Directory Short Name",str2,LEN_SSNAME
  569.             ,K_EDIT)<1)
  570.             continue;
  571.         sprintf(code,"%.8s",str2);
  572.         p=strchr(code,SP);
  573.         if(p) *p=0;
  574.         strupr(code);
  575.         SETHELP(WHERE);
  576. /*
  577. Directory Internal Code:
  578.  
  579. Every directory must have its own unique code for Synchronet to refer to
  580. it internally. This code should be descriptive of the directory's
  581. contents, usually an abreviation of the directory's name.
  582. */
  583.         if(uinput(WIN_MID|WIN_SAV,0,0,"Directory Internal Code",code,8
  584.             ,K_EDIT|K_UPPER)<1)
  585.             continue;
  586.         if(!code_ok(code)) {
  587.             helpbuf=invalid_code;
  588.             umsg("Invalid Code");
  589.             helpbuf=0;
  590.             continue; }
  591.         sprintf(path,"%sDIRS\\%s",data_dir,code);
  592.         SETHELP(WHERE);
  593. /*
  594. Directory File Path:
  595.  
  596. This is the drive and directory where your uploads to and downloads from
  597. this directory will be stored. Example: C:\XFER\GAMES
  598. */
  599.         if(uinput(WIN_MID|WIN_SAV,0,0,"Directory File Path",path,50
  600.             ,K_EDIT|K_UPPER)<1)
  601.             continue;
  602.         if((dir=(dir_t **)REALLOC(dir,sizeof(dir_t *)*(total_dirs+1)))==NULL) {
  603.             errormsg(WHERE,ERR_ALLOC,nulstr,total_dirs+1);
  604.             total_dirs=0;
  605.             bail(1);
  606.             continue; }
  607.  
  608.         if(j)
  609.             for(n=total_dirs;n>dirnum[i];n--)
  610.                 dir[n]=dir[n-1];
  611.         if((dir[dirnum[i]]=(dir_t *)MALLOC(sizeof(dir_t)))==NULL) {
  612.             errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(dir_t));
  613.             continue; }
  614.         memset((dir_t *)dir[dirnum[i]],0,sizeof(dir_t));
  615.         dir[dirnum[i]]->lib=libnum;
  616.         dir[dirnum[i]]->maxfiles=MAX_FILES<500 ? MAX_FILES:500;
  617.         if(strcmpi(str2,"OFFLINE"))
  618.             dir[dirnum[i]]->misc=(DIR_FCHK|DIR_MULT|DIR_DUPES
  619.                 |DIR_CDTUL|DIR_CDTDL|DIR_DIZ);
  620.         strcpy(dir[dirnum[i]]->code,code);
  621.         strcpy(dir[dirnum[i]]->lname,str);
  622.         strcpy(dir[dirnum[i]]->sname,str2);
  623.         strcpy(dir[dirnum[i]]->path,path);
  624.         dir[dirnum[i]]->up_pct=cdt_up_pct;
  625.         dir[dirnum[i]]->dn_pct=cdt_dn_pct;
  626.         total_dirs++;
  627.         changes=1;
  628.         continue; }
  629.     if((i&MSK_ON)==MSK_DEL) {
  630.         i&=MSK_OFF;
  631.         SETHELP(WHERE);
  632. /*
  633. Delete Directory Data Files:
  634.  
  635. If you want to delete all the database files for this directory,
  636. select Yes.
  637. */
  638.         j=1;
  639.         strcpy(opt[0],"Yes");
  640.         strcpy(opt[1],"No");
  641.         opt[2][0]=0;
  642.         j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
  643.             ,"Delete Data in Sub-board",opt);
  644.         if(j==-1)
  645.             continue;
  646.         if(j==0) {
  647.                 sprintf(str,"%s.*",dir[dirnum[i]]->code);
  648.                 if(!dir[dirnum[i]]->data_dir[0])
  649.                     sprintf(tmp,"%sDIRS\\",data_dir);
  650.                 else
  651.                     strcpy(tmp,dir[dirnum[i]]->data_dir);
  652.                 delfiles(tmp,str); }
  653.         FREE(dir[dirnum[i]]);
  654.         total_dirs--;
  655.         for(j=dirnum[i];j<total_dirs;j++)
  656.             dir[j]=dir[j+1];
  657.         changes=1;
  658.         continue; }
  659.     if((i&MSK_ON)==MSK_GET) {
  660.         i&=MSK_OFF;
  661.         savdir=*dir[dirnum[i]];
  662.         continue; }
  663.     if((i&MSK_ON)==MSK_PUT) {
  664.         i&=MSK_OFF;
  665.         *dir[dirnum[i]]=savdir;
  666.         dir[dirnum[i]]->lib=libnum;
  667.         changes=1;
  668.         continue; }
  669.     i=dirnum[dflt];
  670.     j=0;
  671.     done=0;
  672.     while(!done) {
  673.         n=0;
  674.         sprintf(opt[n++],"%-27.27s%s","Long Name",dir[i]->lname);
  675.         sprintf(opt[n++],"%-27.27s%s","Short Name",dir[i]->sname);
  676.         sprintf(opt[n++],"%-27.27s%s","Internal Code",dir[i]->code);
  677.         sprintf(opt[n++],"%-27.27s%.40s","Access Requirements"
  678.             ,dir[i]->ar);
  679.         sprintf(opt[n++],"%-27.27s%.40s","Upload Requirements"
  680.             ,dir[i]->ul_ar);
  681.         sprintf(opt[n++],"%-27.27s%.40s","Download Requirements"
  682.             ,dir[i]->dl_ar);
  683.         sprintf(opt[n++],"%-27.27s%.40s","Operator Requirements"
  684.             ,dir[i]->op_ar);
  685.         sprintf(opt[n++],"%-27.27s%.40s","Exemption Requirements"
  686.             ,dir[i]->ex_ar);
  687.         sprintf(opt[n++],"%-27.27s%.40s","Transfer File Path"
  688.             ,dir[i]->path);
  689.         sprintf(opt[n++],"%-27.27s%u","Maximum Number of Files"
  690.             ,dir[i]->maxfiles);
  691.         if(dir[i]->maxage)
  692.             sprintf(str,"Enabled (%u days old)",dir[i]->maxage);
  693.         else
  694.             strcpy(str,"Disabled");
  695.         sprintf(opt[n++],"%-27.27s%s","Purge by Age",str);
  696.         sprintf(opt[n++],"%-27.27s%u%%","Credit on Upload"
  697.             ,dir[i]->up_pct);
  698.         sprintf(opt[n++],"%-27.27s%u%%","Credit on Download"
  699.             ,dir[i]->dn_pct);
  700.         strcpy(opt[n++],"Toggle Options...");
  701.         strcpy(opt[n++],"Advanced Options...");
  702.         opt[n][0]=0;
  703.         sprintf(str,"%s Directory",dir[i]->sname);
  704.         SETHELP(WHERE);
  705. /*
  706. Directory Configuration:
  707.  
  708. This menu allows you to configure the individual selected directory.
  709. Options with a trailing ... provide a sub-menu of more options.
  710. */
  711.         savnum=1;
  712.         switch(ulist(WIN_SAV|WIN_ACT|WIN_RHT|WIN_BOT
  713.             ,0,0,60,&opt_dflt,0,str,opt)) {
  714.             case -1:
  715.                 done=1;
  716.                 break;
  717.             case 0:
  718.                 SETHELP(WHERE);
  719. /*
  720. Directory Long Name:
  721.  
  722. This is a description of the file directory which is displayed in all
  723. directory listings.
  724. */
  725.                 strcpy(str,dir[i]->lname);    /* save */
  726.                 if(!uinput(WIN_L2R|WIN_SAV,0,17,"Name to use for Listings"
  727.                     ,dir[i]->lname,LEN_SLNAME,K_EDIT))
  728.                     strcpy(dir[i]->lname,str);
  729.                 break;
  730.             case 1:
  731.                 SETHELP(WHERE);
  732. /*
  733. Directory Short Name:
  734.  
  735. This is a short description of the file directory which is displayed at
  736. the file transfer prompt.
  737. */
  738.                 uinput(WIN_L2R|WIN_SAV,0,17,"Name to use for Prompts"
  739.                     ,dir[i]->sname,LEN_SSNAME,K_EDIT);
  740.                 break;
  741.             case 2:
  742.                 SETHELP(WHERE);
  743. /*
  744. Directory Internal Code:
  745.  
  746. Every directory must have its own unique code for Synchronet to refer to
  747. it internally. This code should be descriptive of the directory's
  748. contents, usually an abreviation of the directory's name.
  749. */
  750.                 strcpy(str,dir[i]->code);
  751.                 uinput(WIN_L2R|WIN_SAV,0,17,"Internal Code (unique)"
  752.                     ,str,8,K_EDIT|K_UPPER);
  753.                 if(code_ok(str))
  754.                     strcpy(dir[i]->code,str);
  755.                 else {
  756.                     helpbuf=invalid_code;
  757.                     umsg("Invalid Code");
  758.                     helpbuf=0; }
  759.                 break;
  760.             case 3:
  761.                 savnum=2;
  762.                 sprintf(str,"%s Access",dir[i]->sname);
  763.                 getar(str,dir[i]->ar);
  764.                 break;
  765.             case 4:
  766.                 savnum=2;
  767.                 sprintf(str,"%s Upload",dir[i]->sname);
  768.                 getar(str,dir[i]->ul_ar);
  769.                 break;
  770.             case 5:
  771.                 savnum=2;
  772.                 sprintf(str,"%s Download",dir[i]->sname);
  773.                 getar(str,dir[i]->dl_ar);
  774.                 break;
  775.             case 6:
  776.                 savnum=2;
  777.                 sprintf(str,"%s Operator",dir[i]->sname);
  778.                 getar(str,dir[i]->op_ar);
  779.                 break;
  780.             case 7:
  781.                 savnum=2;
  782.                 sprintf(str,"%s Exemption",dir[i]->sname);
  783.                 getar(str,dir[i]->ex_ar);
  784.                 break;
  785.             case 8:
  786.                 SETHELP(WHERE);
  787. /*
  788. File Path:
  789.  
  790. This is the default storage path for files uploaded to this directory.
  791. If this path is blank, files are stored in a directory off of the
  792. DATA\DIRS directory using the internal code of this directory as the
  793. name of the dirdirectory (i.e. DATA\DIRS\<CODE>).
  794.  
  795. This path can be overridden on a per file basis using Alternate File
  796. Paths.
  797. */
  798.                 uinput(WIN_L2R|WIN_SAV,0,17,"File Path"
  799.                     ,dir[i]->path,50,K_EDIT|K_UPPER);
  800.                 break;
  801.             case 9:
  802.                 SETHELP(WHERE);
  803. /*
  804. Maximum Number of Files:
  805.  
  806. This value is the maximum number of files allowed in this directory.
  807. */
  808.                 sprintf(str,"%u",dir[i]->maxfiles);
  809.                 uinput(WIN_L2R|WIN_SAV,0,17,"Maximum Number of Files"
  810.                     ,str,5,K_EDIT|K_NUMBER);
  811.                 n=atoi(str);
  812.                 if(n>MAX_FILES) {
  813.                     sprintf(str,"Maximum Files is %u",MAX_FILES);
  814.                     umsg(str); }
  815.                 else
  816.                     dir[i]->maxfiles=n;
  817.                 break;
  818.             case 10:
  819.                 sprintf(str,"%u",dir[i]->maxage);
  820.                 SETHELP(WHERE);
  821. /*
  822. Maximum Age of Files:
  823.  
  824. This value is the maximum number of days that files will be kept in
  825. the directory based on the date the file was uploaded or last
  826. downloaded (If the Purge by Last Download toggle option is used).
  827.  
  828. The Synchronet file base maintenance program (DELFILES) must be used
  829. to automatically remove files based on age.
  830. */
  831.                 uinput(WIN_MID|WIN_SAV,0,17,"Maximum Age of Files (in days)"
  832.                     ,str,5,K_EDIT|K_NUMBER);
  833.                 dir[i]->maxage=atoi(str);
  834.                 break;
  835.             case 11:
  836. SETHELP(WHERE);
  837. /*
  838. Percentage of Credits to Credit Uploader on Upload:
  839.  
  840. This is the percentage of a file's credit value that is given to users
  841. when they upload files. Most often, this value will be set to 100 to
  842. give full credit value (100%) for uploads.
  843.  
  844. If you want uploaders to receive no credits upon upload, set this value
  845. to 0.
  846. */
  847.                 uinput(WIN_MID|WIN_SAV,0,0
  848.                     ,"Percentage of Credits to Credit Uploader on Upload"
  849.                     ,itoa(dir[i]->up_pct,tmp,10),4,K_EDIT|K_NUMBER);
  850.                 dir[i]->up_pct=atoi(tmp);
  851.                 break;
  852.             case 12:
  853. SETHELP(WHERE);
  854. /*
  855. Percentage of Credits to Credit Uploader on Download:
  856.  
  857. This is the percentage of a file's credit value that is given to users
  858. who upload a file that is later downloaded by another user. This is an
  859. award type system where more popular files will generate more credits
  860. for the uploader.
  861.  
  862. If you do not want uploaders to receive credit when files they upload
  863. are later downloaded, set this value to 0.
  864. */
  865.                 uinput(WIN_MID|WIN_SAV,0,0
  866.                     ,"Percentage of Credits to Credit Uploader on Download"
  867.                     ,itoa(dir[i]->dn_pct,tmp,10),4,K_EDIT|K_NUMBER);
  868.                 dir[i]->dn_pct=atoi(tmp);
  869.                 break;
  870.             case 13:
  871.                 while(1) {
  872.                     n=0;
  873.                     sprintf(opt[n++],"%-27.27s%s","Check for File Existence"
  874.                         ,dir[i]->misc&DIR_FCHK ? "Yes":"No");
  875.                     strcpy(str,"Slow Media Device");
  876.                     if(dir[i]->seqdev) {
  877.                         sprintf(tmp," #%u",dir[i]->seqdev);
  878.                         strcat(str,tmp); }
  879.                     sprintf(opt[n++],"%-27.27s%s",str
  880.                         ,dir[i]->seqdev ? "Yes":"No");
  881.                     sprintf(opt[n++],"%-27.27s%s","Force Content Ratings"
  882.                         ,dir[i]->misc&DIR_RATE ? "Yes":"No");
  883.                     sprintf(opt[n++],"%-27.27s%s","Upload Date in Listings"
  884.                         ,dir[i]->misc&DIR_ULDATE ? "Yes":"No");
  885.                     sprintf(opt[n++],"%-27.27s%s","Multiple File Numberings"
  886.                         ,dir[i]->misc&DIR_MULT ? "Yes":"No");
  887.                     sprintf(opt[n++],"%-27.27s%s","Search for Duplicates"
  888.                         ,dir[i]->misc&DIR_DUPES ? "Yes":"No");
  889.                     sprintf(opt[n++],"%-27.27s%s","Search for New Files"
  890.                         ,dir[i]->misc&DIR_NOSCAN ? "No":"Yes");
  891.                     sprintf(opt[n++],"%-27.27s%s","Search for Auto-ADDFILES"
  892.                         ,dir[i]->misc&DIR_NOAUTO ? "No":"Yes");
  893.                     sprintf(opt[n++],"%-27.27s%s","Import FILE_ID.DIZ"
  894.                         ,dir[i]->misc&DIR_DIZ ? "Yes":"No");
  895.                     sprintf(opt[n++],"%-27.27s%s","Free Downloads"
  896.                         ,dir[i]->misc&DIR_FREE ? "Yes":"No");
  897.                     sprintf(opt[n++],"%-27.27s%s","Free Download Time"
  898.                         ,dir[i]->misc&DIR_TFREE ? "Yes":"No");
  899.                     sprintf(opt[n++],"%-27.27s%s","Deduct Upload Time"
  900.                         ,dir[i]->misc&DIR_ULTIME ? "Yes":"No");
  901.                     sprintf(opt[n++],"%-27.27s%s","Credit Uploads"
  902.                         ,dir[i]->misc&DIR_CDTUL ? "Yes":"No");
  903.                     sprintf(opt[n++],"%-27.27s%s","Credit Downloads"
  904.                         ,dir[i]->misc&DIR_CDTDL ? "Yes":"No");
  905.                     sprintf(opt[n++],"%-27.27s%s","Credit with Minutes"
  906.                         ,dir[i]->misc&DIR_CDTMIN ? "Yes":"No");
  907.                     sprintf(opt[n++],"%-27.27s%s","Anonymous Uploads"
  908.                         ,dir[i]->misc&DIR_ANON ? dir[i]->misc&DIR_AONLY
  909.                         ? "Only":"Yes":"No");
  910.                     sprintf(opt[n++],"%-27.27s%s","Purge by Last Download"
  911.                         ,dir[i]->misc&DIR_SINCEDL ? "Yes":"No");
  912.                     sprintf(opt[n++],"%-27.27s%s","Mark Moved Files as New"
  913.                         ,dir[i]->misc&DIR_MOVENEW ? "Yes":"No");
  914.                     opt[n][0]=0;
  915.                     savnum=2;
  916.                     SETHELP(WHERE);
  917. /*
  918. Directory Toggle Options:
  919.  
  920. This is the toggle options menu for the selected file directory.
  921.  
  922. The available options from this menu can all be toggled between two or
  923. more states, such as Yes and No.
  924. */
  925.                     n=ulist(WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT,3,2,36,&tog_dflt
  926.                         ,&tog_bar,"Toggle Options",opt);
  927.                     if(n==-1)
  928.                         break;
  929.                     savnum=3;
  930.                     switch(n) {
  931.                         case 0:
  932.                             n=0;
  933.                             strcpy(opt[0],"Yes");
  934.                             strcpy(opt[1],"No");
  935.                             opt[2][0]=0;
  936.                             SETHELP(WHERE);
  937. /*
  938. Check for File Existence When Listing:
  939.  
  940. If you want the actual existence of files to be verified while listing
  941. directories, set this value to Yes.
  942.  
  943. Directories with files located on CD-ROM or other slow media should have
  944. this option set to No.
  945. */
  946.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  947.                                 ,"Check for File Existence When Listing",opt);
  948.                             if(n==0 && !(dir[i]->misc&DIR_FCHK)) {
  949.                                 dir[i]->misc|=DIR_FCHK;
  950.                                 changes=1; }
  951.                             else if(n==1 && (dir[i]->misc&DIR_FCHK)) {
  952.                                 dir[i]->misc&=~DIR_FCHK;
  953.                                 changes=1; }
  954.                             break;
  955.                         case 1:
  956.                             n=0;
  957.                             strcpy(opt[0],"Yes");
  958.                             strcpy(opt[1],"No");
  959.                             opt[2][0]=0;
  960.                             SETHELP(WHERE);
  961. /*
  962. Slow Media Device:
  963.  
  964. If this directory contains files located on CD-ROM or other slow media
  965. device, you should set this option to Yes. Each slow media device on
  966. your system should have a unique Device Number. If you only have one
  967. slow media device, then this number should be set to 1.
  968.  
  969. CD-ROM multidisk changers are considered one device and all the
  970. directories on all the CD-ROMs in each changer should be set to the same
  971. device number.
  972. */
  973.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  974.                                 ,"Slow Media Device"
  975.                                 ,opt);
  976.                             if(n==0) {
  977.                                 if(!dir[i]->seqdev) {
  978.                                     changes=1;
  979.                                     strcpy(str,"1"); }
  980.                                 else
  981.                                     sprintf(str,"%u",dir[i]->seqdev);
  982.                                 uinput(WIN_MID|WIN_SAV,0,0
  983.                                     ,"Device Number"
  984.                                     ,str,2,K_EDIT|K_UPPER);
  985.                                 dir[i]->seqdev=atoi(str); }
  986.                             else if(n==1 && dir[i]->seqdev) {
  987.                                 dir[i]->seqdev=0;
  988.                                 changes=1; }
  989.                             break;
  990.                         case 2:
  991.                             n=1;
  992.                             strcpy(opt[0],"Yes");
  993.                             strcpy(opt[1],"No");
  994.                             opt[2][0]=0;
  995.                             SETHELP(WHERE);
  996. /*
  997. Force Content Ratings in Descriptions:
  998.  
  999. If you would like all uploads to this directory to be prompted for
  1000. content rating (G, R, or X), set this value to Yes.
  1001. */
  1002.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1003.                                 ,"Force Content Ratings in Descriptions",opt);
  1004.                             if(n==0 && !(dir[i]->misc&DIR_RATE)) {
  1005.                                 dir[i]->misc|=DIR_RATE;
  1006.                                 changes=1; }
  1007.                             else if(n==1 && (dir[i]->misc&DIR_RATE)) {
  1008.                                 dir[i]->misc&=~DIR_RATE;
  1009.                                 changes=1; }
  1010.                             break;
  1011.                         case 3:
  1012.                             n=1;
  1013.                             strcpy(opt[0],"Yes");
  1014.                             strcpy(opt[1],"No");
  1015.                             opt[2][0]=0;
  1016.                             SETHELP(WHERE);
  1017. /*
  1018. Include Upload Date in File Descriptions:
  1019.  
  1020. If you wish the upload date of each file in this directory to be
  1021. automatically included in the file description, set this option to
  1022. Yes.
  1023. */
  1024.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1025.                                 ,"Include Upload Date in Descriptions",opt);
  1026.                             if(n==0 && !(dir[i]->misc&DIR_ULDATE)) {
  1027.                                 dir[i]->misc|=DIR_ULDATE;
  1028.                                 changes=1; }
  1029.                             else if(n==1 && (dir[i]->misc&DIR_ULDATE)) {
  1030.                                 dir[i]->misc&=~DIR_ULDATE;
  1031.                                 changes=1; }
  1032.                             break;
  1033.                         case 4:
  1034.                             n=0;
  1035.                             strcpy(opt[0],"Yes");
  1036.                             strcpy(opt[1],"No");
  1037.                             opt[2][0]=0;
  1038.                             SETHELP(WHERE);
  1039. /*
  1040. Ask for Multiple File Numberings:
  1041.  
  1042. If you would like uploads to this directory to be prompted for multiple
  1043. file (disk) numbers, set this value to Yes.
  1044. */
  1045.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1046.                                 ,"Ask for Multiple File Numberings",opt);
  1047.                             if(n==0 && !(dir[i]->misc&DIR_MULT)) {
  1048.                                 dir[i]->misc|=DIR_MULT;
  1049.                                 changes=1; }
  1050.                             else if(n==1 && (dir[i]->misc&DIR_MULT)) {
  1051.                                 dir[i]->misc&=~DIR_MULT;
  1052.                                 changes=1; }
  1053.                             break;
  1054.                         case 5:
  1055.                             n=0;
  1056.                             strcpy(opt[0],"Yes");
  1057.                             strcpy(opt[1],"No");
  1058.                             opt[2][0]=0;
  1059.                             SETHELP(WHERE);
  1060. /*
  1061. Search Directory for Duplicate Filenames:
  1062.  
  1063. If you would like to have this directory searched for duplicate
  1064. filenames when a user attempts to upload a file, set this option to Yes.
  1065. */
  1066.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1067.                                 ,"Search for Duplicate Filenames",opt);
  1068.                             if(n==0 && !(dir[i]->misc&DIR_DUPES)) {
  1069.                                 dir[i]->misc|=DIR_DUPES;
  1070.                                 changes=1; }
  1071.                             else if(n==1 && (dir[i]->misc&DIR_DUPES)) {
  1072.                                 dir[i]->misc&=~DIR_DUPES;
  1073.                                 changes=1; }
  1074.                             break;
  1075.                         case 6:
  1076.                             n=0;
  1077.                             strcpy(opt[0],"Yes");
  1078.                             strcpy(opt[1],"No");
  1079.                             opt[2][0]=0;
  1080.                             SETHELP(WHERE);
  1081. /*
  1082. Search Directory for New Files:
  1083.  
  1084. If you would like to have this directory searched for newly uploaded
  1085. files when a user scans All libraries for new files, set this option to
  1086. Yes.
  1087.  
  1088. If this directory is located on CD-ROM or other read only media
  1089. (where uploads are unlikely to occur), it will improve new file scans
  1090. if this option is set to No.
  1091. */
  1092.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1093.                                 ,"Search for New files",opt);
  1094.                             if(n==0 && dir[i]->misc&DIR_NOSCAN) {
  1095.                                 dir[i]->misc&=~DIR_NOSCAN;
  1096.                                 changes=1; }
  1097.                             else if(n==1 && !(dir[i]->misc&DIR_NOSCAN)) {
  1098.                                 dir[i]->misc|=DIR_NOSCAN;
  1099.                                 changes=1; }
  1100.                             break;
  1101.                         case 7:
  1102.                             n=0;
  1103.                             strcpy(opt[0],"Yes");
  1104.                             strcpy(opt[1],"No");
  1105.                             opt[2][0]=0;
  1106.                             SETHELP(WHERE);
  1107. /*
  1108. Search Directory for Auto-ADDFILES:
  1109.  
  1110. If you would like to have this directory searched for a file list to
  1111. import automatically when using the ADDFILES * (Auto-ADD) feature,
  1112. set this option to Yes.
  1113. */
  1114.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1115.                                 ,"Search for Auto-ADDFILES",opt);
  1116.                             if(n==0 && dir[i]->misc&DIR_NOAUTO) {
  1117.                                 dir[i]->misc&=~DIR_NOAUTO;
  1118.                                 changes=1; }
  1119.                             else if(n==1 && !(dir[i]->misc&DIR_NOAUTO)) {
  1120.                                 dir[i]->misc|=DIR_NOAUTO;
  1121.                                 changes=1; }
  1122.                             break;
  1123.                         case 8:
  1124.                             n=0;
  1125.                             strcpy(opt[0],"Yes");
  1126.                             strcpy(opt[1],"No");
  1127.                             opt[2][0]=0;
  1128.                             SETHELP(WHERE);
  1129. /*
  1130. Import FILE_ID.DIZ and DESC.SDI Descriptions:
  1131.  
  1132. If you would like archived descriptions (FILE_ID.DIZ and DESC.SDI)
  1133. of uploaded files to be automatically imported as the extended
  1134. description, set this option to Yes.
  1135. */
  1136.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1137.                                 ,"Import FILE_ID.DIZ and DESC.SDI",opt);
  1138.                             if(n==0 && !(dir[i]->misc&DIR_DIZ)) {
  1139.                                 dir[i]->misc|=DIR_DIZ;
  1140.                                 changes=1; }
  1141.                             else if(n==1 && (dir[i]->misc&DIR_DIZ)) {
  1142.                                 dir[i]->misc&=~DIR_DIZ;
  1143.                                 changes=1; }
  1144.                             break;
  1145.                         case 9:
  1146.                             n=1;
  1147.                             strcpy(opt[0],"Yes");
  1148.                             strcpy(opt[1],"No");
  1149.                             opt[2][0]=0;
  1150.                             SETHELP(WHERE);
  1151. /*
  1152. Downloads are Free:
  1153.  
  1154. If you would like all downloads from this directory to be free (cost
  1155. no credits), set this option to Yes.
  1156. */
  1157.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1158.                                 ,"Downloads are Free",opt);
  1159.                             if(n==0 && !(dir[i]->misc&DIR_FREE)) {
  1160.                                 dir[i]->misc|=DIR_FREE;
  1161.                                 changes=1; }
  1162.                             else if(n==1 && (dir[i]->misc&DIR_FREE)) {
  1163.                                 dir[i]->misc&=~DIR_FREE;
  1164.                                 changes=1; }
  1165.                             break;
  1166.                         case 10:
  1167.                             n=1;
  1168.                             strcpy(opt[0],"Yes");
  1169.                             strcpy(opt[1],"No");
  1170.                             opt[2][0]=0;
  1171.                             SETHELP(WHERE);
  1172. /*
  1173. Free Download Time:
  1174.  
  1175. If you would like all downloads from this directory to not subtract
  1176. time from the user, set this option to Yes.
  1177. */
  1178.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1179.                                 ,"Free Download Time",opt);
  1180.                             if(n==0 && !(dir[i]->misc&DIR_TFREE)) {
  1181.                                 dir[i]->misc|=DIR_TFREE;
  1182.                                 changes=1; }
  1183.                             else if(n==1 && (dir[i]->misc&DIR_TFREE)) {
  1184.                                 dir[i]->misc&=~DIR_TFREE;
  1185.                                 changes=1; }
  1186.                             break;
  1187.                         case 11:
  1188.                             n=1;
  1189.                             strcpy(opt[0],"Yes");
  1190.                             strcpy(opt[1],"No");
  1191.                             opt[2][0]=0;
  1192.                             SETHELP(WHERE);
  1193. /*
  1194. Deduct Upload Time:
  1195.  
  1196. If you would like all uploads to this directory to have the time spent
  1197. uploading subtracted from their time online, set this option to Yes.
  1198. */
  1199.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1200.                                 ,"Deduct Upload Time",opt);
  1201.                             if(n==0 && !(dir[i]->misc&DIR_ULTIME)) {
  1202.                                 dir[i]->misc|=DIR_ULTIME;
  1203.                                 changes=1; }
  1204.                             else if(n==1 && (dir[i]->misc&DIR_ULTIME)) {
  1205.                                 dir[i]->misc&=~DIR_ULTIME;
  1206.                                 changes=1; }
  1207.                             break;
  1208.                         case 12:
  1209.                             n=0;
  1210.                             strcpy(opt[0],"Yes");
  1211.                             strcpy(opt[1],"No");
  1212.                             opt[2][0]=0;
  1213.                             SETHELP(WHERE);
  1214. /*
  1215. Give Credit for Uploads:
  1216.  
  1217. If you want users who upload to this directory to get credit for their
  1218. initial upload, set this option to Yes.
  1219. */
  1220.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1221.                                 ,"Give Credit for Uploads",opt);
  1222.                             if(n==0 && !(dir[i]->misc&DIR_CDTUL)) {
  1223.                                 dir[i]->misc|=DIR_CDTUL;
  1224.                                 changes=1; }
  1225.                             else if(n==1 && (dir[i]->misc&DIR_CDTUL)) {
  1226.                                 dir[i]->misc&=~DIR_CDTUL;
  1227.                                 changes=1; }
  1228.                             break;
  1229.                         case 13:
  1230.                             n=0;
  1231.                             strcpy(opt[0],"Yes");
  1232.                             strcpy(opt[1],"No");
  1233.                             opt[2][0]=0;
  1234.                             SETHELP(WHERE);
  1235. /*
  1236. Give Uploader Credit for Downloads:
  1237.  
  1238. If you want users who upload to this directory to get credit when their
  1239. files are downloaded, set this optin to Yes.
  1240. */
  1241.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1242.                                 ,"Give Uploader Credit for Downloads",opt);
  1243.                             if(n==0 && !(dir[i]->misc&DIR_CDTDL)) {
  1244.                                 dir[i]->misc|=DIR_CDTDL;
  1245.                                 changes=1; }
  1246.                             else if(n==1 && (dir[i]->misc&DIR_CDTDL)) {
  1247.                                 dir[i]->misc&=~DIR_CDTDL;
  1248.                                 changes=1; }
  1249.                             break;
  1250.                         case 14:
  1251.                             n=1;
  1252.                             strcpy(opt[0],"Yes");
  1253.                             strcpy(opt[1],"No");
  1254.                             opt[2][0]=0;
  1255.                             SETHELP(WHERE);
  1256. /*
  1257. Credit Uploader with Minutes instead of Credits:
  1258.  
  1259. If you wish to give the uploader of files to this directory minutes,
  1260. intead of credits, set this option to Yes.
  1261. */
  1262.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1263.                                 ,"Credit Uploader with Minutes",opt);
  1264.                             if(n==0 && !(dir[i]->misc&DIR_CDTMIN)) {
  1265.                                 dir[i]->misc|=DIR_CDTMIN;
  1266.                                 changes=1; }
  1267.                             else if(n==1 && dir[i]->misc&DIR_CDTMIN){
  1268.                                 dir[i]->misc&=~DIR_CDTMIN;
  1269.                                 changes=1; }
  1270.                             break;
  1271.  
  1272.                         case 15:
  1273.                             n=1;
  1274.                             strcpy(opt[0],"Yes");
  1275.                             strcpy(opt[1],"No");
  1276.                             strcpy(opt[2],"Only");
  1277.                             opt[3][0]=0;
  1278.                             SETHELP(WHERE);
  1279. /*
  1280. Allow Anonymous Uploads:
  1281.  
  1282. If you want users with the A exemption to be able to upload anonymously
  1283. to this directory, set this option to Yes. If you want all uploads to
  1284. this directory to be forced anonymous, set this option to Only.
  1285. */
  1286.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1287.                                 ,"Allow Anonymous Uploads",opt);
  1288.                             if(n==0 && (dir[i]->misc&(DIR_ANON|DIR_AONLY))
  1289.                                 !=DIR_ANON) {
  1290.                                 dir[i]->misc|=DIR_ANON;
  1291.                                 dir[i]->misc&=~DIR_AONLY;
  1292.                                 changes=1; }
  1293.                             else if(n==1 && dir[i]->misc&(DIR_ANON|DIR_AONLY)){
  1294.                                 dir[i]->misc&=~(DIR_ANON|DIR_AONLY);
  1295.                                 changes=1; }
  1296.                             else if(n==2 && (dir[i]->misc&(DIR_ANON|DIR_AONLY))
  1297.                                 !=(DIR_ANON|DIR_AONLY)) {
  1298.                                 dir[i]->misc|=(DIR_ANON|DIR_AONLY);
  1299.                                 changes=1; }
  1300.                             break;
  1301.                         case 16:
  1302.                             n=0;
  1303.                             strcpy(opt[0],"Yes");
  1304.                             strcpy(opt[1],"No");
  1305.                             opt[2][0]=0;
  1306.                             SETHELP(WHERE);
  1307. /*
  1308. Purge Files Based on Date of Last Download:
  1309.  
  1310. Using the Synchronet file base maintenance utility (DELFILES), you can
  1311. have files removed based on the number of days since last downloaded
  1312. rather than the number of days since the file was uploaded (default),
  1313. by setting this option to Yes.
  1314. */
  1315.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1316.                                 ,"Purge Files Based on Date of Last Download"
  1317.                                 ,opt);
  1318.                             if(n==0 && !(dir[i]->misc&DIR_SINCEDL)) {
  1319.                                 dir[i]->misc|=DIR_SINCEDL;
  1320.                                 changes=1; }
  1321.                             else if(n==1 && (dir[i]->misc&DIR_SINCEDL)) {
  1322.                                 dir[i]->misc&=~DIR_SINCEDL;
  1323.                                 changes=1; }
  1324.                             break;
  1325.                         case 17:
  1326.                             n=0;
  1327.                             strcpy(opt[0],"Yes");
  1328.                             strcpy(opt[1],"No");
  1329.                             opt[2][0]=0;
  1330.                             SETHELP(WHERE);
  1331. /*
  1332. Mark Moved Files as New:
  1333.  
  1334. If this option is set to Yes, then all files moved from this directory
  1335. will have their upload date changed to the current date so the file will
  1336. appear in users' new-file scans again.
  1337. */
  1338.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1339.                                 ,"Mark Moved Files as New"
  1340.                                 ,opt);
  1341.                             if(n==0 && !(dir[i]->misc&DIR_MOVENEW)) {
  1342.                                 dir[i]->misc|=DIR_MOVENEW;
  1343.                                 changes=1; }
  1344.                             else if(n==1 && (dir[i]->misc&DIR_MOVENEW)) {
  1345.                                 dir[i]->misc&=~DIR_MOVENEW;
  1346.                                 changes=1; }
  1347.                             break;
  1348.                             } }
  1349.                 break;
  1350.         case 14:
  1351.             while(1) {
  1352.                 n=0;
  1353.                 sprintf(opt[n++],"%-27.27s%s","Extensions Allowed"
  1354.                     ,dir[i]->exts);
  1355.                 if(!dir[i]->data_dir[0])
  1356.                     sprintf(str,"%sDIRS\\",data_dir);
  1357.                 else
  1358.                     strcpy(str,dir[i]->data_dir);
  1359.                 sprintf(opt[n++],"%-27.27s%.40s","Data Directory"
  1360.                     ,str);
  1361.                 sprintf(opt[n++],"%-27.27s%.40s","Upload Semaphore File"
  1362.                     ,dir[i]->upload_sem);
  1363.                 sprintf(opt[n++],"%-27.27s%s","Sort Value and Direction"
  1364.                     , dir[i]->sort==SORT_NAME_A ? "Name Ascending"
  1365.                     : dir[i]->sort==SORT_NAME_D ? "Name Descending"
  1366.                     : dir[i]->sort==SORT_DATE_A ? "Date Ascending"
  1367.                     : "Date Descending");
  1368.                 opt[n][0]=0;
  1369.                 savnum=2;
  1370.                 SETHELP(WHERE);
  1371. /*
  1372. Directory Advanced Options:
  1373.  
  1374. This is the advanced options menu for the selected file directory.
  1375. */
  1376.                     n=ulist(WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT,3,4,60,&adv_dflt,0
  1377.                         ,"Advanced Options",opt);
  1378.                     if(n==-1)
  1379.                         break;
  1380.                     savnum=3;
  1381.                     switch(n) {
  1382.                         case 0:
  1383.                             SETHELP(WHERE);
  1384. /*
  1385. File Extensions Allowed:
  1386.  
  1387. This option allows you to limit the types of files uploaded to this
  1388. directory. This is a list of file extensions that are allowed, each
  1389. separated by a comma (Example: ZIP,EXE). If this option is left
  1390. blank, all file extensions will be allowed to be uploaded.
  1391. */
  1392.                             uinput(WIN_L2R|WIN_SAV,0,17
  1393.                                 ,"File Extensions Allowed"
  1394.                                 ,dir[i]->exts,40,K_EDIT|K_UPPER);
  1395.                             break;
  1396.                         case 1:
  1397. SETHELP(WHERE);
  1398. /*
  1399. Data Directory:
  1400.  
  1401. Use this if you wish to place the data directory for this directory
  1402. on another drive or in another directory besides the default setting.
  1403. */
  1404.                             uinput(WIN_MID|WIN_SAV,0,17,"Data"
  1405.                                 ,dir[i]->data_dir,50,K_EDIT|K_UPPER);
  1406.                             break;
  1407.                         case 2:
  1408. SETHELP(WHERE);
  1409. /*
  1410. Upload Semaphore File:
  1411.  
  1412. This is a filename that will be used as a semaphore (signal) to your
  1413. FidoNet front-end that new files are ready to be hatched for export.
  1414. */
  1415.                             uinput(WIN_MID|WIN_SAV,0,17,"Upload Semaphore"
  1416.                                 ,dir[i]->upload_sem,50,K_EDIT|K_UPPER);
  1417.                             break;
  1418.                         case 3:
  1419.                             n=0;
  1420.                             strcpy(opt[0],"Name Ascending");
  1421.                             strcpy(opt[1],"Name Descending");
  1422.                             strcpy(opt[2],"Date Ascending");
  1423.                             strcpy(opt[3],"Date Descending");
  1424.                             opt[4][0]=0;
  1425.                             SETHELP(WHERE);
  1426. /*
  1427. Sort Value and Direction:
  1428.  
  1429. This option allows you to determine the sort value and direction. Files
  1430. that are uploaded are automatically sorted by filename or upload date,
  1431. ascending or descending. If you change the sort value or direction after
  1432. a directory already has files in it, use the sysop transfer menu ;RESORT
  1433. command to resort the directory with the new sort parameters.
  1434. */
  1435.                             n=ulist(WIN_MID|WIN_SAV,0,0,0,&n,0
  1436.                                 ,"Sort Value and Direction",opt);
  1437.                             if(n==0 && dir[i]->sort!=SORT_NAME_A) {
  1438.                                 dir[i]->sort=SORT_NAME_A;
  1439.                                 changes=1; }
  1440.                             else if(n==1 && dir[i]->sort!=SORT_NAME_D) {
  1441.                                 dir[i]->sort=SORT_NAME_D;
  1442.                                 changes=1; }
  1443.                             else if(n==2 && dir[i]->sort!=SORT_DATE_A) {
  1444.                                 dir[i]->sort=SORT_DATE_A;
  1445.                                 changes=1; }
  1446.                             else if(n==3 && dir[i]->sort!=SORT_DATE_D) {
  1447.                                 dir[i]->sort=SORT_DATE_D;
  1448.                                 changes=1; }
  1449.                             break; } }
  1450.             break;
  1451.             } } }
  1452.  
  1453. }
  1454.