home *** CD-ROM | disk | FTP | other *** search
- /* Module 2 of MSETUP.C */
-
-
- #include "msgg.h"
-
- #define XBBS
-
- #ifdef XBBS
- extern struct _config conf;
- extern struct _user user;
- extern word userno;
- extern struct time timeon;
- extern char timer_off;
- extern word hold_time;
- extern char age;
- extern char pages;
- extern struct _mboard mboard;
- extern struct _fboard fboard;
- extern struct _events event[10];
- extern char variable[10][82];
- #endif
-
- extern char debug_mode;
- extern char graphics;
- extern word timelimit;
- extern word baud;
- extern char numlines;
- extern word seclvl;
- extern ulong startt;
- extern char sysopin;
- extern char fastANSI;
- extern char commport;
- extern struct time starter;
- extern union REGS rg;
- extern char logfile[133];
- extern char username[36];
- extern char width;
- extern char fast;
- extern char chatting;
- extern char chatted;
- extern char nodenumber;
- extern char system_name[64];
- extern char sysop[36];
-
- struct _msetup {
- unsigned long userid;
- char node;
- unsigned char areas[512];
- };
- extern struct _msetup mset;
-
- #define MAXNUMAREA 1024
-
- struct _ffboard {
- char name[47];
- char flags;
- word security;
- char dpath[79];
- char upath[79];
- char descr[79];
- signed char age;
- word userflags;
- char leechpercent;
- };
-
- struct _mmboard {
- char name[48];
- char forceto[36];
- word attr;
- word max;
- word number;
- word substat1;
- word substat2;
- char descr[79];
- signed char age;
- word flags;
- word zone;
- word net;
- word node;
- word point;
- char yourname[36];
- word minwrite;
- };
-
- extern char pathfile[133];
- extern char msgareasfile[133];
- extern char filetocreate[133];
- extern char fileareasfile[133];
- extern char filefiletocreate[133];
- extern struct _mmboard huge *marea;
- extern struct _mmboard huge *currarea;
- extern word higharea;
- extern word maxareas;
- extern char create;
- extern char fseclvl;
- extern char dofiles;
-
-
- extern char * pascal stripcr(char *);
-
-
-
- void pascal do_fboard (void) {
-
- FILE *fp;
- char *p;
- register word y;
- struct ffblk f;
- static char string[256];
- word tempareas=0;
- struct _ffboard huge * dir=NULL;
-
- baud=0;
- dir=(struct _ffboard huge*)farmalloc((MAXNUMAREA * sizeof(struct _ffboard))+sizeof(struct _ffboard));
- if (dir==NULL) {
- return;
- }
-
- if(!*fileareasfile) sprintf(fileareasfile,"FLSEARCH.CTL");
- if(findfirst(fileareasfile,&f,0)) {
- if(dir)farfree((struct _ffboard far *)dir);
- return;
- }
- if(!(fp=fopen(fileareasfile,"rt"))) {
- if(dir)farfree((struct _ffboard far *)dir);
- return;
- }
- while (!feof(fp)) {
- if (!fgets(string,255,fp)) break;
- if (*string=='\n' || *string==';') continue;
- stripcr(string);
- strncpy(dir[tempareas].dpath,strtok(string," "),78);
- dir[tempareas].dpath[78]=0;
- if (dir[tempareas].dpath[strlen(dir[tempareas].dpath)-1]!='\\') strcat(dir[tempareas].dpath,"\\");
- dir[tempareas].security=(word)atol(strtok(0," "));
- if(dir[tempareas].security > user.stat[fseclvl]) continue;
- strncpy(dir[tempareas].name,strtok(0," "),46);
- dir[tempareas].name[46]=0;
- strupr(dir[tempareas].name);
- /* while((p=strchr(dir[tempareas].name,'_'))!=NULL) *p=' '; */
- dir[tempareas].flags=(char)atoi(strtok(0," "));
- p=strtok(0," ");
- if (p) {
- strncpy(dir[tempareas].upath,p,79);
- dir[tempareas].upath[78]=0;
- if (dir[tempareas].upath[strlen(dir[tempareas].upath)-1]!='\\') strcat(dir[tempareas].upath,"\\");
- }
- else strcpy(dir[tempareas].upath,"NUL");
- p=strtok(0,",");
- if(p) {
- if(*p==',') strcpy(dir[tempareas].descr,"No Description");
- else strncpy(dir[tempareas].descr,p,79);
- dir[tempareas].descr[78]=0;
- }
- else {
- strcpy(dir[tempareas].descr,"No Description");
- }
- p=strtok(0,",");
- if(p) {
- dir[tempareas].age=(signed char)atoi(p);
- }
- else dir[tempareas].age=0;
- p=strtok(0,",");
- if(p) {
- dir[tempareas].userflags=(word)atol(p);
- }
- else dir[tempareas].userflags=0;
- p=strtok(0,",");
- if(p)dir[tempareas].leechpercent=(char)atoi(p);
- else dir[tempareas].leechpercent=0;
-
- if(dir[tempareas].age) {
- if(dir[tempareas].age>0) {
- if(age<(char)dir[tempareas].age) {
- continue;
- }
- }
- else {
- if(age>(char)abs(dir[tempareas].age)) {
- continue;
- }
- }
- }
- if(dir[tempareas].userflags) {
- for(y=0;y<16;y++) {
- if(dir[tempareas].userflags & (1<<y)) {
- if(!(user.attr2 & (1<<y))) {
- continue;
- }
- }
- }
- }
- tempareas++;
- }
- fclose(fp);
-
- if(!*filefiletocreate) sprintf(filefiletocreate,"FLSEARCH.%03hu",nodenumber);
- if(!*pathfile) sprintf(pathfile,"DLPATHS.%03hu",nodenumber);
-
- if(tempareas) {
- fp=fopen(filefiletocreate,"wt");
- for(y=0;y<tempareas;y++) {
- /* while((p=strchr(dir[y].name,' '))!=NULL) *p='_'; */
- fprintf(fp,"%s %u %s %u %s %s,%hd,%u,%hu\n",dir[y].dpath,dir[y].security,dir[y].name,dir[y].flags,dir[y].upath,dir[y].descr,dir[y].age,dir[y].userflags,dir[y].leechpercent);
- }
- fprintf(fp,"\n");
- fclose(fp);
- printfm("\n\04Created %s\n",filefiletocreate);
- sprintf(string,"PLSEARCH.%03hu",nodenumber);
- fp=fopen(string,"wt");
- for(y=0;y<tempareas;y++) {
- /* while((p=strchr(dir[y].name,' '))!=NULL) *p='_'; */
- if(stricmp(dir[y].dpath,"NUL") && stricmp(dir[y].dpath,"NUL\\")) fprintf(fp,"%s %u %s\n",dir[y].dpath,dir[y].security,dir[y].name);
- }
- fprintf(fp,"\n");
- fclose(fp);
- printfm("\04Created %s\n",string);
- fp=fopen(pathfile,"wt");
- for(y=0;y<tempareas;y++) {
- if(stricmp(dir[y].dpath,"NUL") && stricmp(dir[y].dpath,"NUL\\")) fprintf(fp,"%s\n",dir[y].dpath);
- }
- fprintf(fp,"\n");
- fclose(fp);
- printfm("\04Created %s\n",pathfile);
- }
-
- if(dir)farfree((struct _ffboard far *)dir);
- }