home *** CD-ROM | disk | FTP | other *** search
- #include "msgg.h"
- #include "twindow.h"
- #include "keys.h"
- #include "scrntitl.h"
-
- /* You can #define FASTWINDOWS to speed up the window library, but you'll
- have to ensure that you write *only* to the top window */
-
- /* Function prototypes */
-
- char * pascal saytime (struct time *a);
- char * lstrip (char *a);
- void readconfig (void);
- void configure(void);
- void saveconfig(void);
- void newuserr(void);
- void bbs(void);
- void matrix(void);
- void setdefaults(void);
- void prompts(void);
- void miscel(void);
- void paths(void);
- void prepare_config(void);
- int prompt1(void);
- int prompt2(void);
- int prompt3(void);
- int addbackslash(char *,int);
- char * rstrip(char *);
- void quit(void);
- void quitnosave(void);
- void quitsave(void);
- int elevell(char *,int);
- int shltype(char *,int);
- int yesorno(char *,int);
- void fboardd(void);
- void mboardd(void);
- void params(void);
- void printscreen(void);
- void jumptodos(void);
- int window1(void);
- int window2(void);
- int window3(void);
- int window4(void);
-
- extern char msk78[];
- extern char mskdate[];
- extern char mskphone[];
- #define msk35 msk78+43
- #define mskcit "_______________________"
- #define mskzip "_____"
- #define mskst "__"
- #define msk1 msk78+77
- #define msk3 msk35+32
- #define msk6 msk35+29
- #define msk47 msk78+31
- #define msk63 msk78+15
- #define msk15 msk78+63
- #define msk58 msk78+20
- #define msk46 msk78+32
-
- /* Global variables */
-
- extern struct _config conf; /* System configuration read from CONFIG.BBS */
- extern struct _user newuser;
- extern struct _logconfig logconf;
- extern char nonstop;
-
-
-
- int window1 (void)
-
-
- {
-
- WINDOW *wnd;
- FIELD *fld;
- char length[4];
- char width[4];
- char credit[7];
- int exitcode;
-
- sprintf(length,"%-hu",newuser.length);
- sprintf(width,"%-hu",newuser.width);
- sprintf(credit,"%-u",newuser.credit);
-
- wnd=establish_window(2,4,10,52);
- set_border(wnd,2);
- set_title(wnd," NewUser Defaults--Window #1 ");
- set_colors(wnd,ALL,BLUE,WHITE,BRIGHT);
- set_colors(wnd,ACCENT,WHITE,BLACK,DIM);
- display_window(wnd);
- wprompt(wnd,2,1,"Name:");
- wprompt(wnd,2,2,"Handle:");
- wprompt(wnd,2,3,"City:");
- wprompt(wnd,37,3,"State:");
- wprompt(wnd,2,4,"Zip:");
- wprompt(wnd,21,4,"Phone1:");
- wprompt(wnd,21,5,"Phone2:");
- wprompt(wnd,2,6,"Length:");
- wprompt(wnd,15,6,"Width:");
- wprompt(wnd,27,6,"Credit:");
- init_template(wnd);
- fld=establish_field(wnd,11,1,msk35,newuser.name,'a');
- field_window(fld,"name ",40,1);
- fld=establish_field(wnd,11,2,msk35,newuser.handle,'a');
- field_window(fld,"handle ",40,2);
- fld=establish_field(wnd,11,3,mskcit,newuser.city,'a');
- field_window(fld,"city ",40,3);
- fld=establish_field(wnd,44,3,mskst,newuser.state,'A');
- field_window(fld,"state ",40,3);
- fld=establish_field(wnd,11,4,mskzip,newuser.zip,'Z');
- field_window(fld,"zip ",40,4);
- fld=establish_field(wnd,31,4,mskphone,newuser.phone1,'N');
- field_window(fld,"phone1 ",44,4);
- fld=establish_field(wnd,31,5,mskphone,newuser.phone2,'N');
- field_window(fld,"phone2 ",44,5);
- fld=establish_field(wnd,10,6,mskst,length,'N');
- field_window(fld,"length ",40,5);
- fld=establish_field(wnd,22,6,mskst,width,'N');
- field_window(fld,"width ",42,5);
- fld=establish_field(wnd,35,6,mskzip,credit,'N');
- field_window(fld,"credit ",44,6);
- prep_template(wnd);
- exitcode=data_entry(wnd);
- delete_window(wnd);
-
- newuser.length=(char)atoi(length);
- newuser.width=(char)atoi(width);
- newuser.credit=atoi(credit);
- return (exitcode);
-
- }
-
-
- int window2 (void)
-
-
- {
-
- WINDOW *wnd;
- FIELD *fld;
- char stats[10][7];
- int register x;
- char temp[32];
- int exitcode;
-
- for (x=0;x<10;x++) {
- sprintf(stats[x],"%-u",newuser.stat[x]);
- stats[x][6]=0;
- }
- wnd=establish_window(4,5,14,33);
- set_border(wnd,1);
- set_title(wnd," NewUser Defaults--Window #2 ");
- set_colors(wnd,ALL,BLUE,WHITE,BRIGHT);
- set_colors(wnd,ACCENT,WHITE,BLACK,DIM);
- display_window(wnd);
- for (x=0;x<10;x++) {
- sprintf(temp,"Security Level #%d:",x);
- wprompt(wnd,2,x+1,temp);
- }
- init_template(wnd);
- for (x=0;x<10;x++) {
- fld=establish_field(wnd,22,x+1,mskzip,stats[x],'N');
- switch (x) {
- case 0: field_window(fld,"stat0 ",34,x+2);
- break;
- case 1: field_window(fld,"stat1 ",34,x+1);
- break;
- default: field_window(fld,"stat ",34,x+3);
- }
- }
- prep_template(wnd);
- exitcode=data_entry(wnd);
- delete_window(wnd);
- for (x=0;x<10;x++) {
- newuser.stat[x]=(word)atoi(stats[x]);
- }
- return (exitcode);
- }
-
-
- int window3(void)
-
- {
-
- WINDOW *wnd;
- FIELD *fld;
- char callsperday[7];
- char timepercall[7];
- char totaltime[7];
- int exitcode;
-
- sprintf(callsperday,"%-u",newuser.callsperday);
- sprintf(timepercall,"%-u",newuser.timepercall);
- sprintf(totaltime,"%-u",newuser.totaltime);
-
- wnd=establish_window(5,6,7,33);
- set_border(wnd,3);
- set_title(wnd," NewUser Defaults--Window #3 ");
- set_colors(wnd,ALL,BLUE,WHITE,BRIGHT);
- set_colors(wnd,ACCENT,WHITE,BLACK,DIM);
-
- display_window(wnd);
-
- wprompt(wnd,2,1,"Calls per day:");
- wprompt(wnd,2,2,"Time per call:");
- wprompt(wnd,2,3,"Total time per day:");
-
- init_template(wnd);
-
- fld=establish_field(wnd,22,1,mskzip,callsperday,'N');
- field_window(fld,"calls ",34,2);
- fld=establish_field(wnd,22,2,mskzip,timepercall,'N');
- field_window(fld,"time ",34,3);
- fld=establish_field(wnd,22,3,mskzip,totaltime,'N');
- field_window(fld,"total ",34,4);
-
- prep_template(wnd);
- exitcode=data_entry(wnd);
- delete_window(wnd);
-
- newuser.callsperday=(word)atoi(callsperday);
- newuser.timepercall=(word)atoi(timepercall);
- newuser.totaltime=(word)atoi(totaltime);
- return (exitcode);
-
- }
-
-
-
- int window4(void)
-
- {
-
- WINDOW *wnd;
- WINDOW *instruct;
- FIELD *fld;
- char attr[13][2];
- int register x;
- int exitcode;
- char cold[2];
-
- instruct=establish_window(40,4,3,35);
- set_border(instruct,2);
- set_title(instruct,"Toggles");
- set_colors(instruct,ALL,MAGENTA,BLACK,DIM);
- set_colors(instruct,ACCENT,MAGENTA,WHITE,BRIGHT);
- display_window(instruct);
- wprintf(instruct," [X] to set, [Space] to reset ");
-
- wnd=establish_window(5,3,17,34);
- set_border(wnd,3);
- set_title(wnd," NewUser Defaults--Window #4 ");
- set_colors(wnd,ALL,BLUE,WHITE,BRIGHT);
- set_colors(wnd,ACCENT,WHITE,BLACK,DIM);
-
- display_window(wnd);
-
- wprintf(wnd," NewUser Attributes:");
- wprompt(wnd,2,2,"Expert Mode:");
- wprompt(wnd,2,3,"Ignore Hours:");
- wprompt(wnd,2,4,"Ignore Ratio:");
- wprompt(wnd,2,5,"Never Kill:");
- wprompt(wnd,2,6,"Deleted:");
- wprompt(wnd,2,7,"Reliable Connect:");
- wprompt(wnd,2,8,"Twit:");
- wprompt(wnd,2,9,"ANSI cursor menus:");
- wprompt(wnd,2,10,"Special flag:");
- wprompt(wnd,2,11,"General flag #1:");
- wprompt(wnd,2,12,"General flag #2:");
- wprompt(wnd,2,13,"General flag #3:");
- wprompt(wnd,2,14,"Cold Input:");
-
- init_template(wnd);
-
- for (x=0;x<12;x++) {
- fld=establish_field(wnd,22,x+2,msk1,attr[x],'O');
- field_window(fld,"attributes",43,6+x);
- }
- fld=establish_field(wnd,22,14,msk1,cold,'O');
- field_window(fld,"coldinput ",43,6);
-
- prep_template(wnd);
-
- for (x=0;x<12;x++) attr[x][1]=0;
- *attr[0]=newuser.expert ? 'X' : '-';
- *attr[1]=newuser.ignorehrs ? 'X' : '-';
- *attr[2]=newuser.ignorerat ? 'X' : '-';
- *attr[3]=newuser.nokill ? 'X' : '-';
- *attr[4]=newuser.deleted ? 'X' : '-';
- *attr[5]=newuser.arq ? 'X' : '-';
- *attr[6]=newuser.twit ? 'X' : '-';
- *attr[7]=newuser.ansimenus ? '-' : 'X';
- *attr[8]=newuser.commodore ? 'X' : '-';
- *attr[9]=newuser.gen1 ? 'X' : '-';
- *attr[10]=newuser.gen2 ? 'X' : '-';
- *attr[11]=newuser.gen3 ? 'X' : '-';
- if(newuser.cold) strcpy(cold,"X");
- else strcpy(cold,"-");
-
- exitcode=data_entry(wnd);
- delete_window(wnd);
-
- newuser.expert =*attr[0]=='X';
- newuser.ignorehrs=*attr[1]=='X';
- newuser.ignorerat=*attr[2]=='X';
- newuser.nokill =*attr[3]=='X';
- newuser.deleted =*attr[4]=='X';
- newuser.arq =*attr[5]=='X';
- newuser.twit =*attr[6]=='X';
- newuser.ansimenus=*attr[7]=='-';
- newuser.commodore=*attr[8]=='X';
- newuser.gen1 =*attr[9]=='X';
- newuser.gen2 =*attr[10]=='X';
- newuser.gen3 =*attr[11]=='X';
- newuser.cold =*cold=='X';
- newuser.graphics=0;
- newuser.hiok=0;
-
- delete_window(instruct);
- return (exitcode);
-
- }
-
-
-
- char * lstrip (char *a)
-
- {
- while ((strlen(a)) && (*a==' ')) memmove (a,(a+1),strlen(a));
- return (a);
- }
-
-
-
- void pascal print_clock (void) {
-
- int x;
- int y;
- struct time dos_time;
- static struct time hold_time;
-
- gettime(&dos_time);
- if (dos_time.ti_sec==hold_time.ti_sec) return;
- x=wherex();
- y=wherey();
- gotoxy(71,25);
- gettime(&hold_time);
- textbackground(7);
- textcolor(0);
- cputs(saytime(&dos_time));
- textcolor(7);
- textbackground(0);
- gotoxy(x,y);
- }
-
-
- char * pascal saytime (struct time *a) {
-
- static char xtime[9];
-
- sprintf(xtime,"%02u:%02u:%02u",a->ti_hour,a->ti_min,a->ti_sec);
- return(xtime);
- }
-
-
-
- char * pascal fgetsx (char *str,int num,int handle) {
-
- static char *p;
- static long pos;
- static int x;
-
- if (eof(handle)) {
- *str=0;
- return NULL;
- }
- pos=tell(handle);
- x=_read(handle,str,num-1);
- if (x<1) {
- *str=0;
- return NULL;
- }
- str[x]=0;
- p=str;
- while(*p && *p!='\r' && *p!='\n') p++;
- if(!*p) return str;
- if(*p=='\r') {
- *p='\n';
- if (p[1]=='\n') {
- p++;
- *p=0;
- }
- }
- p++;
- *p=0;
- lseek(handle,pos+((long)((word)p-(word)str)),SEEK_SET);
- return str;
- }
-