home *** CD-ROM | disk | FTP | other *** search
/ synchro.net / synchro.net.tar / synchro.net / modem.madness / SMMNETML / AMAX_230.ZIP / SOURCES.ZIP / AMAXPOLL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-15  |  4.4 KB  |  128 lines

  1. /*---------------------------------------------------------------------------*/
  2. /*                                                                           */
  3. /* Module Name:   AMAXPOLL.C                                                 */
  4. /* Program Name:  AMAX                                                       */
  5. /* Revision:      2.xx                                                       */
  6. /* Purpose:       Poll Generation Module                                     */
  7. /* Programmer:    Alan D. Bryant                                             */
  8. /*                                                                           */
  9. /* Copyright (C) 1988, 89, 90, 92 Alan D. Bryant, All Rights Reserved.       */
  10. /*                                                                           */
  11. /* NOTICE:  This source code is copyrighted material.  You are granted a     */
  12. /* limited license to use and distribute the code.  The complete text of     */
  13. /* the license can be found in the document LICENSE.DOC which accompanies    */
  14. /* this source code, or can be obtained directly from the author.            */
  15. /*                                                                           */
  16. /* Inquiries regarding this package should be directed to:                   */
  17. /*                                                                           */
  18. /*     AMAX                                                                  */
  19. /*     Alan D. Bryant                                                        */
  20. /*     P. O. Box 101612                                                      */
  21. /*     Denver, CO  80250                                                     */
  22. /*     USA                                                                   */
  23. /*                                                                           */
  24. /*---------------------------------------------------------------------------*/
  25.  
  26. #include <stdio.h>
  27. #include <dir.h>
  28. #include "amax.h"
  29.  
  30.  
  31. void poll();
  32.  
  33. void poll()
  34. {
  35.     FILE *stream;
  36.  
  37.     unsigned char system[50] = "";
  38.     unsigned char hexname[15] = "";
  39.     unsigned char pass[70] = "";
  40.     unsigned char out[100] = "";
  41.     unsigned char info[70] = "";
  42.     unsigned char input[50] = "";
  43.  
  44.     unsigned char ch;
  45.     char done = 0;
  46.  
  47.     int to_net;
  48.     int to_node;
  49.  
  50.     struct ffblk ffblk;
  51.  
  52.     cls();
  53.     output("$1AMAX $4Build Attach to Poll a System$0");
  54.  
  55.     while (! done) {
  56.         bottomcls(2);
  57.         cursor(2, 0);
  58.  
  59.         input[0] = 0x00;
  60.         output("Destination System     <net/node> ");
  61.         vpanel(45);
  62.         getln(input, 45);
  63.  
  64.         if (strlen(input) == 0) return;
  65.  
  66.         strcpy(system, input);
  67.  
  68.         if (strchr(system, '/') == NULL) {
  69.             strcpy(system, findaddress(input));
  70.             if (strlen(system) == 0) {
  71.                 output("\r\nExpected a Sysop name or node address in the form NET/NODE...press a key...");
  72.                 agetch();
  73.                 return;
  74.             }
  75.         }
  76.  
  77.         strcpy(hexname, parseaddress(system));
  78.  
  79.         to_net = extractnet(hexname);
  80.         to_node = extractnode(hexname);
  81.  
  82.         strcpy(info, lookinfo(to_net, to_node, 0));
  83.         sprintf(out, "   Looks Like: %s\r\n\r\n", info);
  84.         if (usenl) output(out);
  85.  
  86.         output("Correct? ");
  87.         ch = menu_select("YN\r\x1B");
  88.         if (ch == 0x1B) continue;
  89.         if (ch == 'Y' || ch == '\r') {
  90.             output("Yes\r\n\r\n");
  91.         }
  92.         else {
  93.             output("No\r\n\r\n");
  94.             output("Aborting...");
  95.             pressanykey();
  96.             continue;
  97.         }
  98.  
  99.         strcpy(pass, outbound);
  100.         strcat(pass, hexname);
  101.         strcat(pass, ".?LO");
  102.  
  103.         if (findfirst(pass, &ffblk, 0) != 0) {
  104.             output("Creating poll...\r\n\r\n");
  105.             strcpy(pass, outbound);
  106.             strcat(pass, hexname);
  107.             strcat(pass, ".CLO");
  108.             stream = fopen(pass, "a+b");
  109.             if (stream == NULL) {
  110.                 output("Cannot open poll file...");
  111.                 pressanykey();
  112.                 continue;
  113.             }
  114.             fclose(stream);
  115.             continue;
  116.         }
  117.         else {
  118.             sprintf(out, "Looks like something is already en route to %d/%d.\r\n", to_net, to_node);
  119.             output(out);
  120.             output("Try initiating a manual poll...");
  121.             pressanykey();
  122.             continue;
  123.         }
  124.  
  125.     }
  126. }
  127. 
  128.