home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
progc
/
xdev_118.arj
/
XEDIT.LZH
/
XEDIT6.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-01
|
10KB
|
329 lines
#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 WINDOW *wnd4;
struct _mmboard {
char name[48];
char forceto[36];
long 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 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];
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);
word pascal edit_archiver (word areano) {
WINDOW *wnd6;
FIELD *fld3;
char s[133];
char redid=0;
char skip[6];
char errline[6];
register word x;
int returncode;
wnd6=establish_window(15,9,16,64);
set_border(wnd6,3);
set_title(wnd6," Edit Archiver 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 PGUP PGDN ESC=exit\n");
Again:
wprompt(wnd6,2,2,"Archive Name:");
wprompt(wnd6,2,3,"Extract Name:");
wprompt(wnd6,2,4,"Extension:");
wprompt(wnd6,2,5,"List command:");
wprompt(wnd6,2,6,"Move command:");
wprompt(wnd6,2,7,"Extract command:");
wprompt(wnd6,2,8,"Error string:");
wprompt(wnd6,2,9,"ID string:");
wprompt(wnd6,2,10,"Pick key:");
wprompt(wnd6,2,11,"Initial skip:");
wprompt(wnd6,2,12,"Error line #:");
ReDo:
if(!numarchivers) goto StartingOut;
init_template(wnd6);
sprintf(skip,"%d",archiver[areano].skip);
sprintf(errline,"%d",archiver[areano].errline);
/* 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; */
fld3=establish_field(wnd6,20,2,msk12,archiver[areano].aname,'A');
field_window(fld3,"arcaname ",40,6);
fld3=establish_field(wnd6,20,3,msk12,archiver[areano].ename,'A');
field_window(fld3,"arcename ",40,6);
fld3=establish_field(wnd6,20,4,msk3,archiver[areano].ext,'A');
field_window(fld3,"arcext ",40,6);
fld3=establish_field(wnd6,20,5,msk40,archiver[areano].list,'a');
field_window(fld3,"arclist ",40,6);
fld3=establish_field(wnd6,20,6,msk40,archiver[areano].move,'a');
field_window(fld3,"arcmove ",40,6);
fld3=establish_field(wnd6,20,7,msk40,archiver[areano].extract,'a');
field_window(fld3,"arcextract",40,6);
fld3=establish_field(wnd6,20,8,msk40,archiver[areano].error,'a');
field_window(fld3,"arcerror ",40,6);
fld3=establish_field(wnd6,20,9,msk24,archiver[areano].id,'a');
field_window(fld3,"arcid ",40,6);
fld3=establish_field(wnd6,20,10,msk1,archiver[areano].pick,'a');
field_window(fld3,"arcpick ",40,6);
fld3=establish_field(wnd6,20,11,msk5,skip,'N');
field_window(fld3,"arcskip ",40,6);
fld3=establish_field(wnd6,20,12,msk5,errline,'N');
field_window(fld3,"arcerrline",40,6);
prep_template(wnd6);
AskOver:
returncode=data_entry(wnd6);
if (returncode==PGUP) {
if(!areano) areano=numarchivers-1;
else areano--;
goto ReDo;
}
if (returncode==PGDN) {
if(areano>=(numarchivers-1)) areano=0;
else areano++;
goto ReDo;
}
if (returncode==F8) {
if (areano<numarchivers) {
for(x=areano+1;x<numarchivers;x++) {
memcpy((void *)&archiver[x-1],(void *)&archiver[x],(word)sizeof(struct _archiver));
}
}
redid=1;
numarchivers--;
if(!numarchivers) {
delete_window(wnd6);
return (word)redid;
}
if(areano>(numarchivers-1)) areano=numarchivers-1;
goto ReDo;
}
if (returncode==F7) {
if(numarchivers==MAXARCHIVERS) {
error_message(" Sorry, I'm already maxed out... ");
pause_msg();
goto ReDo;
}
StartingOut:
redid=1;
numarchivers++;
memset((void *)&archiver[0],0,(unsigned)sizeof(struct _archiver));
areano=numarchivers-1;
goto ReDo;
}
if (returncode==ESC) goto Quit;
if (returncode!=F10 && returncode!=F9) goto AskOver;
rstrip(archiver[areano].aname);
lstrip(archiver[areano].aname);
rstrip(archiver[areano].ename);
lstrip(archiver[areano].ename);
rstrip(archiver[areano].ext);
lstrip(archiver[areano].ext);
rstrip(archiver[areano].list);
lstrip(archiver[areano].list);
rstrip(archiver[areano].move);
lstrip(archiver[areano].move);
rstrip(archiver[areano].extract);
lstrip(archiver[areano].extract);
rstrip(archiver[areano].error);
rstrip(archiver[areano].id);
lstrip(archiver[areano].pick);
rstrip(archiver[areano].pick);
if(*archiver[areano].pick==' ') *archiver[areano].pick=0;
archiver[areano].pick[1]=0;
archiver[areano].skip=atoi(skip);
archiver[areano].errline=atoi(errline);
if (!*archiver[areano].aname || !*archiver[areano].ename || !*archiver[areano].list || !*archiver[areano].move || !*archiver[areano].extract || !*archiver[areano].error /* || !strchr(archiver[areano].ext,'.')*/ ) {
any_message(" WARNING: Blank field ");
pause_msg();
if(returncode==F9) goto ReDo;
delete_window(wnd6);
if(redid) {
return 1;
}
return 0;
}
redid=1;
if(returncode==F9) goto ReDo;
delete_window(wnd6);
return 1;
Quit:
delete_window(wnd6);
if (redid) {
return 1;
}
return 0;
}
void pascal load_archivers (char *file) {
FILE *fp;
struct ffblk f;
char string[80];
register word x;
if(findfirst(file,&f,0)) {
numarchivers=0;
return;
}
numarchivers=(word)(f.ff_fsize/(long)sizeof(struct _archiver));
if(!(fp=fopen(file,"rb"))) {
sprintf(string," Can't open %s ",file);
error_message(string);
pause_msg();
return;
}
fread((void *)archiver,sizeof(struct _archiver),numarchivers,fp);
fclose(fp);
for(x=0;x<numarchivers;x++) {
archiver[x].ext[4]=0;
archiver[x].move[40]=0;
archiver[x].extract[40]=0;
archiver[x].list[40]=0;
archiver[x].error[40]=0;
archiver[x].aname[12]=0;
archiver[x].ename[12]=0;
archiver[x].id[24]=0;
archiver[x].pick[1]=0;
}
}