home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / icf186.zip / BBS.C next >
Text File  |  1988-07-05  |  8KB  |  237 lines

  1. /*
  2. *******************************************
  3. *                                         *
  4. *   This program creates a PRN type file  *
  5. *   out of the Sonka BBS list.  The PRN   *
  6. *   file may be merged into an ICF file.  *
  7. *   The number of lines per record is 9.  *
  8. *                                         *
  9. *        Copyright M. Arnow, 1988.        *
  10. *        All rights reserved.             *
  11. *                                         *
  12. *******************************************
  13. */
  14.  
  15. #include <stdio.h>
  16. #include <string.h>
  17.  
  18. char abbs[] = "Apple Bulletin Board System (Apple Based).";
  19. char advn[] = "Adventure Systems (Apple Based).";
  20. char akcs[] = "AKCS Unix Bulletin Board (Unix Based).";
  21. char amig[] = "Amiga Bulletin Board System (Amiga Based).";
  22. char amis[] = "Atari Message System (Atari or Atari ST Based).";
  23. char cbbs[] = "Computer Bulletin Board System (S100 Based).";
  24. char ccbs[] = "Commodore Computer Bulletin Board (C-64 Based).";
  25. char coco[] = "Color Computer Bulletin Board (TRS-80 Based).";
  26. char coli[] = "Collie Bulletin Board (IBM-PC & Compatibles).";
  27. char data[] = "Online Computerized Library Catalog System.";
  28. char divd[] = "Diversi-Dial Multi-User System (Apple Based).";
  29. char erac[] = "ERAC Bulletin Board System (TRS-80 Based).";
  30. char fido[] = "Fido Bulletin Board System (MS-DOS Based).";
  31. char form[] = "Forum-PC Bulletin Board System(IBM & Compatibles).";
  32. char gbbs[] = "General Bulletin Board System (Apple Based).";
  33. char gtbb[] = "GT-BBS System (IBM-PC & Compatibles).";
  34. char ibbs[] = "PC Bulletin Board System (IBM-PC & Compatibles).";
  35. char ihcs[] = "IBM-PC Host Communication System (IBM-PC).";
  36. char mcbb[] = "MacIntosh Bulletin Board (MacIntosh Based).";
  37. char mcms[] = "Micro Computer Message System (TRS-80 Based).";
  38. char mich[] = "Michtron Bulletin Board (Amiga Based).";
  39. char netw[] = "Net-Works Communications System (Apple Based).";
  40. char noch[] = "No Change Bulletin Board (IBM-PC & Compatibles).";
  41. char onln[] = "Online Multi-User System (C-64 Based).";
  42. char opus[] = "Computer -Based Conversation System (MS-DOS).";
  43. char otbb[] = "Other TRS-80 Bulletin Board (TRS-80 Based).";
  44. char pcbb[] = "PC Bulletin Board (IBM-PC & Compatibles).";
  45. char pico[] = "PicoSpan Multiuser Conference System (Unix Based).";
  46. char rbbs[] = "Remote PC Bulletin Board (IBM-PC & Compatibles).";
  47. char rcpm[] = "Remote CP/M Bulletin Board (CP/M Based).";
  48. char stbb[] = "ST Bulletin Board (Atari 520-ST Based).";
  49. char tbbs[] = "The Bread Board System (IBM-PC & Compatibles).";
  50. char tcom[] = "T-Comm Bulletin Board (IBM-PC & Compatibles).";
  51. char tibb[] = "Texas Instruments Bulletin Board (TI99/4 Based).";
  52. char ubbs[] = "Universal Bulletin Board System (Apple Based).";
  53. char unix[] = "Unix/Xenix System (with bbs facilities).";
  54. char xbbs[] = "Adult BBS Systems (Apple,C-64 or TRS-80 Based).";
  55.  
  56. char info_a[] = "24-hours per day, 7 days per week operation.";
  57. char info_b[] = "Part-Time: 9am-9pm weekdays, 1pm-5pm weekends.";
  58. char info_c[] = "Part-Time: 7pm-7am weekdays, 24 hours on weekends.";
  59. char info_d[] = "Part-Time: 7am-6pm weekdays, 24 hours on weekends.";
  60. char info_e[] = "Part-Time: 7pm-7am weekdays, 7 days per week.";
  61. char info_f[] = "Part-Time: 7am-6pm weekdays, 7 days per week.";
  62. char info_g[] = "BBS is temporarily closed for maintenance.";
  63.  
  64. char bps_a[] = "300-1200-2400-9600(HST) bps operation supported.";
  65. char bps_b[] = "300-1200-2400 bps operation supported.";
  66. char bps_c[] = "1200-12400 bps operation only.";
  67. char bps_d[] = "1200 bps only.";
  68. char bps_e[] = "300-1200 bps operation only.";
  69. char bps_f[] = "300 bps operation only.";
  70.  
  71. char uart_7[] = "UART settings = 7-1-Even Parity.";
  72. char uart_8[] = "UART settings = 8-1-No Parity.";
  73.  
  74. char header[] = "ABBS\0"
  75.         "ADVN\0"
  76.         "AKCS\0"
  77.         "AMIG\0"
  78.         "AMIS\0"
  79.         "CBBS\0"
  80.         "CCBS\0"
  81.         "COCO\0"
  82.         "COLI\0"
  83.         "DATA\0"
  84.         "DIVD\0"
  85.         "ERAC\0"
  86.                 "FIDO\0"
  87.         "FORM\0"
  88.         "GBBS\0"
  89.         "GTBB\0"
  90.         "IBBS\0"
  91.         "IHCS\0"
  92.         "MCBB\0"
  93.         "MCMS\0"
  94.         "MICH\0"
  95.         "NETW\0"
  96.         "NOCH\0"
  97.         "ONLN\0"
  98.         "OPUS\0"
  99.         "OTBB\0"
  100.         "PCBB\0"
  101.         "PICO\0"
  102.         "RBBS\0"
  103.         "RCPM\0"
  104.         "STBB\0"
  105.         "TBBS\0"
  106.         "TCOM\0"
  107.         "TIBB\0"
  108.         "UBBS\0"
  109.         "UNIX\0"
  110.         "XBBS\0";
  111.  
  112. main()
  113. {
  114. FILE *fptr,*prn_ptr;
  115. register int i;
  116. char s_name[80],prn_name[80],buffer[80],*gptr;
  117. char *h,*type,*info,*bps,*uart;
  118. char name[80],location[80],number[80],flag;
  119.  
  120. do
  121.     {
  122.     printf("\nSonka List file name: ");
  123.     scanf("%s",s_name);
  124.     fptr = fopen(s_name,"r");
  125.     if(!fptr)
  126.         {
  127.         strupr(s_name);
  128.         printf("\n%s file not found.\n",s_name);
  129.         }
  130.     }
  131. while(!fptr);
  132.  
  133. printf("\nPRN file name: ");
  134. scanf("%s",prn_name);
  135. prn_ptr = fopen(prn_name,"w");
  136. if(!prn_ptr)
  137.     {
  138.     strupr(prn_name);
  139.     printf("\nCannot open %s file",prn_name);
  140.     exit(0);
  141.     }
  142. printf("\n");
  143.  
  144. for(;;)
  145.     {
  146.     for(i=0;i<80;++i) buffer[i] = name[i] = location[i] = number[i] = 0;
  147.     gptr = fgets(buffer,80,fptr);
  148.     if(!gptr) exit(0);
  149.     for(h=header,i=0;*h;h+=5,++i) if(!strncmp(h,&buffer[2],4)) break;
  150.     if(!*h) continue;
  151.     flag = 0;
  152.     switch(i)
  153.         {
  154.         case 0: type = abbs; break;
  155.         case 1: type = advn; break;
  156.         case 2: type = akcs; break;
  157.         case 3: type = amig; break;
  158.         case 4: type = amis; break;
  159.         case 5: type = cbbs; break;
  160.         case 6: type = ccbs; break;
  161.         case 7: type = coco; break;
  162.         case 8: type = coli; break;
  163.         case 9: type = data; break;
  164.         case 10: type = divd; break;
  165.         case 11: type = erac; break;
  166.         case 12: type = fido; break;
  167.         case 13: type = form; break;
  168.         case 14: type = gbbs; break;
  169.         case 15: type = gtbb; break;
  170.         case 16: type = ibbs; break;
  171.         case 17: type = ihcs; break;
  172.         case 18: type = mcbb; break;
  173.         case 19: type = mcms; break;
  174.         case 20: type = mich; break;
  175.         case 21: type = netw; break;
  176.         case 22: type = noch; break;
  177.         case 23: type = onln; break;
  178.         case 24: type = opus; break;
  179.         case 25: type = otbb; break;
  180.         case 26: type = pcbb; break;
  181.         case 27: type = pico; break;
  182.         case 28: type = rbbs; break;
  183.         case 29: type = rcpm; break;
  184.         case 30: type = stbb; break;
  185.         case 31: type = tbbs; break;
  186.         case 32: type = tcom; break;
  187.         case 33: type = tibb; break;
  188.         case 34: type = ubbs; break;
  189.         case 35: type = unix; break;
  190.         case 36: type = xbbs; break;
  191.         default: flag = 1;
  192.         }
  193.     if(flag) continue;
  194.     printf("%s",buffer);
  195.     if(buffer[53]!='|')
  196.         {
  197.         strncpy(name,&buffer[9],30);
  198.         strncpy(location,&buffer[41],18);
  199.         strncpy(number,&buffer[61],9);
  200.         }
  201.     else
  202.         {
  203.         strncpy(name,&buffer[9],24);
  204.         strncpy(location,&buffer[35],18);
  205.         strncpy(number,&buffer[56],14);
  206.         }
  207.     switch(buffer[72])
  208.         {
  209.         case '*': info = info_a; break;
  210.         case '#': info = info_b; break;
  211.         case '%': info = info_c; break;
  212.         case '&': info = info_d; break;
  213.         case '=': info = info_e; break;
  214.         case '+': info = info_f; break;
  215.         case '?': info = info_g; break;
  216.         default:  info = "";
  217.         }
  218.     switch(buffer[73])
  219.         {
  220.         case '7': uart = uart_7; break;
  221.         case '8': uart = uart_8; break;
  222.         default:  uart = "";
  223.         }
  224.     switch(buffer[74])
  225.         {
  226.         case '~': bps = bps_a; break;
  227.         case '-': bps = bps_b; break;
  228.         case '|': bps = bps_c; break;
  229.         case '@': bps = bps_d; break;
  230.         case '$': bps = bps_e; break;
  231.         case '!': bps = bps_f; break;
  232.         default:  bps = "";
  233.         }
  234.     fprintf(prn_ptr,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n",name,number,location,h,type,bps,uart,info);
  235.     }
  236. }
  237.