home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / telix / tlxpcp15.arc / CITYDIAL.SLT < prev    next >
Text File  |  1989-01-06  |  24KB  |  809 lines

  1. //These are the user configurable variables of this script
  2.  
  3. str user_id[10]="XXXXXXXX",
  4.     password[10]="********",
  5.     busy_tone[]="Y",
  6.     message_tone[]="y",
  7.     connect_tone[]="y",
  8.     maintain_log[]="y";
  9.  
  10. ///////////////////////////////////////////////////////////////////////////////
  11. //                                                                           //
  12. //                  citydial v1.5 Copyright (c) by Charles Lee               //
  13. //                             January 1989                                  //
  14. //                                                                           //
  15. ///////////////////////////////////////////////////////////////////////////////
  16.  
  17. //Declare the dialing arrays
  18. str city_str[1000],
  19.     city_dial_str[1000],
  20.     city_search_buffer[1000];
  21.  
  22. //Declare string to build dos commands in
  23. str dos_command[200];
  24.  
  25. connect_alarm()
  26. {
  27.     if((connect_tone=="y")|(connect_tone=="Y"))
  28.     {
  29.         alarm(2);
  30.     }
  31. }
  32. disp_monthly()
  33. {
  34.     int fp,
  35.         t,
  36.         t1;
  37.  
  38.     str monthly_time_file[76],
  39.         elapse_time[12];
  40.  
  41.     monthly_time_file=_script_dir;
  42.     strcat(monthly_time_file,"mtelapse.pcp");
  43.  
  44.     fp=fopen(monthly_time_file,"r");
  45.     fgets(elapse_time,12,fp);
  46.     fclose(fp);
  47.     pstraxy("Total Monthly Elapsed Time is: ",38,19,10);
  48.     t=stoi(elapse_time);
  49.     t1=t/3600;
  50.     gotoxy(44,20);
  51.     printn(t1);
  52.     pstraxy(" hr(s) ",getx(),gety(),10);
  53.     t1=(t-t1*3600)/60;
  54.     printn(t1);
  55.     pstraxy(" mins.",getx(),gety(),10);
  56.     return;
  57. }
  58.  
  59. beep(int freq)
  60. {
  61.     if((message_tone=="y")|(message_tone=="Y"))
  62.     {
  63.         tone(freq,20);
  64.     }
  65. }
  66.  
  67. display_cities(int start)
  68. {
  69.     str highlight_test[10],
  70.         buffer[10];
  71.     int count;
  72.  
  73.     for(count=0;count<20;count=count+1)
  74.     {
  75.         substr(city_dial_str,((start+count)*8),8,highlight_test);
  76.         substr(city_str,((start+count)*8),8,buffer);
  77.         if(highlight_test=="********")
  78.         {
  79.             pstraxy(" ",26,(count+2),14);
  80.             pstraxy(buffer,27,(count+2),14);
  81.             pstraxy(" ",35,(count+2),14);
  82.         }
  83.         else
  84.        {
  85.             pstraxy(" ",26,(count+2),0x1f);
  86.             pstraxy(buffer,27,(count+2),0x1f);
  87.             pstraxy(" ",35,(count+2),0x1f);
  88.        }
  89.     }
  90. }
  91.  
  92. display_bar(int menu_bar_pos,int city_bar_pos)
  93. {
  94.     str buffer[10];
  95.  
  96.     substr(city_str,(city_bar_pos*8),8,buffer);
  97.     pstraxy(" ",26,(menu_bar_pos+2),0x4f);
  98.     pstraxy(buffer,27,(menu_bar_pos+2),0x4f);
  99.     pstraxy(" ",35,(menu_bar_pos+2),0x4f);
  100. }
  101.  
  102.  
  103. un_display_bar(int menu_bar_pos,int city_bar_pos)
  104. {
  105.     str buffer[10],
  106.         highlight_test[10];
  107.  
  108.     substr(city_str,(city_bar_pos*8),8,buffer);
  109.     substr(city_dial_str,(city_bar_pos*8),8,highlight_test);
  110.     if(highlight_test=="********")
  111.     {
  112.         pstraxy(" ",26,(menu_bar_pos+2),14);
  113.         pstraxy(buffer,27,(menu_bar_pos+2),14);
  114.         pstraxy(" ",35,(menu_bar_pos+2),14);
  115.     }
  116.     else
  117.     {
  118.         pstraxy(" ",26,(menu_bar_pos+2),0x1f);
  119.         pstraxy(buffer,27,(menu_bar_pos+2),0x1f);
  120.         pstraxy(" ",35,(menu_bar_pos+2),0x1f);
  121.     }
  122. }
  123.  
  124.  
  125. dial_these()
  126. {
  127.     str buffer[10],
  128.         highlight_test[10],
  129.         pcp_cities_file[76],
  130.         pcp_dial_queue[76];
  131.  
  132.     int fp,
  133.         done=0,
  134.         menu_bar_pos=0,
  135.         city_bar_pos=0,
  136.         menu_top=0,
  137.         city_str_amt=0,
  138.         menu_scroll=1,
  139.         key,
  140.         last_char;
  141.  
  142.     status_wind("Processing city file!  One moment please.",20);
  143.  
  144.     //Build city_str
  145.     pcp_cities_file=_script_dir;
  146.     strcat(pcp_cities_file,"cities.pcp");
  147.     fp=fopen(pcp_cities_file,"r");
  148.     if(!fp)
  149.     {
  150.         beep(500);
  151.         status_wind("Can't find PC Pursuit City file!.  Aborting.",10);
  152.         return 0;
  153.     }
  154.     while(fread(buffer,8,fp)==8)
  155.     {
  156.         fseek(fp,2,1);
  157.         strcat(city_str,buffer);
  158.         city_str_amt=city_str_amt+1;
  159.     }
  160.     fclose(fp);
  161.  
  162.     pcp_dial_queue=_script_dir;
  163.     strcat(pcp_dial_queue,"queue.pcp");
  164.     fp=fopen(pcp_dial_queue,"r");
  165.     if(!fp)
  166.     {
  167.         //The dialing queue doesn't exist.  Create it.
  168.         for(fp=0;fp<city_str_amt;fp=fp+1)
  169.         {
  170.             strcat(city_dial_str,"********");
  171.         }
  172.     }
  173.     else
  174.     {
  175.         fread(city_dial_str,1000,fp);
  176.         fclose(fp);
  177.     }
  178.     box(25,1,36,22,3,0,11);
  179.     box(38,10,66,12,3,0,11);
  180.     pstraxy("PC Pursuit City Menu",43,11,15);
  181.     pstraxy("  moves select bar   ",40,14,12);
  182.     pstraxy("Space selects/deselects",40,15,12);
  183.     pstraxy("C clears all selected  ",40,16,12);
  184.     pstraxy("┘ exits to city dialer",40,17,12);
  185.  
  186.     //Display monthly totals
  187.     disp_monthly();
  188.  
  189.     _scr_chk_key=0;
  190.     cursor_onoff(0);
  191.  
  192.     while(!done)
  193.     {
  194.         cursor_onoff(0);
  195.         if(menu_scroll)
  196.         {
  197.             display_cities(menu_top);
  198.             menu_scroll=0;
  199.         }
  200.         while(1)
  201.         {
  202.            display_bar(menu_bar_pos,city_bar_pos);
  203.            //Get key pressed and empty the keyboard buffer
  204.            key=inkeyw();
  205.            last_char=1;
  206.            while(last_char)
  207.            {
  208.                 last_char=inkey();
  209.            }
  210.            un_display_bar(menu_bar_pos,city_bar_pos);
  211.  
  212.             //Pg dn key
  213.             if(key==0x5100)
  214.             {
  215.                 menu_bar_pos=0;
  216.                 if((city_bar_pos+20)>=city_str_amt)
  217.                 {
  218.                     beep(500);
  219.                 }
  220.                 city_bar_pos=(city_bar_pos/20 + 1)*20;
  221.                 menu_top=city_bar_pos;
  222.                 if((menu_top+20)>city_str_amt)
  223.                 {
  224.                     menu_top=city_str_amt-20;
  225.                     city_bar_pos=menu_top;
  226.                 }
  227.                 menu_scroll=1;
  228.                 break;
  229.             }
  230.             //Pg up key
  231.             if(key==0x4900)
  232.             {
  233.                 if(!menu_top)
  234.                 {
  235.                     beep(500);
  236.                 }
  237.                 menu_bar_pos=19;
  238.                 menu_top=((city_bar_pos/20)-1)*20;
  239.                 city_bar_pos=menu_top+19;
  240.                 if(menu_top<0)
  241.                 {
  242.                     city_bar_pos=19;
  243.                     menu_top=0;
  244.                 }
  245.                 menu_scroll=1;
  246.                 break;
  247.             }
  248.             //Up key
  249.             if(key==0x4800)
  250.             {
  251.                 if(menu_bar_pos==0)
  252.                 {
  253.                     if(city_bar_pos==0)
  254.                     {
  255.                         beep(500);
  256.                     }
  257.                     else
  258.                     {
  259.                         menu_top=menu_top-20;
  260.                         city_bar_pos=city_bar_pos-1;
  261.                         menu_bar_pos=19;
  262.  
  263.                         if(menu_top<0)
  264.                         {
  265.                             menu_top=0;
  266.                             city_bar_pos=19;
  267.                         }
  268.                         menu_scroll=1;
  269.                     }
  270.                 }
  271.                 else
  272.                 {
  273.                     menu_bar_pos=menu_bar_pos-1;
  274.                     city_bar_pos=city_bar_pos-1;
  275.                 }
  276.                 break;
  277.             }
  278.  
  279.             //Dn key
  280.             if(key==0x5000)
  281.             {
  282.                 if(menu_bar_pos==19)
  283.                 {
  284.                     if(city_bar_pos==(city_str_amt-1))
  285.                     {
  286.                         beep(500);
  287.                     }
  288.                     else
  289.                     {
  290.                         city_bar_pos=city_bar_pos+1;
  291.                         menu_top=menu_top+20;
  292.                         menu_bar_pos=0;
  293.                         if((menu_top+20)>city_str_amt)
  294.                         {
  295.                             menu_top=city_str_amt-20;
  296.                             city_bar_pos=city_str_amt-20;
  297.                         }
  298.                         menu_scroll=1;
  299.                     }
  300.                 }
  301.                 else
  302.                 {
  303.                     menu_bar_pos=menu_bar_pos+1;
  304.                     city_bar_pos=city_bar_pos+1;
  305.                 }
  306.                 break;
  307.             }
  308.  
  309.             //Space key
  310.             if(key==0x20)
  311.             {
  312.                 menu_scroll=1;
  313.                 subchrs(city_str,(8*city_bar_pos),8,buffer);
  314.                 subchrs(city_dial_str,(8*city_bar_pos),8,highlight_test);
  315.                 if(highlight_test=="********")
  316.                 {
  317.                     copychrs(buffer,city_dial_str,(8*city_bar_pos),8);
  318.                 }
  319.                 else
  320.                 {
  321.                     copychrs("********",city_dial_str,(8*city_bar_pos),8);
  322.                 }
  323.                 beep(3000);
  324.                 break;
  325.             }
  326.  
  327.             //Enter key
  328.             if(key==0x0d)
  329.             {
  330.                 done=1;
  331.                 break;
  332.             }
  333.             if((key=='c')|(key=='C'))
  334.             {
  335.                 city_dial_str="";
  336.                 menu_bar_pos=0;
  337.                 city_bar_pos=0;
  338.                 menu_top=0;
  339.                 menu_scroll=1;
  340.                 beep(3000);
  341.                 status_wind("Clearing all selected cities!",10);
  342.  
  343.                 for(fp=0;fp<city_str_amt;fp=fp+1)
  344.                 {
  345.                     strcat(city_dial_str,"********");
  346.                 }
  347.                 break;
  348.             }
  349.  
  350.             beep(500);
  351.             status_wind("Unknown command!",10);
  352.             cursor_onoff(0);
  353.         }
  354.     }
  355.     //Save the highlighted cities
  356.     fp=fopen(pcp_dial_queue,"w+");
  357.     fwrite(city_dial_str,strlen(city_dial_str),fp);
  358.     fputc(0,fp);
  359.     fclose(fp);
  360.  
  361.     //Remove * from city_dial_str
  362.     for(fp=0;fp<strlen(city_dial_str);fp=fp+8)
  363.     {
  364.         if(subchr(city_dial_str,fp)=='*')
  365.         {
  366.             delchrs(city_dial_str,fp,8);
  367.             fp=fp-8;
  368.         }
  369.     }
  370.     return (strlen(city_dial_str)/8);
  371.  
  372. }
  373. dequeue(str city)
  374. {
  375.     int fp,
  376.         status;
  377.  
  378.     str pcp_dial_queue[76];
  379.  
  380.     pcp_dial_queue=_script_dir;
  381.     strcat(pcp_dial_queue,"queue.pcp");
  382.     fp=fopen(pcp_dial_queue,"r");
  383.     fread(city_search_buffer,1000,fp);
  384.     fclose(fp);
  385.  
  386.     status=strpos(city_search_buffer,city,0);
  387.     if(status!=-1)
  388.     {
  389.         copychrs("********",city_search_buffer,status,8);
  390.         fp=fopen(pcp_dial_queue,"w+");
  391.         fwrite(city_search_buffer,strlen(city_search_buffer),fp);
  392.         fputc(0,fp);
  393.         fclose(fp);
  394.     }
  395.  
  396. return;
  397. }
  398.  
  399. dial_cities(int quantity)
  400. {
  401.     int t0,t1,t2,t3,t4,t5,status,count,test_count,flag,fp,dir_length,t_handle;
  402.  
  403.     str pcp_command[25],
  404.         city[10],
  405.         fon_path[76],
  406.         fon_name[76],
  407.         dir_length_buffer[3],
  408.         pcp_dial_queue[76],
  409.         empty_fon_path[76],
  410.         usage_log_path[76],
  411.         temp_time_file[76],
  412.         start_time[12],
  413.         buffer[12];
  414.  
  415.     dos_command="copy ";
  416.     _strip_high=1;
  417.  
  418.     if(!quantity)
  419.     {
  420.         beep(500);
  421.         status_wind("No cities selected!",10);
  422.         return 4;
  423.     }
  424.     ustamp("*** City dialer starting to dial.",1,1);
  425. while(1)
  426. {
  427.     for(count=0;count<quantity;count=count+1)
  428.     {
  429.         prints(" ");
  430.         prints(" ");
  431.  
  432.         flushbuf();
  433.         t0=track("STILL",1);
  434.         t1=track(" CONNECTED",1);
  435.         t2=track("BUSY",1);
  436.         t3=track("ADDRESS",1);
  437.         t4=track("NOT OPERATING",1);
  438.  
  439.  
  440.         substr(city_dial_str,(count*8),8,city);
  441.  
  442.         if(city!="Net Exch")
  443.         {
  444.             pcp_command="C D/";
  445.             strcat(pcp_command,city);
  446.             strcat(pcp_command,",");
  447.             strcat(pcp_command,user_id);
  448.             strcat(pcp_command,"^M");
  449.  
  450.             cputs_tr(pcp_command);
  451.  
  452.             status=waitfor("PASSWORD",3);
  453.             if(!status)
  454.             {
  455.                 cputs_tr("^M");
  456.             }
  457.             else
  458.             {
  459.                 cputs_tr(password);
  460.                 cputs_tr("^M");
  461.             }
  462.         }
  463.         else
  464.         {
  465.             cputs_tr("C PURSUIT^M");
  466.         }
  467.         flushbuf();
  468.         t_handle=timer_start(100);  //Set the timeout value.
  469.         while(1)
  470.         {
  471.             terminal();
  472.             status=track_hit(0);
  473.             if(time_up(t_handle))
  474.             {
  475.                 timer_free(t_handle);
  476.                 beep(500);
  477.                 status_wind("City timed out!",10);
  478.                 track_free(0);
  479.                 cputs_tr("^M");
  480.                 if(!waitfor("@",5))
  481.                 {
  482.                     beep(500);
  483.                     status_wind("Lock up error! Aborting.",10);
  484.                     return 5;
  485.                 }
  486.                 break;
  487.             }
  488.  
  489.             if(inkey()==0x20)
  490.             {
  491.                 status_wind("Exiting City Dialer!",10);
  492.                 track_free(0);
  493.                 timer_free(t_handle);
  494.                 return 2;
  495.             }
  496.             if(status==t0)
  497.             {
  498.                 beep(500);
  499.                 status_wind("Still connected!  Must disconnect from city first.",10);
  500.                 track_free(0);
  501.                 timer_free(t_handle);
  502.                 return 1;
  503.             }
  504.             if(status==t1)
  505.             {
  506.                 track_free(0);
  507.                 timer_free(t_handle);
  508.  
  509.                 if(city!="Net Exch")
  510.                 {
  511.                     connect_alarm();
  512.                     status_wind("Connected! Now testing city modem.",10);
  513.                     flag=1;
  514.                     //Check for RV mode and get out of it
  515.                     cputs_tr("^M");
  516.                     if(waitfor("*",2))
  517.                     {
  518.                         cputs_tr("I~^M");
  519.                     }
  520.                     for(test_count=0;test_count<2;test_count=test_count+1)
  521.                     {
  522.                         cputs_tr("^M~~ATZ~~^M");
  523.                         if(waitfor("OK",2))
  524.                         {
  525.                             flag=0;
  526.                             dequeue(city);
  527.                             beep(3000);
  528.                             status_wind("Modem ok! Loading dialing directory.",10);
  529.                             break;
  530.                         }
  531.                     }
  532.                     if(flag)
  533.                     {
  534.                         beep(500);
  535.                         status_wind("Bad city modem!  Disconnecting city.",10);
  536.                         cputs_tr("^M~~@~~^M");
  537.                         cputs_tr("d~~^M");
  538.                         if(!(waitfor("@",4)))
  539.                         {
  540.                             beep(500);
  541.                             status_wind("Unable to disconnect city!  Aborting.",10);
  542.                             return 5;
  543.                         }
  544.                         break;
  545.                     }
  546.                     ustamp("*** Connected to ",1,0);
  547.                     ustamp(city,0,1);
  548.                     if((maintain_log=="y")|(maintain_log=="Y"))
  549.                     {
  550.                         status_wind("Updating usage log!",30);
  551.                         usage_log_path=_script_dir;
  552.                         strcat(usage_log_path,"usage.pcp");
  553.                         fp=fopen(usage_log_path,"a+");
  554.                         fputc(0x0d,fp);
  555.                         fputc(0x0a,fp);
  556.                         fputs("   ",fp);
  557.                         fputs(city,fp);
  558.                         fputs(" connected at ",fp);
  559.                         t0=curtime();
  560.                         time(t0,buffer);
  561.                         fputs(buffer,fp);
  562.                         fputs(".",fp);
  563.                         fputc(0x0d,fp);
  564.                         fputc(0x0a,fp);
  565.                         fclose(fp);
  566.                     }
  567.  
  568.                     itos(curtime(),start_time);
  569.                     temp_time_file=_script_dir;
  570.                     strcat(temp_time_file,"temptime.pcp");
  571.                     fp=fopen(temp_time_file,"w");
  572.                     fputs(start_time,fp);
  573.                     fputc(0x0d,fp);
  574.                     fputc(0x0a,fp);
  575.                     fclose(fp);
  576.  
  577.                     delchrs(city,5,3);
  578.                     fon_path=_telix_dir;
  579.                     strcat(fon_path,"pcpfon\");
  580.                     empty_fon_path=fon_path;
  581.                     strcat(empty_fon_path,"empty.fon");
  582.                     strcat(fon_path,city);
  583.                     strcat(fon_path,".fon");
  584.                     if(!(loadfon(fon_path)))
  585.                     {
  586.                         beep(500);
  587.                         status_wind("Creating it.",10);
  588.                         strcat(dos_command,empty_fon_path);
  589.                         strcat(dos_command," ");
  590.                         strcat(dos_command,fon_path);
  591.                         dos(dos_command,0);
  592.                         loadfon(fon_path);
  593.                     }
  594.                     _dial_time=90;
  595.                     _strip_high=0;
  596.  
  597.                     //Adjust baud rates in the directory file
  598.                     fp=fopen(fon_path,"r+");
  599.                     if(!fp)
  600.                     {
  601.                         beep(500);
  602.                         status_wind("Not able to adjust directory baud rates!",10);
  603.                     }
  604.                     fseek(fp,6,0);
  605.                     fread(dir_length_buffer,2,fp);
  606.                     dir_length=subchr(dir_length_buffer,0)+(subchr(dir_length_buffer,1)*256);
  607.                     fseek(fp,106,0);
  608.                     for(;dir_length;dir_length=dir_length-1)
  609.                     {
  610.                         if(get_baud()==1200)
  611.                         {
  612.                             fputc(1,fp);
  613.                         }
  614.                         else
  615.                         {
  616.                             fputc(2,fp);
  617.                         }
  618.                         fseek(fp,85,1);
  619.                     }
  620.                     fclose(fp);
  621.  
  622.                     //Save the current city name to disk
  623.                     fon_name=_script_dir;
  624.                     strcat(fon_name,"fondir.pcp");
  625.                     fp=fopen(fon_name,"w+");
  626.                     fputs(fon_path,fp);
  627.                     fputc(0x0a,fp);
  628.                     fclose(fp);
  629.  
  630.                     call("dialbbs.slc");
  631.                 }
  632.                 else
  633.                 {
  634.                     
  635.                     t0=track("FIRST",1);
  636.                     t1=track("@",1);
  637.                     t2=track("CONTINUE",1);
  638.                     while(1)
  639.                     {
  640.                         terminal();
  641.                         status=track_hit(0);
  642.                         if(status==t0)
  643.                         {
  644.                             connect_alarm();
  645.                             status_wind("Connected to the Network Exchange!",10);
  646.                             track_free(0);
  647.                             dequeue(city);
  648.                             ustamp("*** Connected to the Network Exchange.",1,1);
  649.                             if((maintain_log=="y")|(maintain_log=="Y"))
  650.                             {
  651.                                 status_wind("Updating usage log!",30);
  652.                                 usage_log_path=_script_dir;
  653.                                 strcat(usage_log_path,"usage.pcp");
  654.                                 fp=fopen(usage_log_path,"a+");
  655.                                 fputc(0x0d,fp);
  656.                                 fputc(0x0a,fp);
  657.                                 fputs("   NET EXCH connected at ",fp);
  658.                                 t0=curtime();
  659.                                 time(t0,buffer);
  660.                                 fputs(buffer,fp);
  661.                                 fputs(".",fp);
  662.                                 fputc('P',fp);
  663.                                 fputc(0x0d,fp);
  664.                                 fputc(0x0a,fp);
  665.                                 fclose(fp);
  666.                             }
  667.                             return 3;
  668.                         }
  669.                         if(status==t1)
  670.                         {
  671.                             track_free(0);
  672.                             break;
  673.                         }
  674.                         if(status==t2)
  675.                         {
  676.                             cputs_tr("~~~~^M");
  677.                         }
  678.                     }
  679.                     break;
  680.                 }
  681.                 return 0;
  682.             }
  683.  
  684.             if(status==t2)
  685.             {
  686.                 if((busy_tone=="y")|(busy_tone=="Y"))
  687.                 {
  688.                     tone(3000,20);
  689.                 }
  690.                 track_free(0);
  691.                 timer_free(t_handle);
  692.                 break;
  693.             }
  694.             if(status==t3)
  695.             {
  696.                 beep(500);
  697.                 dequeue(city);
  698.                 status_wind("City is not recognized by PCP!  Removing from queue.",10);
  699.                 delchrs(city_dial_str,(count*8),8);
  700.                 track_free(0);
  701.                 timer_free(t_handle);
  702.                 count=0;
  703.                 quantity=quantity-1;
  704.                 if(!quantity)
  705.                 {
  706.                     return 4;
  707.                 }
  708.                 break;
  709.             }
  710.             if(status==t4)
  711.             {
  712.                 beep(500);
  713.                 dequeue(city);
  714.                 status_wind("City is not operating! Removing from queue.",10);
  715.                 delchrs(city_dial_str,(count*8),8);
  716.                 track_free(0);
  717.                 timer_free(t_handle);
  718.                 count=0;
  719.                 quantity=quantity-1;
  720.                 if(!quantity)
  721.                 {
  722.                     return 4;
  723.                 }
  724.                 break;
  725.             }
  726.  
  727.            
  728.         }
  729.     }
  730. }
  731. }
  732.  
  733.  
  734.  
  735. main()
  736. {
  737.     int flag,
  738.         quantity,
  739.         scr_handle,
  740.         status,
  741.         todays_date,
  742.         time_file_date,
  743.         fp;
  744.  
  745.     str monthly_time_file[76],
  746.         time_log_path[76];
  747.  
  748.     monthly_time_file=_script_dir;
  749.     strcat(monthly_time_file,"mtelapse.pcp");
  750.  
  751.     todays_date=curtime();
  752.     time_file_date=filetime(monthly_time_file);
  753.     if(time_file_date==-1)
  754.     {
  755.         beep(500);
  756.         status_wind("Monthly time file not found! Creating it.",30);
  757.         fp=fopen(monthly_time_file,"w");
  758.         fputs("0",fp);
  759.         fputc(0x0d,fp);
  760.         fputc(0x0a,fp);
  761.         fclose(fp);
  762.  
  763.         time_file_date=todays_date;
  764.     }
  765.     // Check to see if the month is over
  766.     if(tmonth(time_file_date)!=tmonth(todays_date))
  767.     {
  768.         beep(500);
  769.         dos_command="copy ";
  770.         status_wind("Starting new monthly time total!.",30);
  771.         strcat(dos_command,_script_dir);
  772.         strcat(dos_command,"mtelapse.pcp ");
  773.         strcat(dos_command,_script_dir);
  774.         strcat(dos_command,"lastmo.pcp");
  775.         dos(dos_command,0);
  776.         fp=fopen(monthly_time_file,"w");
  777.         fputs("0",fp);
  778.         fputc(0x0d,fp);
  779.         fputc(0x0a,fp);
  780.         fclose(fp);
  781.     }
  782.  
  783.  
  784.     _scr_chk_key=0;
  785.     cputs("^M");
  786.     cputs("@");
  787.     cputs("^M");
  788.     flag=waitfor("@",5);
  789.     if(!flag)
  790.     {
  791.         status_wind("Pursuit not responding!",30);
  792.         prints("+++ Pursuit did not respond! +++");
  793.        beep(500);
  794.         hangup();
  795.         return();
  796.     }
  797.     status_wind("Loading PC Pursuit City Menu!",10);
  798.     scr_handle=vsavearea(0,0,79,25);
  799.     clear_scr();
  800.     quantity=dial_these();
  801.     vrstrarea(scr_handle);
  802.     status=dial_cities(quantity);
  803.     if(status==4)
  804.     {
  805.         beep(500);
  806.         status_wind("Dialing queue is empty!",10);
  807.     }
  808. }
  809.