home *** CD-ROM | disk | FTP | other *** search
-
- #include "msgg.h"
- #include "twindow.h"
- #include "keys.h"
-
- extern char msk78[];
- #define msk35 msk78+43
- #define mskst msk35+33
- #define mskzip msk35+30
- #define mskcit msk35+11
- #define msk1 msk78+77
- #define msk3 msk35+32
- #define msk4 msk35+31
- #define msk5 msk35+30
- #define msk6 msk35+29
- #define msk47 msk78+31
- #define msk46 msk78+32
- #define msk51 msk78+28
- #define msk40 msk46+6
- #define msk39 msk46+7
- #define msk12 msk78+66
- #define msk65 msk78+13
- #define msk19 msk78+59
- #define msk26 msk78+52
- #define msk24 msk78+54
- #define msk58 msk78+20
- #define msk10 msk78+68
-
- #define MAXNUMDIRS 1024
- #define MAXNUMAREA 1024
- #define MAXPROTOCOLS 130
- #define MAXARCHIVERS 256
- #define MAXDOORS 4096
-
- extern char fileattrprompts[8][13];
- extern char attrprompts[16][13];
-
- extern WINDOW *wnd4;
-
- 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;
- };
-
- 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;
- };
-
- extern word numprotos;
- extern char path[99];
- extern char msgareasfile[133];
- extern char fileareasfile[133];
- extern char msgareasfilebackup[133];
- extern char fileareasfilebackup[133];
-
- extern struct _mmboard huge *marea;
- extern struct _mmboard huge *currarea;
- extern word higharea;
- extern word maxareas;
- extern char msgareasfile[133];
- extern struct _ffboard huge *curdir;
- extern struct _ffboard huge *dir;
- extern word numdirs;
- extern char fileareasfile[133];
-
- extern word numdoors;
-
- struct _protocol {
- char name[25];
- char key;
- int adj;
- char spawndn[119];
- char spawnup[119];
- char abort[48];
- unsigned wild: 1;
- unsigned multi: 1;
- unsigned simul: 1;
- unsigned list: 1;
- unsigned opus: 1;
- unsigned noname: 1;
- unsigned dszlog: 1;
- unsigned reserved: 1;
- char pad1;
- char pad2;
- };
-
- extern struct _protocol huge *proto;
-
- struct _door {
- char name[25];
- char type[4];
- char spawn[79];
- char descr[79];
- };
- extern struct _door huge *door;
-
- extern word numdoors;
-
- struct _archiver {
- char ext[5];
- char move[41];
- char extract[41];
- char list[41];
- char error[41];
- char aname[13];
- char ename[13];
- char id[25];
- char pick[2];
- int skip;
- int errline;
- };
- extern struct _archiver huge *archiver;
- extern word numarchivers;
-
- extern char filename[133];
- extern char textname[133];
-
- extern void pascal swap_msgareas(word,word);
- extern int pascal sort_msgareas(void);
- extern void pascal swap_fileareas(word,word);
- extern int pascal sort_fileareas(void);
- extern word pascal select_area(word);
- extern char * pascal msgarea_attr(void);
- extern char * pascal filearea_attr (char flags);
- extern char * pascal rstrip(char *);
- extern char * pascal lstrip(char *);
- extern char * pascal stripcr(char *);
- extern void pascal load_fileareas(char *);
- extern void pascal load_msgareas(char *);
- extern word pascal find_msgarea(word);
- extern word pascal find_filearea(char *);
- extern word pascal list_msgareas(char *);
- extern word pascal list_fileareas(char *);
- extern word pascal check_area(word);
- extern word pascal edit_msgarea(word);
- extern word pascal edit_filearea(word);
- extern int pascal setup_msg(void);
- extern int pascal setup_file(void);
- extern int addbackslash (char *,int);
- extern int nomorethan4095 (char *,int);
-
- void pascal make_msgmenu(void);
- void pascal make_filemenu(void);
- void pascal load_archivers(char *);
- word pascal list_archivers(char *);
- word pascal edit_archiver(word);
-
- void pascal swap_protocols(word,word);
- int pascal sort_protocols(void);
-
-
-
-
- word pascal edit_protocol (word areano) {
-
- WINDOW *wnd6;
- FIELD *fld3;
- char s[133];
- char redid=0;
- char name[27];
- char key[3];
- char adj[7];
- char spawndn[80];
- char spawnup[80];
- char sd1[80];
- char su1[80];
- char abort[50];
- char wild[3];
- char multi[3];
- char simul[3];
- char list[3];
- char opus[3];
- char noname[3];
- char dszlog[3];
- char reserved[3];
- register word x;
- int returncode;
-
- wnd6=establish_window(1,7,20,80);
- set_border(wnd6,3);
- set_title(wnd6," Edit Protocol Entry ");
- set_colors(wnd6,BORDER,7,0,0);
- display_window(wnd6);
- wcursor(wnd6,0,0);
- wprintf(wnd6," F10=chng/exit F9=chng F8=Del F7=Add F6=Sort PGUP PGDN ESC=exit\n");
- Again:
- wprompt(wnd6,2,2,"Name:");
- wprompt(wnd6,2,3,"Key:");
- wprompt(wnd6,2,4,"Adjustment:");
- wprompt(wnd6,2,5,"Download spawn string:");
- wprompt(wnd6,2,8,"Upload spawn string:");
- wprompt(wnd6,2,11,"Abort string:");
- wprompt(wnd6,2,13,"Wildcards:");
- wprompt(wnd6,40,13,"Multiple filenames:");
- wprompt(wnd6,2,14,"Simultaneous U/D:");
- wprompt(wnd6,40,14,"Uses @List file:");
- wprompt(wnd6,2,15,"Opus-style:");
- wprompt(wnd6,40,15,"Names sent by remote:");
- wprompt(wnd6,2,16,"Uses DSZLOG:");
- wprompt(wnd6,40,16,"Reserved:");
- ReDo:
- if(!numprotos) goto StartingOut;
- init_template(wnd6);
- proto[areano].pad1=0;
- proto[areano].pad2=0;
- strcpy(name,proto[areano].name);
- sprintf(key,"%c",proto[areano].key);
- sprintf(adj,"%01d",proto[areano].adj);
- strncpy(spawndn,proto[areano].spawndn,79);
- spawndn[78]=0;
- strncpy(spawnup,proto[areano].spawnup,79);
- spawnup[78]=0;
- if(strlen(proto[areano].spawndn)>78) {
- strcpy(sd1,&proto[areano].spawndn[78]);
- }
- else *sd1=0;
- if(strlen(proto[areano].spawnup)>78) {
- strcpy(su1,&proto[areano].spawnup[78]);
- }
- else *su1=0;
- strcpy(abort,proto[areano].abort);
- if(proto[areano].wild) strcpy(wild,"X");
- else strcpy(wild,"-");
- if(proto[areano].multi) strcpy(multi,"X");
- else strcpy(multi,"-");
- if(proto[areano].simul) strcpy(simul,"X");
- else strcpy(simul,"-");
- if(proto[areano].list) strcpy(list,"X");
- else strcpy(list,"-");
- if(proto[areano].opus) strcpy(opus,"X");
- else strcpy(opus,"-");
- if(proto[areano].noname) strcpy(noname,"X");
- else strcpy(noname,"-");
- if(proto[areano].dszlog) strcpy(dszlog,"X");
- else strcpy(dszlog,"-");
- if(proto[areano].reserved) strcpy(reserved,"X");
- else strcpy(reserved,"-");
-
- fld3=establish_field(wnd6,15,2,msk24,name,'a');
- field_window(fld3,"protoname ",40,2);
- fld3=establish_field(wnd6,15,3,msk1,key,'A');
- field_window(fld3,"protokey ",40,2);
- fld3=establish_field(wnd6,15,4,msk5,adj,'N');
- field_window(fld3,"protoadj ",40,2);
- fld3=establish_field(wnd6,0,6,msk78,spawndn,'a');
- field_window(fld3,"protodn ",40,2);
- fld3=establish_field(wnd6,0,7,msk39,sd1,'a');
- field_window(fld3,"protodn2 ",40,2);
- fld3=establish_field(wnd6,0,9,msk78,spawnup,'a');
- field_window(fld3,"protoup ",40,3);
- fld3=establish_field(wnd6,0,10,msk39,su1,'a');
- field_window(fld3,"protoup2 ",40,4);
- fld3=establish_field(wnd6,0,12,msk47,abort,'a');
- field_window(fld3,"protoabort",40,5);
- fld3=establish_field(wnd6,24,13,msk1,wild,'O');
- field_window(fld3,"protowild ",40,6);
- fld3=establish_field(wnd6,64,13,msk1,multi,'O');
- field_window(fld3,"protomulti",40,6);
- fld3=establish_field(wnd6,24,14,msk1,simul,'O');
- field_window(fld3,"protosimul",40,6);
- fld3=establish_field(wnd6,64,14,msk1,list,'O');
- field_window(fld3,"protolist ",40,6);
- fld3=establish_field(wnd6,24,15,msk1,opus,'O');
- field_window(fld3,"protoopus ",40,6);
- fld3=establish_field(wnd6,64,15,msk1,noname,'O');
- field_window(fld3,"protononam",40,6);
- fld3=establish_field(wnd6,24,16,msk1,dszlog,'O');
- field_window(fld3,"protodsz ",40,6);
- fld3=establish_field(wnd6,64,16,msk1,reserved,'O');
- field_window(fld3,"protoreser",40,6);
- prep_template(wnd6);
- AskOver:
- returncode=data_entry(wnd6);
- if (returncode==PGUP) {
- if(!areano) areano=numprotos-1;
- else areano--;
- goto ReDo;
- }
- if (returncode==PGDN) {
- if(areano>=(numprotos-1)) areano=0;
- else areano++;
- goto ReDo;
- }
- if (returncode==F6) {
- sort_protocols();
- goto ReDo;
- }
- if (returncode==F8) {
- if (areano<numprotos) {
- for(x=areano+1;x<numprotos;x++) {
- memcpy((void *)&proto[x-1],(void *)&proto[x],(word)sizeof(struct _protocol));
- }
- }
- redid=1;
- numprotos--;
- if(!numprotos) {
- delete_window(wnd6);
- return (word)redid;
- }
- if(areano>(numprotos-1)) areano=numprotos-1;
- goto ReDo;
- }
- if (returncode==F7) {
- if(numprotos==MAXPROTOCOLS) {
- error_message(" Sorry, I'm already maxed out... ");
- pause_msg();
- goto ReDo;
- }
- StartingOut:
- redid=1;
- numprotos++;
- memset((void *)&proto[numprotos-1],0,(unsigned)sizeof(struct _protocol));
- strcpy(proto[numprotos-1].name,"New Protocol");
- areano=numprotos-1;
- goto ReDo;
- }
- if (returncode==ESC) goto Quit;
- if (returncode!=F10 && returncode!=F9) goto AskOver;
- rstrip(name);
- lstrip(name);
- lstrip(spawndn);
- lstrip(spawnup);
- rstrip(abort);
- rstrip(sd1);
- if(!*sd1)rstrip(spawndn);
- rstrip(su1);
- if(!*su1)rstrip(spawnup);
- if (!*name || (!*spawndn && !*spawnup)) {
- error_message(" Blank name and/or spawn field(s) ");
- pause_msg();
- if(returncode==F9) goto ReDo;
- }
- strcpy(proto[areano].name,name);
- strcpy(proto[areano].spawndn,spawndn);
- if(*sd1) strcat(proto[areano].spawndn,sd1);
- strcpy(proto[areano].spawnup,spawnup);
- if(*su1)strcat(proto[areano].spawnup,su1);
- strcpy(proto[areano].abort,abort);
- proto[areano].adj=atoi(adj);
- proto[areano].key=*key;
- if(*wild=='X') proto[areano].wild=1;
- else proto[areano].wild=0;
- if(*multi=='X') proto[areano].multi=1;
- else proto[areano].multi=0;
- if(*simul=='X') proto[areano].simul=1;
- else proto[areano].simul=0;
- if(*list=='X') proto[areano].list=1;
- else proto[areano].list=0;
- if(*opus=='X') proto[areano].opus=1;
- else proto[areano].opus=0;
- if(*dszlog=='X') proto[areano].dszlog=1;
- else proto[areano].dszlog=0;
- if(*noname=='X') proto[areano].noname=1;
- else proto[areano].noname=0;
- if(*reserved=='X') proto[areano].reserved=1;
- else proto[areano].reserved=0;
- redid=1;
- if(returncode==F9) goto ReDo;
- delete_window(wnd6);
- return 1;
- Quit:
- delete_window(wnd6);
- if (redid) {
- return 1;
- }
- return 0;
- }
-
-
-
- int pascal sort_protocols (void) { /* Simple bubble-sort */
-
- register word x;
- char swapped=1;
-
- if(numprotos==1) return 0;
- any_message(" Sorting ");
- while(swapped) {
- swapped=0;
- for(x=1;x<numprotos;x++) {
- if(strcmp(proto[x].name,proto[x-1].name)<0) {
- swap_protocols(x-1,x);
- swapped=1;
- }
- }
- }
- clear_message();
- return 0;
- }
-
-
-
- void pascal swap_protocols (word x, word y) {
-
- static struct _protocol temp;
-
- memcpy((void *)&temp,(void *)&proto[x],(word)sizeof(struct _protocol));
- memcpy((void *)&proto[x],(void *)&proto[y],(word)sizeof(struct _protocol));
- memcpy((void *)&proto[y],(void *)&temp,(word)sizeof(struct _protocol));
- }
-
-
-
- void pascal load_protocols (char *file) {
-
- FILE *fp;
- struct ffblk f;
- char string[80];
- word register x;
-
- if(findfirst(file,&f,0)) {
- numprotos=0;
- return;
- }
- numprotos=(word)(f.ff_fsize/(long)sizeof(struct _protocol));
- if(!(fp=fopen(file,"rb"))) {
- sprintf(string," Can't open %s ",file);
- error_message(string);
- pause_msg();
- return;
- }
- fread((void *)proto,sizeof(struct _protocol),numprotos,fp);
- fclose(fp);
- for(x=0;x<numprotos;x++) {
- proto[x].name[24]=0;
- proto[x].spawndn[118]=0;
- proto[x].spawnup[118]=0;
- proto[x].abort[47]=0;
- }
- }