home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / UTIL / WWIVE / BBS.C < prev    next >
Text File  |  1992-06-15  |  34KB  |  1,538 lines

  1. /*****************************************************************************
  2.  
  3.                 WWIV Version 4
  4.                     Copyright (C) 1988-1991 by Wayne Bell
  5.  
  6. Distribution of the source code for WWIV, in any form, modified or unmodified,
  7. without PRIOR, WRITTEN APPROVAL by the author, is expressly prohibited.
  8. Distribution of compiled versions of WWIV is limited to copies compiled BY
  9. THE AUTHOR.  Distribution of any copies of WWIV not compiled by the author
  10. is expressly prohibited.
  11.  
  12.  
  13. *****************************************************************************/
  14.  
  15.  
  16. #pragma hdrstop
  17.  
  18. #define _DEFINE_GLOBALS_
  19. #include "vars.h"
  20.  
  21.  
  22. #include <math.h>
  23.  
  24.  
  25. unsigned _stklen=15360;
  26.  
  27. #define modem_time 3.5
  28.  
  29.  
  30.  
  31. int checkpw()
  32. {
  33.   char s[81];
  34.  
  35.   nl();
  36.   prt(1,"SY3: ");
  37.   echo=0;
  38.   input(s,20);
  39.   echo=1;
  40.   if (strcmp(s,(syscfg.systempw))==0)
  41.     return(1);
  42.   else
  43.     return(0);
  44. }
  45.  
  46.  
  47.  
  48. void end_bbs(int lev)
  49. {
  50.   sl1(1,"");
  51.   if (ok_modem_stuff)
  52.     closeport();
  53.   dtr(0);
  54.   outs(VERSION_NUMBER);
  55.   outs(" run complete.\r\n\r\n");
  56.   exit(lev);
  57. }
  58.  
  59.  
  60. void ansi_sublist()
  61. {
  62.   int ok,i,abort,a,b,sam,tally;
  63.   char s[120],s1[50],s2[81];
  64.  
  65.   abort=0;
  66.   nl();
  67.   pla("9 Num    7Type        1Description                          5New Messages",&abort);
  68.   pla("3╔════╦═══════════╦══════════════════════════════════════════╤═════╗ ",&abort);
  69.   i=0;
  70.   while ((i<32) && (usub[i].subnum!=-1)) { /* Change 64 to 32 if not using */
  71.                        /* Elrics 64 Sub Mod */
  72.     if (i>=1)
  73.       pla(s,&abort);
  74.     if (abort) break;
  75.  
  76.     if (strcmp(usub[cursub].keys,usub[i].keys))
  77.       strcpy(s1,"Y"); else strcpy(s1,"N");
  78.  
  79.     if (strcmp(s1,"Y"))
  80.       strcpy(s,"3║ 9");
  81.     else
  82.       strcpy(s,"3║ 9");
  83.  
  84.     strcat(s,usub[i].keys); s[8]=0;
  85.  
  86.     if (s[7]==0)
  87.       s[8]=32;
  88.     if (i<=8)
  89.       strcat(s," ");
  90.  
  91.     if (strcmp(s1,"Y"))
  92.       strcat(s,"3 ║ "); else strcat(s," 3║ ");
  93.  
  94.     if (strcmp(s1,"Y"))    {
  95.       if (subboards[usub[i].subnum].type)
  96.     strcat(s,"7≡Network≡ 3║ 1");
  97.       else
  98.     strcat(s,"2  ·····   3║ 1");
  99.     } else {
  100.       if (subboards[usub[i].subnum].type)
  101.     strcat(s,"7≡Network≡ 3║ 1");
  102.       else
  103.     strcat(s,"2  ·····   3║ 1");
  104.     }
  105.     if (strcmp(subboards[usub[i].subnum].name,"THISUSER")==0) {
  106.       strcat(s,thisuser.realname);
  107.       strcat(s,"'s Sub ");
  108.     } else
  109.       strcat(s,subboards[usub[i].subnum].name);
  110.       a=(72-(strlen(s)));
  111.       for (b=0; b<a; b++) strcat(s," ");
  112.       if (strcmp(s1,"Y")) strcat(s,"3│5 "); else strcat(s,"3│5 ");
  113.       iscan(i);
  114.       sam=1;
  115.       while ((sam<=nummsgs) && (msgs[sam].qscan<=thisuser.qscnptr[usub[i].subnum]))
  116.     ++sam;
  117.       sam=sam-1;
  118.       tally=nummsgs-sam;
  119.       strcat(s,(itoa(tally,s2,10)));
  120.       a=(81-(strlen(s)));
  121.       for (b=0;b<a;b++)
  122.     strcat(s," ");
  123.       if (strcmp(s1,"Y"))
  124.     strcat(s," 3║6You're here!");
  125.       else
  126.     strcat(s," 3║");
  127.       i++;}
  128.     pla(s,&abort);
  129.     pla("3╚════╩═══════════╩══════════════════════════════════════════╧═════╝ ",&abort);
  130.     if (i==0) pla("1None.",&abort);
  131.     nl();
  132. }
  133.  
  134. void sublist()
  135. {
  136.   int i,abort;
  137.   char s[80];
  138.  
  139.   if (thisuser.sysstatus & sysstatus_ansi) {
  140.     ansi_sublist();
  141.   } else {
  142.   abort=0;
  143.   nl();
  144.   pla("Subs available: ",&abort);
  145.   nl();
  146.   i=0;
  147.   while ((i<32) && (usub[i].subnum!=-1)) { /* Change 64 to 32 in not */
  148.     strcpy(s,usub[i].keys);                /* using Elrics 64 Sub Mod */
  149.     s[2]=0;
  150.     if (s[1]==0)
  151.       s[1]=32;
  152.     strcat(s," - ");
  153.     if (syscfg.systemnumber)
  154.       if (subboards[usub[i].subnum].type)
  155.         strcat(s,"<NET> ");
  156.       else
  157.         strcat(s,"      ");
  158.     strcat(s,subboards[usub[i].subnum].name);
  159.     pla(s,&abort);
  160.     i++;
  161.   }
  162.   if (i==0)
  163.     pla("None.",&abort);
  164.   nl();
  165.   }
  166. }
  167.  
  168.  
  169. void dirlist()
  170. {
  171.   int i,abort;
  172.   char s[80];
  173.   abort=0;
  174.   nl();
  175.   pl("3╒═════════════════════════════════════════╕");
  176.   pla("3│          1«3«7«1Dirs available7»3»1»5           3│ ",&abort);
  177.   pl("3╘═════════════════════════════════════════╛");
  178.   i=0;
  179.   while ((i<MAX_DIRS) && (udir[i].subnum!=-1)) {
  180.     sprintf(s,"5[3%2s5]7 -1 %s",udir[i].keys, directories[udir[i].subnum].name);
  181.     pla(s,&abort);
  182.     i++;
  183.   }
  184.   if (i==0)
  185.     pla("3None1.",&abort);
  186.   nl();
  187. }
  188.  
  189.  
  190. void text_edit()
  191. {
  192.   char s[81],s1[81];
  193.  
  194.   nl();
  195.   prt(3,"What's the filename1? ");
  196.   mpl(12);
  197.   input(s,12);
  198.   if (strstr(s,".LOG")!=NULL)
  199.     s[0]=0;
  200.   if (s[0]) {
  201.     sprintf(s1,"@ Edited: %s",s);
  202.     sysoplog(s1);
  203.     if (okfsed())
  204.       external_edit(s,syscfg.gfilesdir,thisuser.defed-1,500);
  205.     else
  206.       tedit(s);
  207.   }
  208. }
  209.  
  210.  
  211. void send_email()
  212. {
  213.   char s1[81],*ss;
  214.   int i,sy,un;
  215.  
  216.   nl();
  217.   nl();
  218.   pl("7Enter user's name or number1.");
  219.   helpl=14;
  220.   outstr("5:");
  221.   input(s1,40);
  222.   helpl=0;
  223.   irt[0]=0;
  224.   irt_name[0]=0;
  225.   un=0;
  226.   sy=0;
  227.   ss=strchr(s1,'@');
  228.   if (ss==NULL) {
  229.     un=finduser1(s1);
  230.     if (un>0)
  231.       email(un,sy,0,0);
  232.     else
  233.       pl("3Don't know1 '3em1.");
  234.   } else {
  235.     ss[0]=0;
  236.     ss=&(ss[1]);
  237.     i=strlen(s1);
  238.     while ((i>0) && (s1[i-1]==' '))
  239.       --i;
  240.     s1[i]=0;
  241.     un=atoi(s1);
  242.     sy=atoi(ss);
  243.     if ((un<0) || (sy<=0) || (sy==syscfg.systemnumber)) {
  244.       un=finduser1(s1);
  245.       if (un>0)
  246.     email(un,0,0,0);
  247.       else
  248.     pl("3Don't know1 '3em1.");
  249.     } else {
  250.       if (un==0) {
  251.         strcpy(net_email_name,s1);
  252.         i=strlen(net_email_name);
  253.         while ((i>0) && (net_email_name[i-1]==' '))
  254.           --i;
  255.         net_email_name[i]=0;
  256.         if (net_email_name[0])
  257.           email(un,sy,0,0);
  258.       } else
  259.         email(un,sy,0,0);
  260.     }
  261.   }
  262. }
  263.  
  264. void feedback()
  265. {
  266.   char ch,s1[80];
  267.  
  268.   nl();
  269.   printmenu(16);
  270.   ansic(1);
  271.   outstr("1() 3The Devil's Doorknob Feedback 1(> ");  /*  The name of your bbs here */
  272.   ch=onek("1234567EMQ");         /*  Make sure each CASE '?' is listed here */
  273.   switch(ch) {
  274.     case '1':
  275.        strcpy(irt,"Feedback to Goddess");                    /*  This is your account  */
  276.        email(1,0,0,0);
  277.       break;
  278.     case '2':
  279.        strcpy(irt,"Feedback to God");   /*  These will be the RE:s */
  280.        email(2,0,0,0);
  281.       break;
  282.     case '3':
  283.        strcpy(irt,"Feedback to Remote SysOp ");
  284.        email(4,0,0,0);                  /*  Change 1st number to account #  */
  285.        break;
  286.     case '4':
  287.        strcpy(irt,"Net Coordinator Feedback ");
  288.        email(7,0,0,0);
  289.       break;
  290.     case '5':
  291.        strcpy(irt,"Feedback to Sysop that does nothing ");
  292.        email(56,0,0,0);
  293.     case 'Q':
  294.        break;
  295.   }
  296. }
  297.  
  298. void mainmenu()
  299. {
  300.   char *s, s1[81],s2[81];
  301.   int i;
  302.   long l;
  303.  
  304.   if ((sysstatus_expert & thisuser.sysstatus)==0)
  305.     printmenu(0);
  306.  
  307.   nl();
  308.   nl();
  309.   tleft(1);
  310.   npr("1Post7/1Call Ratio 3%-5.3f\r\n",post_ratio(),syscfg.post_call_ratio);
  311.   npr("7[1T7]1 -3 %s\r\n",ctim(nsl()));
  312.   s1[0]=0;
  313.   if (usub[cursub].subnum==-1) {
  314.     cursub=0;
  315.     if (usub[cursub].subnum==-1) {
  316.       strcpy(s1,"7[] 1No Subs Available5 :");
  317.     }
  318.   }
  319.   if (s1[0]==0)
  320.     sprintf(s1,"7[1%s7] [1%s7] 3:",usub[cursub].keys,subboards[usub[cursub].subnum].name);
  321.   prt(7,s1);
  322.   helpl=1;
  323.   s=mmkey(0);
  324.   helpl=0;
  325.   if (s[0])
  326.     for (i=0; i<MAX_SUBS; i++)
  327.       if (strcmp(usub[i].keys,s)==0)
  328.         cursub=i;
  329.   sysopchar(s);
  330. /**************************************************/
  331.   if (so()) {
  332.     if (strcmp(s,"BOARDEDIT")==0) {
  333.       sysoplog("@ Ran Boardedit");
  334.       boardedit();
  335.     }
  336.     if (strcmp(s,"DIREDIT")==0) {
  337.       sysoplog("@ Ran Diredit");
  338.       dlboardedit();
  339.     }
  340.     if (strcmp(s,"CHAINEDIT")==0) {
  341.       sysoplog("@ Ran Chainedit");
  342.       chainedit();
  343.     }
  344.     if (strcmp(s,"GFILEEDIT")==0) {
  345.       sysoplog("@ Ran Gfileedit");
  346.       gfileedit();
  347.     }
  348.     if (strcmp(s,"DOS")==0) {
  349.       if (checkpw()) {
  350.     sysoplog("@ Molested DOS");
  351. #ifdef OLD_STUFF
  352.         full_external(getenv("COMSPEC"),1,0);
  353. #else
  354.         shrink_out(getenv("COMSPEC"),1,1,1,0);
  355. #endif
  356.         topscreen();
  357.       }
  358.     }
  359.     if (strcmp(s,"RESETF")==0) {
  360.       reset_files();
  361.     }
  362.     if ((strcmp(s,"REBOOT")==0) && (checkpw())) {
  363.       dtr(0);
  364.       sysoplog("@ Reset the computer");
  365.       logoff();
  366.       sl1(1,"");
  367.       if (ok_modem_stuff)
  368.         closeport();
  369.       setvect(INT_SAVE_21,(void interrupt (*) ()) MK_FP(0xffff,0x0000));
  370.       geninterrupt(INT_SAVE_21);
  371.     }
  372.     if (strcmp(s,"RELOAD")==0) {
  373.       read_new_stuff();
  374.     }
  375.     if ((strcmp(s,"EDIT")==0)) {
  376.       nl();
  377.       prt(1,"What's the filename5? ");
  378.       input(s1,50);
  379.       if (s1[0]) {
  380.         if ((okansi()) && (thisuser.defed))
  381.           external_edit(s1,"",thisuser.defed-1,500);
  382.         else
  383.           tedit(s1);
  384.       }
  385.     }
  386.     if (strcmp(s,"LOAD")==0) {
  387.       nl();
  388.       prt(1,"What's the filename5? ");
  389.       input(s1,50);
  390.       if (s1[0]) {
  391.         nl();
  392.     prt(3,"You wanna edit1? ");
  393.     if (yn()) {
  394.       nl();
  395.       load_workspace(s1,0);
  396.     } else {
  397.       nl();
  398.       load_workspace(s1,1);
  399.     }
  400.       }
  401.     }
  402.     if (strcmp(s,"CHUSER")==0) {
  403.       chuser();
  404.     }
  405.     if (strcmp(s,"STAT")==0) {
  406.       nl();
  407.       npr("1Stack size7:5 %d\r\n",_stklen);
  408.       npr("1Heap free7 :5 %dk\r\n", (int) (farcoreleft()/1024));
  409.       nl();
  410.     }
  411.     if (strcmp(s,"MAILR")==0) {
  412.       if (checkpw()) {
  413.         sysoplog("@ Read all mail");
  414.         mailr();
  415.       }
  416.     }
  417.     if (strcmp(s, "CHAT")==0) {
  418.       nl();
  419.       pl(((*(char far *)0x00000417L ^= 0x10) & 0x10) ?
  420.                "1You Bama3! 1Your gonna bother me3?" :
  421.                "3Sysop now unavailable");
  422.       sysoplog("@ Changed sysop avail status");
  423.       topscreen();
  424.     }
  425.   }
  426. /**************************************************/
  427.   if (cs()) {
  428.     if (strcmp(s,"PENDING")==0) {
  429.       print_pending_list();
  430.     }
  431.     if (strcmp(s,"VOTEPRINT")==0) {
  432.       voteprint();
  433.     }
  434.     if (strcmp(s,"LOG")==0) {
  435.       sl1(3,s1);
  436.       printfile(s1);
  437.     }
  438.     if (strcmp(s,"YLOG")==0) {
  439.       printfile(status.log1);
  440.     }
  441.     if (strcmp(s,"NLOG")==0) {
  442.       printfile("NET.LOG");
  443.     }
  444.     if (strcmp(s,"UEDIT")==0) {
  445.       sysoplog("@ Ran Uedit");
  446.       uedit(usernum,0);
  447.     }
  448.     if (strcmp(s,"STATUS")==0) {
  449.       prstatus();
  450.     }
  451.     if (strcmp(s,"IVOTES")==0) {
  452.       sysoplog("@ Ran Ivotes");
  453.       ivotes();
  454.     }
  455.     if (strcmp(s,"ZLOG")==0) {
  456.       zlog();
  457.     }
  458.     if (strcmp(s,"TEDIT")==0) {
  459.       sysoplog("@ Ran Tedit");
  460.       text_edit();
  461.     }
  462.     if (strcmp(s,"/?")==0) {
  463.       printmenu(5);
  464.     }
  465.   }
  466. /*************************************************/
  467.   if ((strcmp(s,"UPLOAD")==0) && (actsl>10))
  468.     upload_post();
  469.   if (strcmp(s,"QSCAN")==0) {
  470.     nl();
  471.     prt(6,"Clear Q-Scan pointers? ");
  472.     if (yn()) {
  473.       for (i=0; i<33; i++)
  474.         thisuser.qscnptr[i]=status.qscanptr-1L;
  475. #if MAX_SUBS>32
  476.       for (i=0; i<MAX_SUBS-32; i++)
  477.         thisuser.qscnptr2[i]=status.qscanptr-1L;
  478. #endif
  479.       nl();
  480.       pl("6Q-Scan pointers cleared.");
  481.       nl();
  482.     }
  483.   }
  484.   if (strcmp(s,"CLS")==0)
  485.     outstr("\x0c");
  486.   if (strcmp(s,"/O")==0)
  487.     hangup=1;
  488.   if (strcmp(s,"/E")==0)
  489.     slash_e();
  490.   if (strcmp(s,"/N")==0)
  491.     nscan(cursub);
  492.   if (strcmp(s,"NET")==0)
  493.     print_net_listing(0);
  494.   if (strncmp(s,"NET=",4)==0) {
  495.     print_net_listing(atoi(s+4));
  496.   }
  497.   if (strcmp(s,"RSET")==0) {
  498.     for (i=0; i<MAX_SUBS; i++)
  499.       sub_dates[i]=0L;
  500.   }
  501.   if (strcmp(s,"VER")==0) {
  502.     nl();
  503.     pl(VERSION_NUMBER);
  504.     nl();
  505.     pl("1The author may be contacted at3:");
  506.     nl();
  507.     pl("  1 Wayne Bell");
  508.     pl("   1904 Silver Spur Road #636");
  509.     pl("   1Rolling Hills Estates, CA  90274");
  510.     nl();
  511.   }
  512.   if ((s[1]==0) && (s[0]!=0)) {
  513.     switch(s[0]) {
  514.       case '>':
  515.       case '+':
  516.         if ((cursub<MAX_SUBS-2) && (usub[cursub+1].subnum>=0))
  517.           ++cursub;
  518.         else
  519.           cursub=0;
  520.         break;
  521.       case '<':
  522.       case '-':
  523.         if (cursub>0)
  524.           --cursub;
  525.         else {
  526.           while ((usub[cursub+1].subnum>=0) && (cursub<MAX_SUBS-1))
  527.             ++cursub;
  528.         }
  529.         break;
  530.       case '!':
  531.         helpl=14;
  532.         if (!cs())
  533.           return;
  534.         nl();
  535.         nl();
  536.     pl("7Enter user's name or number1.");
  537.     outstr("5:");
  538.     input(s1,30);
  539.     i=finduser1(s1);
  540.     if (i>0) {
  541.       sysoplog("@ Validated user");
  542.       valuser(i);
  543.     } else
  544.       pl("3Don't know 'em1.");
  545.     break;
  546.       case '.':
  547.     if (thisuser.ass_pts>=15){
  548.     npr("1You have too many cass 1points to play games");
  549.     break;}
  550.     game_ratio();
  551.     break;
  552.       case 'A':
  553.         helpl=19;
  554.         write_automessage();
  555.         break;
  556.       case 'B':
  557.         helpl=25;
  558.         bbslist();
  559.         break;
  560.       case 'C':
  561.         helpl=3;
  562.         reqchat();
  563.         break;
  564.       case 'D':
  565.         helpl=4;
  566.         defaults();
  567.         break;
  568.       case 'E':
  569.         send_email();
  570.         break;
  571.       case 'F':
  572.     strcpy(irt,"3Feedback1.");
  573.     feedback();
  574.     break;
  575.       case 'G':
  576.         helpl=28;
  577.         gfiles();
  578.         break;
  579.       case 'I':
  580.         nl();
  581.         pl(VERSION_NUMBER);
  582.         nl();
  583.         printfile("LOGON");
  584.         printfile("SYSTEM");
  585.         break;
  586.       case 'K':
  587.         helpl=8;
  588.         kill_old_email();
  589.         break;
  590.       case 'L':
  591.     pl("5╔═══════════════════════════════════════╗");
  592.     pl("5║7Call #       3Alias            7Baud    2#5║");
  593.     pl("5╚═══════════════════════════════════════╝");
  594.     printfile("USER.LOG");
  595.     pl("5═════════════════════════════════════════");
  596.         break;
  597.       case 'M':
  598.         if (thisuser.waiting>0) {
  599.           readmail();
  600.         } else {
  601.           nl();
  602.       pl("7Haha1!7 You have no Mail1!");
  603.       nl();
  604.     }
  605.     break;
  606.       case 'N':
  607.         express=0;
  608.         expressabort=0;
  609.         nscan(0);
  610.         break;
  611.       case 'O':
  612.         nl();
  613.         nl();
  614.     prt(3,"Leaving so soon1? ");
  615.     helpl=12;
  616.     if (yn()) {
  617.       outchr(12);
  618.       npr("Time on   = %s\r\n",ctim(timer()-timeon));
  619.       printfile("LOGOFF");
  620.       hangup=1;
  621.     }
  622.     break;
  623.       case 'P':
  624.         irt[0]=0;
  625.         irt_name[0]=0;
  626.         if (usub[0].subnum!=-1)
  627.           post();
  628.         break;
  629.       case 'Q':
  630.         i=0;
  631.         express=0;
  632.         expressabort=0;
  633.         qscan(cursub,&i);
  634.         break;
  635.       case 'R':
  636.         helpl=15;
  637.         remove_post();
  638.         break;
  639.       case 'S':
  640.         express=0;
  641.         expressabort=0;
  642.         scan2();
  643.         break;
  644.       case 'T':
  645.     if (thisuser.ass_pts>=15){
  646.     npr("1You have too many cass 1points to transfer");
  647.     break;}
  648.     printmenu(15);
  649.         if (syscfg.sysconfig & sysconfig_no_xfer) {
  650.           nl();
  651.       pl("6Sorry, the transfer section has been closed by the sysop.");
  652.       nl();
  653.       break;
  654.     }
  655.     if (udir[0].subnum!=-1)
  656.       curdloads=1;
  657.     else {
  658.       nl();
  659.       pl("6Sorry, you can't get to the files.");
  660.       nl();
  661.     }
  662.     break;
  663.       case 'U':
  664.         list_users();
  665.         break;
  666.       case 'V':
  667.         helpl=18;
  668.         vote();
  669.         break;
  670.       case 'X':
  671.         thisuser.sysstatus ^= sysstatus_expert;
  672.         break;
  673.       case 'Y':
  674.         yourinfo();
  675.         break;
  676.       case 'Z':
  677.         express=1;
  678.         expressabort=0;
  679.         l=thisuser.sysstatus;
  680.         if (l & sysstatus_pause_on_page)
  681.           thisuser.sysstatus ^= sysstatus_pause_on_page;
  682.         nscan(0);
  683.         express=0;
  684.         expressabort=0;
  685.         thisuser.sysstatus=l;
  686.         break;
  687.       case '?':
  688.         if ((sysstatus_expert & thisuser.sysstatus))
  689.           printmenu(0);
  690.         break;
  691.       case '*': sublist(); break;
  692.     }
  693.   }
  694.   helpl=0;
  695. }
  696.  
  697.  
  698. void dlmainmenu()
  699. {
  700.   char *s, s1[81],s2[81],ch;
  701.   int i,i1,i2,abort,next;
  702.   messagerec m;
  703.  
  704.   if ((sysstatus_expert & thisuser.sysstatus)==0)
  705.     printmenu(3);
  706.  
  707.   nl();
  708.   nl();
  709.   tleft(1);
  710.   npr("1Post7/1Call Ratio 3%-5.3f\r\n",post_ratio(),syscfg.post_call_ratio);
  711.   npr("7[1T7]1 -3 %s\r\n",ctim(nsl()));
  712.   s1[0]=0;
  713.   if (udir[curdir].subnum==-1) {
  714.     curdir=0;
  715.     if (udir[curdir].subnum==-1) {
  716.       strcpy(s1,"7() 1No Dirs Available3 :");
  717.       curdloads=0;
  718.       return;
  719.     }
  720.   }
  721.   if (s1[0]==0)
  722.     sprintf(s1,"7[1%s7]1-7[1%s7]3 :",udir[curdir].keys,directories[udir[curdir].subnum].name);
  723.   prt(3,s1);
  724.   helpl=2;
  725.   s=mmkey(1);
  726.   helpl=0;
  727.   if (s[0])
  728.     for (i=0; i<64; i++)
  729.       if (strcmp(udir[i].keys,s)==0)
  730.         curdir=i;
  731.   sysopchar(s);
  732.   if (strcmp(s,"/O")==0)
  733.     hangup=1;
  734.   if ((strcmp(s,"/?")==0) && (dcs()))
  735.     printmenu(8);
  736.   if ((strcmp(s,"UPLOADALL")==0) && (dcs())) {
  737.     i1=0;
  738.     for (i=0; (i<64) && (udir[i].subnum>=0) && (!i1); i++) {
  739.       nl();
  740.       nl();
  741.       outstr("3Now uploading files for1: ");
  742.       pl(directories[udir[i].subnum].name);
  743.       nl();
  744.       i1=uploadall(udir[i].subnum);
  745.     }
  746.   }
  747.   if ((strcmp(s,"UPLOAD")==0) && (dcs()))
  748.     uploadall(udir[curdir].subnum);
  749.   if ((strcmp(s,"UPLOADFILE")==0) && (so())) {
  750.     nl();
  751.     pl("1. PCB, RBBS   - <filename> <size> <date> <description>");
  752.     pl("2. QBBS format - <filename> <description>");
  753.     nl();
  754.     prt(5,"Which format (1,2,Q) ? ");
  755.     ch=onek("Q12");
  756.     nl();
  757.     if (ch!='Q') {
  758.       outstr("1What's the filename3? ");
  759.       inputl(s2,80);
  760.       switch(ch) {
  761.         case '1': i2=2; break;
  762.         case '2': i2=0; break;
  763.         default : i2=0; break;
  764.       }
  765.       upload_files(s2,udir[curdir].subnum,i2);
  766.     }
  767.   }
  768.   if ((strcmp(s,"REN")==0) && (dcs())) {
  769.     helpl=39;
  770.     rename_file();
  771.   }
  772.   if ((strcmp(s,"MOVE")==0) && (dcs()))
  773.     move_file();
  774.   if ((strcmp(s,"SORT")==0) && (dcs())) {
  775.     nl();
  776.     prt(6,"Sort all dirs? ");
  777.     i=yn();
  778.     nl();
  779.     prt(6,"Sort by date? ");
  780.     if (yn())
  781.       i1=2;
  782.     else
  783.       i1=0;
  784.     if (i)
  785.       sort_all(i1);
  786.     else
  787.       sortdir(udir[curdir].subnum,i1);
  788.   }
  789.   if ((strcmp(s,"RSORT")==0) && (dcs())) {
  790.     sort_all(1);
  791.   }
  792.   if ((strcmp(s,"DIREDIT")==0) && (so())) {
  793.     sysoplog("@ Ran Diredit");
  794.     dlboardedit();
  795.   }
  796.   if ((strcmp(s,"DOS")==0) && (so())) {
  797.     if (checkpw()) {
  798.       sysoplog("@ Molested DOS");
  799. #ifdef OLD_STUFF
  800.       full_external(getenv("COMSPEC"),1,0);
  801. #else
  802.       shrink_out(getenv("COMSPEC"),1,1,1,0);
  803. #endif
  804.       topscreen();
  805.     }
  806.   }
  807.  
  808.   if ((s[1]==0) && (s[0]!=0)) {
  809.     switch(s[0]) {
  810.       case '>':
  811.       case '+':
  812.         if ((curdir<MAX_DIRS-2) && (udir[curdir+1].subnum>=0))
  813.           ++curdir;
  814.         else
  815.           curdir=0;
  816.         break;
  817.       case '<':
  818.       case '-':
  819.         if (curdir>0)
  820.           --curdir;
  821.         else {
  822.           while ((udir[curdir+1].subnum>=0) && (curdir<MAX_DIRS-1))
  823.             ++curdir;
  824.         }
  825.         break;
  826.       case '*': dirlist(); break;
  827.       case 'Q': curdloads=0; break;
  828.       case '.':
  829.         if (dcs()) {
  830.           m.stored_as=0L;
  831.           m.storage_type=255;
  832.           next=0;
  833.           read_message1(&m,0,0,&next,dszlog);
  834.         }
  835.         break;
  836.       case '?':
  837.         if ((sysstatus_expert & thisuser.sysstatus))
  838.           printmenu(3);
  839.         break;
  840.       case 'A':
  841.         helpl=23;
  842.         arc_l();
  843.         break;
  844.       case 'B':
  845.         helpl=22;
  846.         batchdl();
  847.         break;
  848.       case 'C':
  849.         helpl=3;
  850.         reqchat();
  851.         break;
  852.       case 'D':
  853.         helpl=20;
  854.         download();
  855.         break;
  856.       case 'E':
  857.         helpl=29;
  858.         temp_extract();
  859.         break;
  860.       case 'F':
  861.         helpl=21;
  862.         finddescription();
  863.         break;
  864.       case 'G':
  865.         helpl=30;
  866.         temporary_stuff();
  867.         break;
  868.       case 'L':
  869.         listfiles();
  870.         break;
  871.       case 'M':
  872.         helpl=31;
  873.         if (dcs())
  874.           move_file();
  875.         break;
  876.       case 'N':
  877.         abort=0;
  878.         nl();
  879.     prt(6,"Search all directories? ");
  880.     if (yn())
  881.       nscanall();
  882.     else {
  883.       nl();
  884.       nl();
  885.       nl();
  886.       nscandir(curdir,&abort,1);
  887.     }
  888.     break;
  889.       case 'O':
  890.         helpl=12;
  891.         nl();
  892.         nl();
  893.     prt(1,"Leaving so soon3? ");
  894.     if (yn()) {
  895.       outchr(12);
  896.       npr("Time on   = %s\r\n",ctim(timer()-timeon));
  897.       printfile("LOGOFF");
  898.       hangup=1;
  899.     }
  900.     break;
  901.       case 'P':
  902.         helpl=13;
  903.         setldate();
  904.         break;
  905.       case 'R':
  906.         helpl=38;
  907.         removefile();
  908.         break;
  909.       case 'S':
  910.         searchall();
  911.         break;
  912.       case 'T':
  913.         helpl=32;
  914.         xfer_defaults();
  915.         break;
  916.       case 'U':
  917.         helpl=17;
  918.         if ((thisuser.restrict & (restrict_validate | restrict_upload)) ||
  919.             (syscfg.sysconfig & sysconfig_all_sysop)) {
  920.           if (syscfg.newuploads<num_dirs)
  921.             upload((int) syscfg.newuploads);
  922.           else
  923.             upload(0);
  924.         } else
  925.           upload(udir[curdir].subnum);
  926.         break;
  927.       case 'V':
  928.         helpl=23;
  929.         arc_l();
  930.         break;
  931.       case 'X':
  932.         helpl=22;
  933.         batchdl();
  934.         break;
  935.       case 'Y':
  936.         yourinfodl();
  937.         break;
  938.       case 'Z':
  939.         nl();
  940.         nl();
  941.     pl("6Sending file to sysop :-");
  942.     nl();
  943.     helpl=17;
  944.     upload(0);
  945.     break;
  946.     }
  947.   }
  948.   helpl=0;
  949. }
  950.  
  951.  
  952. int date_changed()
  953. {
  954.   struct date today,today1;
  955.  
  956.   getdate(&today);
  957.   getdate(&today1);
  958.   if (today.da_day==today1.da_day)
  959.     return(0);
  960.   else
  961.     return(1);
  962. }
  963.  
  964.  
  965. void print_local_file(char *ss, char *ss1)
  966. {
  967.   char s[81];
  968.   char s1[81];
  969.  
  970.   if (syscfg.sysconfig & sysconfig_list) {
  971.     sprintf(s,"LIST %s%s",syscfg.gfilesdir,ss);
  972.     if (ss1[0]) {
  973.       sprintf(s1,"%s %s%s",s,syscfg.gfilesdir,ss1);
  974.       strcpy(s,s1);
  975.     }
  976.     do_remote(s,1);
  977.   } else {
  978.     printfile(ss);
  979.     nl();
  980.     nl();
  981.     getkey();
  982.   }
  983. }
  984.  
  985.  
  986. void getcaller()
  987. {
  988.   char s[81],s1[81],ch,done,lokb;
  989.   int i,i1,i2,i3,any;
  990.   double d,d1;
  991.   long l,l1;
  992.  
  993.   c_sub=c_dir=0;
  994.  
  995.   frequent_init();
  996.   sl1(1,"");
  997.   imodem(0);
  998.   usernum=0;
  999.   wfc=0;
  1000.   read_user(1,&thisuser);
  1001.   usernum=1;
  1002.   reset_act_sl();
  1003.   fwaiting=thisuser.waiting;
  1004.   if (thisuser.inact & inact_deleted) {
  1005.     thisuser.screenchars=80;
  1006.     thisuser.screenlines=25;
  1007.   }
  1008.   screenlinest=defscreenbottom+1;
  1009.   d=(1.0+timer()) / 102.723;
  1010.   d-=floor(d);
  1011.   d*=10000.0;
  1012.   srand((unsigned int)d);
  1013.   do {
  1014.     any=0;
  1015.     wfc=1;
  1016.     if (date_changed())
  1017.       if (date_changed()) {
  1018.         printf("\n\nClock Corrupted.\n\n");
  1019.         printf("Should put BBS in a batch file like:\n\n");
  1020.         printf("copy con: wwiv.bat\n");
  1021.         printf(":top\n");
  1022.         printf("setclock\n");
  1023.         printf("bbs\n");
  1024.         printf("if errorlevel 1 goto top\n");
  1025.         printf("^Z\n");
  1026.         end_bbs(noklevel);
  1027.       }
  1028.     check_event();
  1029.     if (do_event) {
  1030.       run_event();
  1031.       any=1;
  1032.     }
  1033.     lokb=0;
  1034.     strcpy(curspeed,"KB");
  1035.     if ((!any) && ((rand() % 8000)==0) && (syscfg.systemnumber) &&
  1036.                    (ok_modem_stuff)) {
  1037.       attempt_callout();
  1038.       any=1;
  1039.     }
  1040.     okskey=0;
  1041.     ch=upcase(inkey());
  1042.     if (ch) {
  1043.       any=1;
  1044.       switch(ch) {
  1045.         case '?':
  1046.           if (ok_local()) {
  1047.             printmenu(7);
  1048.             nl();
  1049.             getkey();
  1050.           }
  1051.           break;
  1052.         case ' ':
  1053.           outs("Log on? ");
  1054.           d=timer();
  1055.           while ((!kbhitb()) && (fabs(timer()-d)<60.0));
  1056.           if (kbhitb()) {
  1057.             ch=upcase(getchd1());
  1058.             if (ch=='Y') {
  1059.               outs("Yes\r\n");
  1060.               lokb=1;
  1061.               if ((syscfg.sysconfig & sysconfig_off_hook)==0)
  1062.                 dtr(0);
  1063.             }
  1064.             if ((ch=='F') && (ok_local())) {
  1065.               outs("Fast\r\n\r\n\r\n\r\n\r\n\r\n");
  1066.               read_user(1,&thisuser);
  1067.               reset_act_sl();
  1068.               if (thisuser.inact & inact_deleted) {
  1069.                 out1ch(12);
  1070.                 break;
  1071.               }
  1072.               lokb=2;
  1073.               if ((syscfg.sysconfig & sysconfig_off_hook)==0)
  1074.                 dtr(0);
  1075.             }
  1076.             if (ch==0)
  1077.               getchd1();
  1078.           }
  1079.           if (!lokb)
  1080.             out1ch(12);
  1081.           break;
  1082.         case 'A':
  1083.           if (!ok_modem_stuff)
  1084.             break;
  1085.           answer_phone();
  1086.           break;
  1087.         case 'B':
  1088.           okskey=1;
  1089.           if (ok_local()) {
  1090.             holdphone(1);
  1091.             boardedit();
  1092.             holdphone(0);
  1093.           }
  1094.           okskey=0;
  1095.           break;
  1096.         case 'C':
  1097.           okskey=1;
  1098.           if (ok_local()) {
  1099.             holdphone(1);
  1100.             chainedit();
  1101.             holdphone(0);
  1102.           }
  1103.           okskey=0;
  1104.           break;
  1105.         case 'D':
  1106.           okskey=1;
  1107.           if (ok_local()) {
  1108.             holdphone(1);
  1109.             dlboardedit();
  1110.             holdphone(0);
  1111.           }
  1112.           okskey=0;
  1113.           break;
  1114.         case 'E':
  1115.           okskey=1;
  1116.           if (ok_local()) {
  1117.             holdphone(1);
  1118.             text_edit();
  1119.             holdphone(0);
  1120.           }
  1121.           okskey=0;
  1122.           break;
  1123.         case 'F':
  1124.           if (ok_local()) {
  1125.             holdphone(1);
  1126.             nl();
  1127.             pl("Type \"EXIT\" to return to the BBS");
  1128.             nl();
  1129.             full_external(getenv("COMSPEC"),1,0);
  1130.             out1ch(12);
  1131.             cleanup_net();
  1132.             holdphone(0);
  1133.           }
  1134.           break;
  1135.         case 'G':
  1136.           okskey=1;
  1137.           if (ok_local()) {
  1138.             holdphone(1);
  1139.             gfileedit();
  1140.             holdphone(0);
  1141.           }
  1142.           okskey=0;
  1143.           break;
  1144.         case 'I':
  1145.           okskey=1;
  1146.           if (ok_local()) {
  1147.             holdphone(1);
  1148.             ivotes();
  1149.             holdphone(0);
  1150.           }
  1151.           okskey=0;
  1152.           break;
  1153.         case 'K':
  1154.           if (ok_local()) {
  1155.             usernum=1;
  1156.             useron=1;
  1157.             holdphone(1);
  1158.             okskey=1;
  1159.         prt(1,"Filename ");
  1160.         input(s1,50);
  1161.         load_workspace(s1,0);
  1162.         send_email();
  1163.         okskey=0;
  1164.         useron=0;
  1165.         write_user(1,&thisuser);
  1166.         close_user();
  1167.         cleanup_net();
  1168.         holdphone(0);
  1169.       }
  1170.       break;
  1171.     case 'L':
  1172.       if (ok_local()) {
  1173.         sl1(3,s1);
  1174.         print_local_file(s1,status.log1);
  1175.       }
  1176.       break;
  1177.     case 'M':
  1178.       okskey=1;
  1179.       if (ok_local()) {
  1180.         holdphone(1);
  1181.         mailr();
  1182.         holdphone(0);
  1183.       }
  1184.       okskey=0;
  1185.       break;
  1186.     case 'N':
  1187.       if (ok_local())
  1188.         print_local_file("NET.LOG","");
  1189.       break;
  1190.     case 'P':
  1191.       print_pending_list();
  1192.       break;
  1193.     case 'Q':
  1194.       end_bbs(oklevel);
  1195.       break;
  1196.     case 'R':
  1197.       if (ok_local()) {
  1198.         usernum=1;
  1199.         if (thisuser.waiting) {
  1200.           holdphone(1);
  1201.           okskey=1;
  1202.           readmail();
  1203.           okskey=0;
  1204.           write_user(1,&thisuser);
  1205.           close_user();
  1206.           cleanup_net();
  1207.           holdphone(0);
  1208.         }
  1209.       }
  1210.       break;
  1211.     case 'S':
  1212.       if (ok_local()) {
  1213.         prstatus();
  1214.         getkey();
  1215.       }
  1216.       break;
  1217.     case 'T':
  1218.       if ((ok_local()) && (syscfg.terminal[0])) {
  1219.         if (syscfg.sysconfig & sysconfig_shrink_term)
  1220.           shrink_out(syscfg.terminal,0,0,0,1);
  1221.         else
  1222.           run_external(syscfg.terminal);
  1223.         imodem(0);
  1224.       }
  1225.       break;
  1226.     case 'U':
  1227.       okskey=1;
  1228.       if (ok_local()) {
  1229.         holdphone(1);
  1230.         uedit(1,0);
  1231.         holdphone(0);
  1232.       }
  1233.       okskey=0;
  1234.       break;
  1235.     case 'W':
  1236.       if (ok_local()) {
  1237.         usernum=1;
  1238.         useron=1;
  1239.         holdphone(1);
  1240.         okskey=1;
  1241.         send_email();
  1242.         okskey=0;
  1243.         useron=0;
  1244.         write_user(1,&thisuser);
  1245.         close_user();
  1246.         cleanup_net();
  1247.         holdphone(0);
  1248.       }
  1249.       break;
  1250.     case 'Y':
  1251.       if (ok_local()) {
  1252.         sl1(3,s1);
  1253.         print_local_file(status.log1,s1);
  1254.       }
  1255.       break;
  1256.     case 'Z':
  1257.       if (ok_local()) {
  1258.         zlog();
  1259.         nl();
  1260.         getkey();
  1261.       }
  1262.       break;
  1263.     case '/':
  1264.       if ((syscfg.systemnumber) && (ok_local()))
  1265.         force_callout();
  1266.       break;
  1267.  
  1268.       }
  1269.       if (!incom) {
  1270.         frequent_init();
  1271.         read_user(1,&thisuser);
  1272.         fwaiting=thisuser.waiting;
  1273.         reset_act_sl();
  1274.         usernum=1;
  1275.       }
  1276.       okskey=0;
  1277.     }
  1278.     if ((comhit()) && (ok_modem_stuff) && (!lokb)) {
  1279.       any=1;
  1280.       if (peek1c()==10)
  1281.         get1c();
  1282.       else {
  1283.         outs("* ");
  1284.         if (mode_switch(1.0,0)==mode_ring)
  1285.           answer_phone();
  1286.         else if (modem_mode == mode_con) {
  1287.           incom=outcom=1;
  1288.           if (!(modem_flag & flag_ec))
  1289.             wait1(45);
  1290.           else
  1291.             wait1(2);
  1292.         }
  1293.       }
  1294.     }
  1295.     if (!any) {
  1296.       if (c_sub<num_subs) {
  1297.         if (!sub_dates[c_sub]) {
  1298.           any=1;
  1299.           iscan_hash(c_sub);
  1300.         }
  1301.         c_sub++;
  1302.       } else if (c_dir<num_dirs) {
  1303.         if (!dir_dates[c_dir]) {
  1304.           any=1;
  1305.           dliscan_hash(c_dir);
  1306.         }
  1307.         c_dir++;
  1308.       }
  1309.     }
  1310.   } while ((!incom) && (!lokb) && (!endday));
  1311.   if (lokb)
  1312.     modem_speed = modem_i->defl.modem_speed;
  1313.   using_modem=incom;
  1314.   if (lokb==2)
  1315.     using_modem=-1;
  1316.   okskey=1;
  1317.   if (!endday) {
  1318.     if (modem_mode==mode_fax)
  1319.       sprintf(s,"\x0c""Fax connection at %s...\r\n",curspeed);
  1320.     else
  1321.       sprintf(s,"\x0cLogging on at %s...\r\n",curspeed);
  1322.     outs(s);
  1323.   }
  1324.   wfc=0;
  1325. }
  1326.  
  1327.  
  1328. void gotcaller(unsigned int ms, unsigned int cs)
  1329. {
  1330.   char s[81];
  1331.   double d;
  1332.  
  1333.   frequent_init();
  1334.   com_speed = cs;
  1335.   modem_speed = ms;
  1336.   sl1(1,"");
  1337.   incom=1;
  1338.   outcom=1;
  1339.   read_user(1,&thisuser);
  1340.   reset_act_sl();
  1341.   usernum=1;
  1342.   if (thisuser.inact & inact_deleted) {
  1343.     thisuser.screenchars=80;
  1344.     thisuser.screenlines=25;
  1345.   }
  1346.   screenlinest=25;
  1347.   sprintf(s,"\x0cLogging on at %s...\r\n",curspeed);
  1348.   outs(s);
  1349.   using_modem=1;
  1350.   d=(timer()) / 102.723;
  1351.   d-=floor(d);
  1352.   d*=10000.0;
  1353.   srand((unsigned int)d);
  1354. }
  1355.  
  1356.  
  1357. void main(int argc, char *argv[])
  1358. {
  1359.   char s[81],s1[81],ch;
  1360.   int i,i1,i2;
  1361.   unsigned int ui, us;
  1362.   double dt;
  1363.  
  1364.   strcpy(s,getenv("BBS"));
  1365.   if (strncmp(s,"WWIV",4)==0) {
  1366.     printf("You are already in the BBS, type 'EXIT' instead.\n\n");
  1367.     abort();
  1368.   }
  1369.   already_on=0;
  1370.   endday=0;
  1371.   oklevel=0;
  1372.   noklevel=0;
  1373.   ooneuser=0;
  1374.   no_hangup=0;
  1375.   ok_modem_stuff=1;
  1376.   if (exist("restore.wwv"))
  1377.     restoring_shrink=1;
  1378.   else
  1379.     restoring_shrink=0;
  1380.  
  1381.   /* /Brate /Srate /Nlevel /Alevel /O /H /M */
  1382.   /* /B - someone already logged on at rate (modem speed)
  1383.      /S - used only with /B, indicates com port speed
  1384.      /N - normal exit level
  1385.      /A - abnormal exit level
  1386.      /O - quit WWIV after one user done
  1387.      /H - don't hang up on user when he loggs off
  1388.      /M - don't access modem at all
  1389.    */
  1390.   for (i=1; i<argc; i++) {
  1391.     strcpy(s,argv[i]);
  1392.     if ((s[0]=='-') || (s[0]=='/')) {
  1393.       ch=upcase(s[1]);
  1394.       switch(ch) {
  1395.         case 'B':
  1396.           ui=(unsigned int) atol(&(s[2]));
  1397.           if ((ui==300) || (ui==1200) || (ui==2400) || (ui==9600) || (ui==19200) ||
  1398.               (ui==38400) || (ui==57600)) {
  1399.             ultoa((unsigned long) ui,curspeed,10);
  1400.             us=ui;
  1401.             already_on=1;
  1402.           } else {
  1403.             ui=us=0;
  1404.           }
  1405.           break;
  1406.         case 'S':
  1407.           us=(unsigned int) atol(&(s[2]));
  1408.           if (!((us==300) || (us==1200) || (us==2400) || (us==9600) || (us==19200) ||
  1409.               (us==38400) || (us==57600))) {
  1410.             us=ui;
  1411.           }
  1412.           break;
  1413.         case 'N':
  1414.           oklevel=atoi(&(s[2]));
  1415.           break;
  1416.         case 'A':
  1417.           noklevel=atoi(&(s[2]));
  1418.           break;
  1419.         case 'O':
  1420.           ooneuser=1;
  1421.           break;
  1422.         case 'H':
  1423.           no_hangup=1;
  1424.           break;
  1425.         case 'M':
  1426.           ok_modem_stuff=0;
  1427.           break;
  1428.       }
  1429.     }
  1430.   }
  1431.  
  1432.   init(1);
  1433.  
  1434.  
  1435.   if (restoring_shrink) {
  1436.     restoring_shrink=0;
  1437.     switch(restore_data("restore.wwv")) {
  1438.       case 0: /* WFC */
  1439.         goto wfc_label;
  1440.       case 1: /* main menu */
  1441.         goto main_menu_label;
  1442.     }
  1443.   }
  1444.  
  1445.   do {
  1446.  
  1447.     wait1(9);
  1448.     if (already_on)
  1449.       gotcaller(ui, us);
  1450.     else
  1451.       getcaller();
  1452.     if (modem_mode==mode_fax) {
  1453.       /* nothing here yet */
  1454.       goto hanging_up;
  1455.     }
  1456.     if (using_modem>-1) {
  1457.       if (!using_modem)
  1458.         holdphone(1);
  1459.       getuser();
  1460.     } else {
  1461.       holdphone(1);
  1462.       using_modem=0;
  1463.       checkit=0;
  1464.       okmacro=1;
  1465.       usernum=1;
  1466.       reset_act_sl();
  1467.       changedsl();
  1468.     }
  1469.     if (!hangup) {
  1470.       logon();
  1471. main_menu_label:
  1472.       while (!hangup) {
  1473.         if (curdloads)
  1474.           dlmainmenu();
  1475.         else
  1476.           mainmenu();
  1477.       }
  1478.       logoff();
  1479.     }
  1480.  
  1481. hanging_up:
  1482.     frequent_init();
  1483.     if ((!no_hangup) && (using_modem) && ok_modem_stuff) {
  1484.       dtr(0);
  1485.       if (cdet()) {
  1486.         wait1(9);
  1487.         if (cdet()) {
  1488.           wait1(9);
  1489.           if (cdet()) {
  1490.             i=0;
  1491.             dtr(1);
  1492.             while ((i++<2) && (cdet())) {
  1493.               wait1(27);
  1494.               pr1("\001\001\001");
  1495.               wait1(54);
  1496.               if (modem_i->hang[0])
  1497.                 pr1(modem_i->hang);
  1498.               else
  1499.                 pr1("ATH\r");
  1500.               wait1(6);
  1501.             }
  1502.           }
  1503.         }
  1504.       }
  1505.     }
  1506. wfc_label:
  1507.     cleanup_net();
  1508.     if (!using_modem)
  1509.       holdphone(0);
  1510.     if ((!no_hangup) && ok_modem_stuff)
  1511.       dtr(0);
  1512.     already_on=0;
  1513.     if (sysop_alert && (!kbhitb())) {
  1514.       dtr(1);
  1515.       wait1(2);
  1516.       holdphone(1);
  1517.       dt=timer();
  1518.       clrscrb();
  1519.       nl();
  1520.       pl(">> SYSOP ALERT ACTIVATED <<");
  1521.       nl();
  1522.       while ((!kbhitb()) && (fabs(timer()-dt)<60.0)) {
  1523.         setbeep(1);
  1524.         wait1(9);
  1525.         setbeep(0);
  1526.         wait1(18);
  1527.       }
  1528.       clrscrb();
  1529.       holdphone(0);
  1530.     }
  1531.     sysop_alert=0;
  1532.   } while ((!endday) && (!ooneuser));
  1533.  
  1534.   outs("\x0c");
  1535.   end_bbs(oklevel);
  1536. }
  1537.  
  1538.