home *** CD-ROM | disk | FTP | other *** search
- /*--------------------------------------------------------------------------*/
- /* */
- /* XBBS SOURCE CODE copyright (c) 1990 by M. Kimes */
- /* All Rights Reserved */
- /* */
- /* For complete details of the licensing restrictions, please refer */
- /* to the License agreement, which is published in its entirety in */
- /* the in the file LICENSE.XBS. */
- /* */
- /* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
- /* XBBS LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
- /* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
- /* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT M. KIMES */
- /* AT THE ADDRESS LISTED BELOW. IN NO EVENT SHOULD YOU PROCEED TO USE */
- /* THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE XBBS LICENSING */
- /* AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH */
- /* M. KIMES */
- /* */
- /* */
- /* You can contact M. Kimes at the following address: */
- /* */
- /* M. Kimes 1:380/16.0@FidoNet */
- /* 542 Merrick (318)222-3455 data */
- /* Shreveport, LA 71104 */
- /* */
- /* */
- /* Please feel free to contact me at any time to share your comments about */
- /* my software and/or licensing policies. */
- /* */
- /*--------------------------------------------------------------------------*/
-
- #include "msg.h"
- #include "xext.h"
-
-
- struct _menu {
- char prompt[81];
- char key;
- char action;
- char data[133];
- char color;
- };
-
- void pascal xmenu (char *menuname);
-
-
-
- char pascal do_item (struct _menu **m,char which) {
-
- register int x;
- char s[133],s1[133];
- char *p,*pp;
- struct ffblk f;
-
- switch ((int)m[which]->action) {
- case 255: break; /* Quit menu (also return from a gosub) */
- case 0: break; /* NOOP */
- case 1: break; /* Goto, handled in xmenu() */
- case 2: xmenu(m[which]->data); /* Gosub */
- break;
- case 3: readfile(m[which]->data,1,1,1); /* Read menu file */
- break; /* The most powerful action */
- case 4: readtext(m[which]->data); /* Read text file */
- break;
- case 5: password();
- break;
- case 6: handler();
- break;
- case 7: say_prompt(240);
- city();
- break;
- case 8: say_prompt(241);
- state();
- break;
- case 9: say_prompt(244);
- phone1();
- break;
- case 10: say_prompt(245);
- phone2();
- break;
- case 11: say_prompt(242);
- zip();
- break;
- case 12: say_prompt(246);
- length();
- break;
- case 13: say_prompt(247);
- width();
- break;
- case 14: comptype();
- break;
- case 15: logoff(); /* Log user off */
- fossil(DTR,DOWN);
- baud=0;
- exit(253);
- case 16: strcpy(s,m[which]->data); /* Raw directory--data="path type" */
- p=strtok(s," ");
- rawdir(p,(char)atoi(strtok(0,"\n")));
- break;
- case 17: strcpy(s,m[which]->data); /* Bulls-mode--data="filename type" */
- p=strtok(s," ");
- dobulls(p,(char)atoi(strtok(0,"\n")));
- break;
- case 18: strcpy(s,m[which]->data); /* Files-mode--data="filename statnum" */
- p=strtok(s," ");
- xfile(p,(char)atoi(strtok(0,"\n")));
- break;
- case 19: strcpy(s,m[which]->data); /* Doors-mode--data="filename statnum" */
- p=strtok(s," ");
- xdoor(p,(char)atoi(strtok(0,"\n")));
- break;
- case 20: strcpy(s,m[which]->data); /* Look up named help--data="filename helptopic" */
- p=strtok(s," ");
- find_help(p,strtok(0,"\n"),0);
- break;
- case 21: strncpy(startfile,m[which]->data,13); /* Restart XBBS--data="textfilename" */
- startfile[12]=0;
- longjmp(envbuf,99);
- break;
- case 22: /* Read any files */
- strcpy(s,m[which]->data);
- p=strtok(s," ");
- pp=strtok(0," ");
- readany(p,pp,(char)atoi(strtok(0,"\n")));
- break;
- case 23: /* Read all new files */
- strcpy(s,m[which]->data);
- p=strtok(s," ");
- readnew(p,(char)atoi(strtok(0,"\n")));
- break;
- case 24: /* Read messages */
- readamessage((char)atoi(m[which]->data),0);
- break;
- case 25: /* Write message */
- if (!askwrite((char)atoi(m[which]->data))) {
- if (!writemessage((char)atoi(m[which]->data))) {
- makemessage((char)atoi(m[which]->data));
- }
- }
- break;
- case 26: /* List FILES.BBS */
- strcpy(s,m[which]->data);
- p=strtok(s," ");
- x=atoi(strtok(0," "));
- pp=strtok(0," ");
- filesbbs(p,(char)x,pp,strtok(0,"\n"));
- break;
- case 27: /* Upload */
- if(!stricmp(fboard.upath,"NUL") || !stricmp(fboard.upath,"NUL\\")) {
- say_prompt(451);
- break;
- }
- strcpy(s,m[which]->data);
- upload(s,0);
- break;
- case 28: /* Download */
- if(isleech(fboard.leechpercent)) {
- say_prompt(598);
- break;
- }
- strcpy(s,m[which]->data);
- p=strtok(s," ");
- x=atoi(strtok(0," "));
- askdl(p,(char)x,strtok(0,"\n"),0);
- break;
- case 29: /* Export FTN packet */
- strcpy(s,m[which]->data);
- x=atoi(strtok(s," "));
- export_mail((char)x,(char)atoi(strtok(0,"\n")));
- break;
- case 30: /* Read all areas */
- strcpy(s,m[which]->data);
- p=strtok(s," ");
- x=atoi(strtok(0," "));
- pp=strtok(0," ");
- do_all_msg_areas(p,(char)x,(char)atoi(pp),(char)atoi(strtok(0,"\n")),0);
- break;
- case 31: /* Hypertext */
- strcpy(s,m[which]->data);
- p=strtok(s," ");
- load_topics(p);
- pp=strtok(0," ");
- set_topic(pp);
- x=atoi(strtok(0,"\n"));
- if(x<0 || x>9)x=0;
- display_topic(user.stat[x],&pp);
- break;
- case 32: user.graphics=1-user.graphics;
- break;
- case 33: user.hiok=1-user.hiok;
- break;
- case 34: user.scrnclr=1-user.scrnclr;
- break;
- case 35: user.more=1-user.more;
- break;
- case 36: user.commodore=1-user.commodore;
- break;
- case 37: user.fullscreen=1-user.fullscreen;
- break;
- case 38: /* Change msg area--data same as for @M */
- strcpy(s,m[which]->data);
- strncpy(mboard.name,strtok(s,","),48);
- mboard.name[47]=0;
- mboard.attr=(word)atoi(strtok(0," ,"));
- mboard.max=(word)atoi(strtok(0," ,"));
- mboard.number=(word)atoi(strtok(0," ,"));
- mboard.substat1=(word)atoi(strtok(0," ,"));
- mboard.substat2=(word)atoi(strtok(0," ,"));
- p=strtok(0,",");
- if(p!=NULL)strncpy(mboard.forceto,p,36);
- else *mboard.forceto=0;
- mboard.forceto[35]=0;
- mboard.age=0;
- mboard.flags=0;
- p=strtok(0,",");
- if(p!=NULL) mboard.minwrite=(word)atol(p);
- else mboard.minwrite=0;
- break;
- case 39: /* Change file area--data same as for @F */
- strcpy(s,m[which]->data);
- strncpy(fboard.name,strtok(s,","),48);
- fboard.name[46]=0;
- strncpy(fboard.dpath,strtok(0," ,"),81);
- fboard.dpath[80]=0;
- strncpy(fboard.upath,strtok(0," ,"),81);
- fboard.upath[80]=0;
- fboard.flags=(char)atoi(strtok(0," ,"));
- fboard.age=0;
- fboard.userflags=0;
- p=strtok(0," ,");
- if(p) fboard.leechpercent=(char)atoi(p);
- else fboard.leechpercent=0;
- break;
- case 40: /* List msg areas */
- if(!*m[which]->data) find_msgarea(say_prompt(486),"",2);
- else find_msgarea(m[which]->data,"",2);
- break;
- case 41: /* List file areas */
- find_filearea(say_prompt(446),"___",user.stat[(char)atoi(m[which]->data)]);
- break;
- case 42: /* Select msg area by name */
- MsgList:
- say_prompt(599); /* Change current msg area */
- helpnum=0;
- strcpy(s,genin(48,0,1,0,ALLL));
- printm("\n");
- if(*s=='?') {
- sprintf(s,"%sBULLS\\BOARDLST.XBS",conf.menupath);
- if(findfirst(s,&f,0)) {
- if(!*m[which]->data) find_msgarea(say_prompt(486),"",2);
- else find_msgarea(m[which]->data,"",2);
- }
- else readfile(s,1,1,1);
- goto MsgList;
- }
- if(*s) {
- if(atol(s)) {
- if(!*m[which]->data) find_msgarea(say_prompt(486),s,1);
- else find_msgarea(m[which]->data,s,1);
- }
- else {
- if(!*m[which]->data) find_msgarea(say_prompt(486),s,0);
- else find_msgarea(m[which]->data,s,0);
- }
- }
- break;
- case 43: /* Select file area by name */
- FileList:
- gprintf(0,say_prompt(490),fboard.name);
- say_prompt(449); /* Change current file area */
- helpnum=592;
- strcpy(s,genin(48,0,1,0,ALLL));
- helpnum=0;
- printm("\n");
- if(*s=='?') {
- sprintf(s,"%sAREALIST.XBS",conf.menupath);
- if(findfirst(s,&f,0)) {
- find_filearea(say_prompt(446),"___",user.stat[(char)atoi(m[which]->data)]);
- }
- else readfile(s,1,1,1);
- goto FileList;
- }
- if(*s) {
- if(atol(s)) {
- strcpy(s1,"#");
- strcat(s1,s);
- }
- else strcpy(s1,s);
- if(!find_filearea(say_prompt(446),s,user.stat[(char)atoi(m[which]->data)])) {
- say_prompt(450);
- }
- }
- break;
- case 44: if (pages>conf.pages) { /* Request chat */
- readfile("getlost.xbs",0,0,1);
- pages++;
- break;
- }
- addtolog("Requested chat.");
- if (conf.sysopin) readfile("chat.xbs",0,0,1);
- else readfile("nochat.xbs",0,0,1);
- pages++;
- break;
- case 45: user.twit=1-user.twit; /* Toggle twit bit */
- break;
- case 46: user.expert=1-user.expert; /* Toggle expert bit */
- break;
- case 47: save_lastread(); /* Reload lastread pointers */
- break;
- case 48: load_lastread(); /* Save lastread pointers */
- break;
- case 49: userlist(0); /* List users by handles */
- break;
- case 50: userlist(1); /* List users by real names */
- break;
- case 51: strncpy(menufile,m[which]->data,81); /* Restart XBBS--data="menufilename" */
- menufile[80]=0;
- longjmp(envbuf,98);
- break;
- case 52: strcpy(s,m[which]->data); /* Output a quote */
- x=atoi(s);
- strtok(s," ,");
- p=strtok(0," ,");
- stripcr(p);
- spit((char)x,p);
- break;
-
- /* Run external programs */
- case 201:
- case 202:
- case 203:
- case 204:
- case 205:
- case 206: userinfo(0,0);
- case 207:
- case 208:
- strcpy(s,m[which]->data);
- x=(int)m[which]->action;
- if(x==208) spawnit("",4,(char)atoi(s));
- else if(x==201) spawnit(s,0,0);
- else if(x==202) spawnit(s,7,0);
- else if(x==203) spawnit(s,6,0);
- else if(x==204) spawnit(s,8,0);
- else if(x==205) spawnit(s,9,0);
- else if(x==206) spawnit(s,3,0);
- else if(x==207) spawnit(s,1,0);
- break;
-
- default: gprintf(LOCALONLY,"\n\04Unsupported menu action %hu\n",m[which]->action);
- break;
- }
- return m[which]->action;
- }
-