home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / BBS / MISC / XSRC_117.ZIP / MLIO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-04  |  21.6 KB  |  771 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 Bulletin Board System.....Modem/local I/O                      */
  33. /*======================================================================*/
  34.  
  35. #include "msg.h"
  36. #include "xext.h"
  37. #include "bios.h"
  38.  
  39. char pascal specialkey (char a) {   /* Special extended local keys */
  40.  
  41.     char tempause;
  42.     char middle[136];
  43.     int temp=0;
  44.     word tempbaud;
  45.     int handle;
  46.  
  47.     tempause=pauser;
  48.     pauser=0;
  49.  
  50.     if ((a>58) && (a<69)) {  /* F-KEY FILES */
  51.       sprintf(middle,"%s%u%s","F",a-58,".XBS");
  52.       if (conf.debug) {
  53.         gprintf(LOCALONLY,"\n\x4%s\n",middle);
  54.       }
  55.       readfile(middle,0,0,1);
  56.       return 0;
  57.     }
  58.  
  59.     if ((a>83) && (a<113)) { /* ALT, SHIFT or CTRL F-KEY FILES */
  60.       sprintf(middle,"%s%u%s","AF",a-83,".XBS");
  61.       if (conf.debug) {
  62.         gprintf(LOCALONLY,"\n\x4%s\n",middle);
  63.       }
  64.       readfile(middle,0,0,1);
  65.       return 0;
  66.     }
  67.  
  68.     if ((a>119) && (a<130)) { /* ALT-# SHELLS */
  69.  
  70.       char *p;
  71.       char shelltype;
  72.       char elevel;
  73.  
  74.       if (a==129) a=119;
  75.       a-=119;
  76.       strncpy(middle,say_prompt(402+a),136);
  77.       middle[135]=0;
  78.       stripcr(middle);
  79.       rstrip(middle);
  80.       if (!*middle) return 0;
  81.       p=middle;
  82.       p++;
  83.       shelltype=*middle-'0';
  84.       elevel=a+119;
  85.       if (shelltype==EXIT) elevel=(char)atoi(p);
  86.       adjust_time(0);
  87.       spawnit(p,shelltype,elevel);
  88.       adjust_time(1);
  89.       chatted=1;
  90.       return 0;
  91.     }
  92.  
  93.     switch ((int)a) {
  94.  
  95.         case 48:              /* QUIT */
  96.            say_prompt(2);
  97.            exit(254);
  98.  
  99.         case 131:             /* MORE TIME... ALT + */
  100.             timelimit++;
  101.             if (conf.whichstat!=3)conf.whichstat=0;
  102.             redraw_stat(NULL);
  103.             return 0;
  104.  
  105.         case 130:             /* LESS TIME... ALT - */
  106.             if (timelimit<1) timelimit=0;
  107.             else timelimit--;
  108.             if (conf.whichstat!=3) conf.whichstat=0;
  109.             redraw_stat(NULL);
  110.             return 0;
  111.  
  112.         case 36:              /* SysOp SHELL */
  113.            sysop_shell();
  114.            return 0;
  115.  
  116.         case 113:        /* SysOp Help File */
  117.           tempbaud=baud;
  118.           baud=0;
  119.           readfile("SYSHELP.XBS",1,1,1);
  120.           baud=tempbaud;
  121.           return 0;
  122.  
  123.         case 46:          /* CHAT ON/OFF */
  124.           if (!chatting) {
  125.             chatting=1;
  126.             temp=safe;
  127.             safe=0;
  128.             chat();
  129.             safe=temp;
  130.           }
  131.           else chatting=0;
  132.           redraw_stat(NULL);
  133.           return 0;
  134.  
  135.         case 22:          /* ALT-U...User edit window */
  136.             edit_user(0);
  137.             return 0;
  138.  
  139.         case 24:          /* ALT-O...Option window */
  140.             other_options(0);
  141.             return 0;
  142.  
  143.         case 79:
  144.             conf.whichstat++;   /* Toggle status lines */
  145.             redraw_stat(NULL);
  146.             return 0;
  147.  
  148.         case 34:                /* Ring a bell */
  149.             (baud) ? mprint("\x7") : lprint("\x7");
  150.             return 0;
  151.  
  152.         case 75:  return 1;     /* Arrow left */
  153.         case 77:  return 2;     /* Arrow right */
  154.         case 72:  return 4;     /* Arrow up */
  155.         case 80:  return 5;     /* Arrow down */
  156.  
  157.         case 71:
  158.             say_prompt(345);
  159.             return 0;
  160.  
  161.         default:
  162.             start=getxbbstime();
  163.             pauser=tempause;
  164.             return (a | 128);
  165.     }
  166. }
  167.  
  168.  
  169.  
  170. char pascal fossil (char function, char arg) {
  171.                                   /*  HANDLES MOST USEFUL FOSSIL CALLS */
  172.  
  173.   static char inited=0;
  174.  
  175.   if(!baud) if (function!=DEINIT || !inited) return 0;
  176.  
  177.   if (function==FLUSHOUT) {
  178.      do {
  179.        carrchk();
  180.        r.x.dx=conf.commport;
  181.        r.h.ah=3;
  182.        int86(20,&r,&r);
  183.      } while (!(r.h.ah & 64));
  184.      return 0;
  185.   }
  186.  
  187.   r.h.al=arg;           /* Do the rest */
  188.   r.x.dx=conf.commport;
  189.   r.h.ah=function;
  190.   int86(20,&r,&r);
  191.  
  192.   switch ((int)function) {
  193.     case TRANSMIT: return (r.x.ax);
  194.     case GETSTAT:  arg = r.h.ah;
  195.                    if (r.h.al & 128) {
  196.                        arg |= 128;
  197.                        return (arg);
  198.                     }
  199.                     arg &= 127;
  200.                     return (arg);
  201.     case RECVWAIT:  return (r.h.al);
  202.     case INIT:      if (r.x.ax != INITOK) {
  203.                        say_prompt(17);
  204.                        exit(253);
  205.                     }
  206.                     inited=1;
  207.                     return 0;
  208.     case DEINIT:    inited=0;
  209.     default:        return 0;
  210.   }
  211. }
  212.  
  213.  
  214.  
  215. char pascal printm (char *text) {  /* PRINTS TO MODEM AND SCREEN */
  216.  
  217.   char arg=0;
  218.   char *p;
  219.   char t[2];
  220.   char tempause;
  221.   unsigned long t1;
  222.  
  223.   if(!slowprint) {
  224.       mprint(text);
  225.       arg=lprint(text);
  226.       if (baud) {
  227.         carrchk();
  228.         if (baud<=conf.purgebaud) if (text[1] && text[2]) fossil(FLUSHOUT,0);
  229.       }
  230.   }
  231.   else {
  232.       tempause=pauser;
  233.       pauser=2;
  234.       p=text;
  235.       t[1]=0;
  236.       if(baud)fossil(FLUSHOUT,0);
  237.       while(*p) {
  238.          *t=*p;
  239.          mprint(t);
  240.          lprint(t);
  241.          inkey();
  242.          t1=(unsigned long)biostime(0,0L)+(unsigned long)slowprint;
  243.          while((unsigned long)biostime(0,0L)<t1 && t1<(unsigned long)biostime(0,0L)+256L) {
  244.             if(baud)carrchk();
  245.          }
  246.          p++;
  247.       }
  248.       pauser=tempause;
  249.   }
  250.   return arg;
  251. }
  252.  
  253. void pascal mprint (char *text) {  /*  PRINTS TO MODEM */
  254.  
  255. char *text2;
  256.  
  257.   getxbbstime();
  258.  
  259.   if(!baud) return;
  260.   if ((text==NULL) || (!*text)) return;
  261.   text2=text;
  262.  
  263.   if (baud) {
  264.     carrchk();
  265.     while (*text2) {
  266.         if (*text2=='\n' || *text2=='\r') {
  267.             if (text2[1]!='\n') {
  268.                 while (!fossil(TRANSMIT,'\r')) {
  269.                      carrchk();
  270.                 }
  271.                 *text2='\n';
  272.             }
  273.         }
  274. WaitLoop:
  275.         r.h.al=*text2;  /* A little faster than calling fossil() */
  276.         if (!user.graphics && !user.hiok) r.h.al &=127;   /* No hibit for these users */
  277.         r.x.dx=conf.commport;
  278.         r.h.ah=TRANSMIT;
  279.         int86(20,&r,&r);
  280.         if (!r.x.ax) {
  281.             carrchk();
  282.             goto WaitLoop;
  283.         }
  284.         text2++;
  285.     }
  286.   }
  287. }
  288.  
  289.  
  290.  
  291. char * pascal genin (length,password,caps,hot,type)  /* GENERIC INPUT ROUTINE */
  292.  
  293. char length;
  294. char password;
  295. char caps;
  296. char hot;
  297. char type;
  298.  
  299. {
  300.  
  301.     static char geninput[257];
  302.     char record=0;
  303.     int x;
  304.     register word y;
  305.     char one;
  306.     char beep;
  307.     static char ansi;
  308.     char *holdem;
  309.     word templast;
  310.     char pos;
  311.  
  312.     templast=lastprompt;
  313.  
  314. ReStartIt:
  315.  
  316.  if(type & 128) {
  317.     type=(type &(~128));
  318.     record++;
  319.  }
  320.  x=0;
  321.  one=beep=0;
  322.  fossil(FLUSHOUT,0);
  323.  if(hot==1 && user.cold && type!=YESNOM) hot=0;
  324.  if (user.cold) fossil(PURGEIN,0);
  325.  lines=pauser=0;
  326.  *geninput=0;
  327.  if (type==ANSISET) {
  328.     ansi=length;
  329.     level=0;
  330.     return (geninput);
  331.  }
  332.  if (length) length--;
  333.  
  334.  if (type==PHONE && conf.genphone) type=ALPHANUM;
  335.  if(type==PHONE) printm("(");
  336.  
  337. AfterChat:
  338.  
  339.  start=getxbbstime();
  340.  chatted=0;
  341.  
  342.  while ((getxbbstime()-start)<(conf.idleseconds+1)) {
  343.  
  344. Continue:
  345.  
  346.   if(*keybuf && type!=YESNOM && !record) {
  347.     one=*keybuf;
  348.     memmove(keybuf,&keybuf[1],81);
  349.     if(one=='|') one='\r';
  350.   }
  351.   else one=inkey();
  352.  
  353.   if(type==THRU && !one) return "";
  354.   if(type==FORWINDOW) {
  355.     if(!one) continue;
  356.     else {
  357.       geninput[x]=one;
  358.       x++;
  359.       geninput[x]=0;
  360.       return geninput;
  361.     }
  362.   }
  363.  
  364.    if(one && one==conf.helpkey) {    /* Help key (CTRL-T) pressed */
  365.  
  366.         char tempsafe;
  367.  
  368.         if(type==ARROWS || type==TRUEANSI || type==ANSIIN || helpnum==65535) {
  369.             printm("\x7");
  370.             continue;
  371.         }
  372.         if(type==YESNOM) {
  373.             say_prompt(453);
  374.             say_prompt(18);
  375.             continue;
  376.         }
  377.         if(!helpnum) {
  378.             say_prompt(467);
  379.             sleep(1);
  380.             say_prompt(468);
  381.             continue;
  382.         }
  383.         tempsafe=safe;
  384.         safe=0;
  385.         say_prompt(462);
  386. ReHelp:
  387.         if ((getxbbstime()-start)>(conf.idleseconds+1)) continue;
  388.         while(!(one=toupper(inkey())) && ((getxbbstime()-start)<(conf.idleseconds+1)));
  389.         switch ((int)one) {
  390.             case '\r':
  391.             case 'Y':   say_prompt(463);
  392.                         if(*geninput) {
  393.                            holdem=(char *)mmalloc(strlen(geninput)+1);
  394.                            if(holdem) strcpy(holdem,geninput);
  395.                         }
  396.                         else {
  397.                            holdem=(char *)mmalloc(1);
  398.                            *holdem=0;
  399.                          }
  400.                         say_prompt(helpnum);
  401.                         safe=tempsafe;
  402. AfterWentAway:
  403.                         *geninput=0;
  404.                         if(holdem) {
  405.                            strcpy(geninput,holdem);
  406.                            ffree(holdem);
  407.                            x=strlen(geninput);
  408.                            if(type==PHONE) printm("(");
  409.                            for(y=0;y<x+1;y++) {
  410.                              if (type==PHONE) {
  411.                                if (y==6) printm("-");
  412.                                else if (y==3) printm(")");
  413.                              }
  414.                              if (type==DATE && (y==2 || y==4)) printm("/");
  415.                              if(y==x) break;
  416.                              if(password) gprintf(0,"%c",(char)(random(10)+33));
  417.                              else gprintf(0,"%c",geninput[y]);
  418.                            }
  419.                            one=0;
  420.                         }
  421.                         start=getxbbstime();
  422.                         lastprompt=templast;
  423.                         goto Continue;
  424.             case 'N':
  425.             case 27:    say_prompt(463);
  426.                         break;
  427.             default:    printm("\x7");
  428.                         goto ReHelp;
  429.         }
  430.         safe=tempsafe;
  431.         continue;
  432.    }
  433.    if (!disablesub && safe && !leaving) if (*conf.subkey[0]) {
  434.         for (y=0;y<10;y++) {
  435.             if(*conf.subkey[y]==0) break;
  436.             if(one==*conf.subkey[y]) {
  437.                disablesub=1;
  438.                if(*geninput) {
  439.                    holdem=(char *)mmalloc(strlen(geninput)+1);
  440.                    if(holdem) strcpy(holdem,geninput);
  441.                }
  442.                else {
  443.                    holdem=(char *)mmalloc(1);
  444.                    *holdem=0;
  445.                }
  446.                readfile(conf.subfile[y],0,0,1);
  447.                disablesub=0;
  448.                say_prompt(423);
  449.                goto AfterWentAway;
  450.             }
  451.         }
  452.    }
  453.   if (!one) {
  454.     if (((getxbbstime()-start)>(conf.idleseconds-30)) && (!beep) && (!chatted)) {
  455.          printm("\07\07");
  456.          beep++;
  457.     }
  458.     continue;
  459.   }
  460.  
  461. Nogo:
  462.  
  463.   if (type==ARROWS) {
  464.     switch (one) {
  465.         case 1:
  466.         case 2:
  467.         case 3:
  468.         case 4:
  469.         case 5:
  470.         case 201:
  471.         case 209:
  472.         case 27:
  473.         case 11:    *geninput=one;
  474.                     return (geninput);
  475.         case '\r':  *geninput=0;
  476.                     return (geninput);
  477.     }
  478.     if (isprint(one)) {
  479.         *geninput=toupper(one);
  480.         return (geninput);
  481.     }
  482.     continue;
  483.   }
  484.   if (type==ANSIIN) {
  485.     if (!ansi) ansi++;
  486.     switch (one) {
  487.         case '4':
  488.         case 4:
  489.         case 1:     if (ansi==1) ansi=length+1;
  490.                     else ansi--;
  491.                     sprintf(geninput,"%hu",ansi);
  492.                     return (geninput);
  493.         case '6':
  494.         case 5:
  495.         case 2:     if (ansi==length+1) ansi=1;
  496.                     else ansi++;
  497.                     sprintf(geninput,"%hu",ansi);
  498.                     return (geninput);
  499.         case 11:    strcpy(geninput,"0");
  500.                     return (geninput);
  501.         case '\r':    sprintf(geninput,"%hu",ansi);
  502.                     level=1;
  503.                     return (geninput);
  504.     }
  505.     continue;
  506.   }
  507.   if (type==TRUEANSI) {
  508.     switch (one) {
  509.         case 1:     sprintf(geninput,"\x1b[1D");
  510.                     return geninput;
  511.         case 2:     sprintf(geninput,"\x1b[1C");
  512.                     return geninput;
  513.         case 4:     sprintf(geninput,"\x1b[1A");
  514.                     return geninput;
  515.         case 5:     sprintf(geninput,"\x1b[1B");
  516.                     return geninput;
  517.         case 11:    strcpy(geninput,"0");
  518.                     return geninput;
  519.         case '\r':  *geninput=0;
  520.                     return geninput;
  521.     }
  522.     continue;
  523.   }
  524.  
  525.   if (one == '\r') {
  526.       if(type!=YESNOM && !record) {
  527.         keyqueue[keyptr]='|';
  528.         keyptr++;
  529.         if(keyptr==80)keyptr=0;
  530.       }
  531.       break;
  532.   }
  533.  
  534.   if ((one == '\b') || (one == 127)) {
  535.       if (x) {
  536.           if(type!=YESNOM) {
  537.             keyptr--;
  538.             if(!keyptr) keyptr=79;
  539.             keyqueue[keyptr]=0;
  540.           }
  541. /*       memmove(&geninput[pos],geninput[pos+1],strlen(&geninput[pos+1])+1);
  542.          x--;
  543.          if(!user.graphics) printm(BACKSPACE);
  544.          else {
  545.             int xx;
  546.  
  547.             printm(&geninput[pos]);
  548.             printm(" ");
  549.             for(xx=0;xx<strlen(&geninput[pos])+1;xx++) printm("\x1b[1D");
  550.          }
  551. */
  552.          geninput[--x]=0;
  553.          if(!user.graphics) printm(BACKSPACE);
  554.          else {
  555.             printm("\x1b[1D \x1b[1D");
  556.          }
  557.          if ((type==PHONE) && (x==2 || x==5)) printm(BACKSPACE);
  558.          if ((type==DATE) && (x==1 || x==3)) printm(BACKSPACE);
  559.       }
  560. #ifdef DEBUG
  561.  
  562.  printf("\x1b[s\x1b[1;1H\x1b[K%s\n\x1b[K%d\x1b[u",geninput,x);
  563.  
  564.  #endif
  565.       continue;
  566.   }
  567.   if (caps || type==YESNO || type==YESNOM || type==YESNOQ || type==BITS) one=toupper(one);
  568.   if (x <= length) {
  569.       if(type==ANY || type==ANYNOECHO) goto BreakOutOfIt;
  570.       if(type==HYPER) {
  571.          if ((one==27 || one==11) || (user.ansimenus && one<6 && one!=3)) goto BreakOutOfIt;
  572.       }
  573.       if(type==BITS) {
  574.         if(one==' ') one='-';
  575.         if(one!='-' && one!='X') continue;
  576.       }
  577.       if (type==NAME) {
  578.         if(conf.genphone && strchr("{}[]|",one)) goto SpecOK;
  579.         if(!isalpha(one) && !strchr(" .-\'",one)) continue;
  580.         if (!conf.genphone) {
  581.             if (one==' ' && strchr(geninput,' ')) continue;
  582.         }
  583.       }
  584.       if (type==NEAT) {
  585.         if((!isalnum(one) && one!=' ')) continue;
  586.       }
  587. SpecOK:
  588.       if(type==NAME || type==NEAT) {
  589.         if(!x) {
  590.             if(one==' ') continue;
  591.             one=toupper(one);
  592.         }
  593.         else {
  594.             if(one==' ' && geninput[x-1]==' ') continue;
  595.             if (strchr(" .-\'",geninput[x-1])) one=toupper(one);
  596.             else one=tolower(one);
  597.         }
  598.       }
  599.       if (type==WORD && !isalpha(one)) continue;
  600.       if (type==WORDNUM && !isalnum(one)) continue;
  601.       if (type==SUBJECT && !x) one=toupper(one);
  602.       if ((type==ALLL || type==SUBJECT) && !isprint(one)) continue;
  603.       if (type==ALPHA && !isalpha(one) && one!=' ') continue;
  604.       if ((type==NUM || type==PHONE || type==DATE) && !isdigit(one)) continue;
  605.       if (type==ALPHANUM && !isalnum(one) && one!=' ') continue;
  606.       if ((type==YESNO || type==YESNOM) && (one!='Y' && one!='N')) continue;
  607.       if (type==YESNOQ && !strchr("YNQ",one)) continue;
  608.       if (type==FLE) {
  609.          if (!isalnum(one) && !strchr("._-+=!@#$%^&<>{}[]",one)) continue;
  610.       }
  611.       if (type==FBATCH) {
  612.          if (!isalnum(one) && !strchr(" ._-+=!@#$%^&<>{}[]",one)) continue;
  613.       }
  614.       if (type==FBATCHW) {
  615.          if (!isalnum(one) && !strchr(" ._-+=!@#$%^&<>?*{}[]",one)) continue;
  616.       }
  617.       if (type==FBATCHWP) {
  618.          if (!isalnum(one) && !strchr(" ._-+=!@#$%^&<>?*\\{}[]",one)) continue;
  619.       }
  620.       if (type==FBATCHP) {
  621.          if (!isalnum(one) && !strchr(" ._-+=!@#$%^&<>\\{}[]",one)) continue;
  622.       }
  623.       if (type==FLEX) {
  624.          if (!isalnum(one) && !strchr("_-+=!@#$%^&<>{}[]",one)) continue;
  625.       }
  626.       if (type==FLEP) {
  627.          if (!isalnum(one) && !strchr("._-+=!@#$%^&<>\\:{}[]",one)) continue;
  628.       }
  629.       if (type==FLEW) {
  630.           if (!isalnum(one) && !strchr("._-+=!@#$%^&<>?*{}[]",one)) continue;
  631.       }
  632.       if (type==FLEPW) {
  633.        if (!isalnum(one) && !strchr("._-+=!@#$%^&<>?*\\:{}[]",one)) continue;
  634.       }
  635.       if ((type==FLE) || (type==FLEP) || (type==FLEW) || (type==FLEPW)) {
  636.          if (one=='.') {
  637.             if(strchr(geninput,'.')) continue;
  638.          }
  639.       }
  640. BreakOutOfIt:
  641. ;
  642.     }
  643.     if (one && x <= length) {
  644.       if(type!=YESNOM && one && !record) {
  645.         keyqueue[keyptr]=one;
  646.         keyptr++;
  647.         if(keyptr==80)keyptr=0;
  648.       }
  649.       geninput[x]=one;
  650.       x++;
  651.       geninput[x]=0;     /* Gotta change for ANSI users... */
  652.  
  653. #ifdef DEBUG
  654.  
  655.  printf("\x1b[s\x1b[1;1H\x1b[K%s\n\x1b[K%d\x1b[u",geninput,x);
  656.  
  657.  #endif
  658.  
  659.       if (type==THRU || type==YESNOM || type==HYPER) return(geninput);
  660.       if (!password) {
  661.         if(type!=ANYNOECHO) gprintf(0,"%c",geninput[x-1]);
  662.       }
  663.       else if (type!=ANYNOECHO) {
  664.           gprintf(0,"%c",(char)(random(10)+33));
  665.       }
  666. /*    if(!user.graphics) {  */
  667.           if (type==PHONE) {
  668.             if (x==6) printm("-");
  669.             else if (x==3) printm(")");
  670.           }
  671.           if (type==DATE && (x==2 || x==4)) printm("/");
  672. /*    }     */
  673.       if (hot && x >= length) return (geninput);
  674.       start=getxbbstime();
  675.     }
  676.   }
  677.   if (((getxbbstime()-start)>conf.idleseconds) && !chatted && !timer_off) {
  678.       say_prompt(192);
  679.       user.violations++;
  680.       fossil(FLUSHOUT,0);
  681.       fossil(DTR,DOWN);
  682.       logoff();
  683.       baud=0;
  684.       userno=0;
  685.       exit(254);
  686.   }
  687.   if (chatted) {
  688.         chatted=0;
  689.         if (one!='\r') goto AfterChat;
  690.   }
  691.   return (geninput);
  692. }
  693.  
  694.  
  695.  
  696. char pascal specialmod (void) {
  697.  
  698.  char arg;
  699.  int register x;
  700.  
  701.       for (x=0;x<256;x++) {
  702.           arg=carrchk();
  703.           if (arg & 1) break;
  704.       }
  705.       if (!(arg & 1)) return 0;
  706.       arg=(fossil(RECVWAIT,arg));
  707.       if (arg!='[') return 27;
  708.       for (x=0;x<256;x++) {
  709.           arg=carrchk();
  710.           if (arg & 1) break;
  711.       }
  712.       if (!(arg & 1)) return 27;
  713.       arg=(fossil(RECVWAIT,arg));
  714.       if ((arg!='1') && (arg!='C') && (arg!='D') && (arg!='A') && (arg!='B')) return 27;
  715.       if (arg=='C') return 2;
  716.       if (arg=='D') return 1;
  717.       if (arg=='A') return 4;
  718.       if (arg=='B') return 5;
  719.       for (x=0;x<256;x++) {
  720.           arg=carrchk();
  721.           if (arg & 1) break;
  722.       }
  723.       if (!(arg & 1)) return 27;
  724.       arg=(fossil(RECVWAIT,arg));
  725.       if ((arg!='C') && (arg!='D') && (arg!='A') && (arg!='B')) return 27;
  726.       if (arg=='C') return 2;
  727.       if (arg=='D') return 1;
  728.       if (arg=='A') return 4;
  729.       if (arg=='B') return 5;
  730.  
  731.       return 27;
  732. }
  733.  
  734.  
  735. void pascal sysop_shell (void) {
  736.  
  737.      int  drive;
  738.      char dir[MAXDIR];
  739.      char middle[133];
  740.  
  741.     if (readfile("jumpout.xbs",0,0,1)==2) say_prompt(3);
  742.     fossil(FLUSHOUT,0);
  743.     drive=getdisk();
  744.     getcurdir(++drive,dir);
  745.     fossil(DEINIT,0);
  746.     adjust_time(0);
  747.     say_prompt(4);
  748.     fputs("\x1b[2J",stdout);
  749.     if (conf.swap) {
  750.  
  751.       char *p;
  752.       char *pp;
  753.  
  754.       p=getenv("COMSPEC");
  755.       if (!p) pp=searchpath("COMMAND.COM");
  756.       else pp=searchpath(p);
  757.       if (doswap(pp,"")==(-1)) system("");
  758.     }
  759.     else system("");
  760.     adjust_time(1);
  761.     fossil(INIT,0);
  762.     setdisk (--drive);
  763.     strcpy(middle,"\\");
  764.     strcat(middle,dir);
  765.     chdir(middle);
  766.     chatted=1;
  767.     fputs("\x1b[2J",stdout);
  768.     redraw_stat(NULL);
  769.     if(readfile("jumpback.xbs",0,0,1)==2) say_prompt(5);
  770. }
  771.