home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / BBS / MISC / XSRC_117.ZIP / XIJIT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-03  |  10.7 KB  |  249 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*   XBBS SOURCE CODE copyright (c) 1990 by M. Kimes                        */
  4. /*   All Rights Reserved                                                    */
  5. /*                                                                          */
  6. /*    For complete details of the licensing restrictions, please refer      */
  7. /*    to the License agreement, which is published in its entirety in       */
  8. /*    the in the file LICENSE.XBS.                                          */
  9. /*                                                                          */
  10. /*    USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE      */
  11. /*    XBBS LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF            */
  12. /*    THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO       */
  13. /*    NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT M. KIMES         */
  14. /*    AT THE ADDRESS LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO USE   */
  15. /*    THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE XBBS LICENSING     */
  16. /*    AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH      */
  17. /*    M. KIMES                                                              */
  18. /*                                                                          */
  19. /*                                                                          */
  20. /* You can contact M. Kimes at the following address:                       */
  21. /*                                                                          */
  22. /* M. Kimes                         1:380/16.0@FidoNet                      */
  23. /* 542 Merrick                      (318)222-3455 data                      */
  24. /* Shreveport, LA  71104                                                    */
  25. /*                                                                          */
  26. /*                                                                          */
  27. /* Please feel free to contact me at any time to share your comments about  */
  28. /* my software and/or licensing policies.                                   */
  29. /*                                                                          */
  30. /*--------------------------------------------------------------------------*/
  31. /************************************************************************/
  32. /* XBBS XIjit module (Ijit-mode, named for the ijits who use it :-)     */
  33. /************************************************************************/
  34.  
  35. #include "msg.h"
  36. #include "xext.h"
  37.  
  38.  
  39. void pascal xijit (void) {
  40.  
  41.     char command;
  42.     static char comstring[26]="";
  43.     int register x;
  44.     char s[133];
  45.     char prettystring[256]="";
  46.     char *divie[28];
  47.     char lastcommand=0;
  48.     char highcommand,wascommand;
  49.  
  50.     cls();
  51.     redraw_stat(NULL);
  52.     printm("\n\04Ijit-mode\n");
  53.     if(!*comstring) strncpy(comstring,say_prompt(453),26);
  54.     strncpy(prettystring,say_prompt(580),256);
  55.     prettystring[255]=0;
  56.     divie[0]=strtok(prettystring," ");
  57.     if(divie[0]) {
  58.         x=1;
  59.         while((divie[x]=strtok(0," ")) && x<26) {
  60.  
  61.             char *p;
  62.  
  63.             while(p=strchr(divie[x],'_')) *p=' ';
  64.             x++;
  65.         }
  66.         highcommand=(char)x-1;
  67.     }
  68.     while(1) {
  69.         if ((user.ansimenus || !user.graphics) || !divie[0]) {
  70.             say_prompt(448);
  71.             helpnum=576;
  72.             command=*genin(1,0,1,1,ALLL);
  73.             helpnum=0;
  74.             for(x=0;x<(int)(highcommand+1);x++) {
  75.                 if(toupper(*divie[x])==toupper(command)) {
  76.                     printm(&divie[x][1]);
  77.                 }
  78.             }
  79.         }
  80.         else {
  81. FancyReDo:
  82.             say_prompt(581);
  83. FancyRepeat:
  84.             printm(divie[lastcommand]);
  85. FancyNull:
  86.             helpnum=0;
  87.             command=*genin(1,0,1,1,HYPER);
  88.             wascommand=lastcommand;
  89.             switch((int)command) {
  90.                 case 0:   command=toupper(*divie[lastcommand]);
  91.                           goto DirectEntry;
  92.                 case 1:
  93.                 case 4:
  94.                 case '4':
  95.                 case '8': if(lastcommand==0) lastcommand=highcommand;
  96.                           else lastcommand--;
  97.                           break;
  98.                 case 5:
  99.                 case 2:
  100.                 case '6':
  101.                 case '2': if(lastcommand==highcommand) lastcommand=0;
  102.                           else lastcommand++;
  103.                           break;
  104.                 case 11:
  105.                 case 27:  printm("\n");
  106.                           say_prompt(454);
  107.                           printm("\n");
  108.                           goto FancyReDo;
  109.                 case 3:   printm("\n");
  110.                           goto FancyReDo;
  111.                 default:  for(x=0;x<(int)(highcommand+1);x++) {
  112.                             if(toupper(command)==toupper(*divie[x])) {
  113.                                 if(lastcommand!=(char)x) {
  114.                                     lastcommand=(char)x;
  115.                                     backup(divie[wascommand]);
  116.                                     printm(divie[lastcommand]);
  117.                                 }
  118.                                 goto DirectEntry;
  119.                             }
  120.                           }
  121.                           backup(divie[wascommand]);
  122.                           gprintf(0,"%c",command);
  123.                           goto DirectEntry;
  124.             }
  125.             backup(divie[wascommand]);
  126.             goto FancyRepeat;
  127.         }
  128. DirectEntry:
  129.         printm("\n");
  130.         for(x=0;x<27;x++) {
  131.             if(comstring[x]==command) {
  132.                 command=(char)x+1;
  133.                 break;
  134.             }
  135.             if(!comstring[x])break;
  136.         }
  137.         switch ((int)command) {
  138.             case '*':   readfile("IJITXTRA.XBS",1,1,1);
  139.                         break;
  140.             case 6:
  141.             case 0:     say_prompt(454);
  142.                         break;
  143.             case 1:     cls();
  144.                         sprintf(buffer,"%sMSGS.XBS",conf.menupath);
  145.                         if(!findfirst(buffer,&filestat,0)) {
  146.                             readfile("MSGS.XBS",1,1,1);
  147.                             break;
  148.                         }
  149.                         dobulls(NULL,3);
  150.                         cls();
  151.                         break;
  152.             case 2:     cls();
  153.                         sprintf(buffer,"%sFILES.XBS",conf.menupath);
  154.                         if(!findfirst(buffer,&filestat,0)) {
  155.                             readfile("FILES.XBS",1,1,1);
  156.                             break;
  157.                         }
  158.                         xfile(NULL,2);
  159.                         cls();
  160.                         break;
  161.             case 3:     cls();
  162.                         sprintf(buffer,"%sDOORS.XBS",conf.menupath);
  163.                         if(!findfirst(buffer,&filestat,0)) {
  164.                             readfile("DOORS.XBS",1,1,1);
  165.                             break;
  166.                         }
  167.                         xdoor(NULL,3);
  168.                         cls();
  169.                         break;
  170.             case 4:     cls();
  171.                         {
  172.                             char coms[26]="";
  173.                             char com;
  174.  
  175.                             sprintf(buffer,"%sCONFIGUR.XBS",conf.menupath);
  176.                             if(!findfirst(buffer,&filestat,0)) {
  177.                                 readfile("CONFIGUR.XBS",1,1,1);
  178.                                 break;
  179.                             }
  180.                             strncpy(coms,say_prompt(457),26);
  181.                             while(1) {
  182.                                 say_prompt(456);
  183.                                 com=*genin(1,0,1,1,ALPHA);
  184.                                 printm("\n");
  185.                                 for(x=0;x<27;x++) {
  186.                                     if(coms[x]==com) {
  187.                                         com=(char)x+1;
  188.                                         break;
  189.                                     }
  190.                                     if(!coms[x])break;
  191.                                 }
  192.                                 switch((int)com) {
  193.                                     case 1: usertoggle(GRAPHICS);
  194.                                             break;
  195.                                     case 2: usertoggle(MORE);
  196.                                             break;
  197.                                     case 3: usertoggle(SCRNCLR);
  198.                                             break;
  199.                                     case 4: say_prompt(247);
  200.                                             width();
  201.                                             break;
  202.                                     case 5: say_prompt(246);
  203.                                             length();
  204.                                             break;
  205.                                     case 6: password();
  206.                                             break;
  207.                                     case 7:
  208.                                     case 0: goto BreakOut;
  209.                                     case 8: user.cold=1-user.cold;
  210.                                             if(user.cold) printm("Cold\n");
  211.                                             else printm("Hot\n");
  212.                                             break;
  213.                                     case 9: say_prompt(458);
  214.                                             break;
  215.                                     default: printm("\07");
  216.                                              break;
  217.                                 }
  218.                         }
  219.                     }
  220. BreakOut:
  221.                         cls();
  222.                         break;
  223.             case 5:     sprintf(buffer,"%sLOGOFF.XBS",conf.menupath);
  224.                         if(!findfirst(buffer,&filestat,0)) {
  225.                             readfile("LOGOFF.XBS",1,1,1);
  226.                             break;
  227.                         }
  228.                         say_prompt(455);
  229.                         if(*genin(1,0,1,1,YESNO)!='N') {
  230.                            cls();
  231.                            readfile("GOODBYE.XBS",1,1,1);
  232.                            fossil(FLUSHOUT,0);
  233.                            fossil(DTR,DOWN);
  234.                            baud=0;
  235.                            leaving++;
  236.                            logoff();
  237.                            userno=0;
  238.                            exit(254);
  239.                         }
  240.                         printm("\n");
  241.                         break;
  242.             default:    sprintf(s,"XIJIT%03hu.XBS",command);
  243.                         readfile(s,1,1,1);
  244.                         break;
  245.         }
  246.     }
  247. }
  248.  
  249.