Annotation of sbbs/src/sbbs3/scfg/scfgxfr2.c, revision 1.1.1.2

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.