home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / WWIVMODS / PRE412.ZIP / BASEPRIN.C < prev    next >
Text File  |  1990-04-28  |  3KB  |  111 lines

  1. /*baseprint.c */
  2. /* Elric19.zip*/
  3. /*
  4.    This program prints out the message base list in what will
  5.  hopefully be a useful format.
  6.  This program was written by Lord Elric, 1@8251
  7.  
  8. If you use this, the only payment I ask is that you send me a
  9. note through WWIVNet to 1@8251 saying you are using it...not too much to
  10. ask is it?
  11.  
  12. If you have any problems, you can reach me through WWIV-Net, 1@8251, or call
  13. my BBS.
  14. The Kingdom of Melnibone
  15. 812-877-3488  24 Hrs a day
  16. 3/12/2400/4800/9600/12,000/14,400 baud HST MNP5
  17. Auto-validation of WWIV sysops on first call
  18. Xmodem, Ymodem, DSZ Zmodem with retry, Ymodem-G
  19.  
  20. Lord Elric
  21. */
  22.  
  23. #include <io.h>
  24. #include <stdio.h>
  25. #include <fcntl.h>
  26. #include <string.h>
  27. #include <stdlib.h>
  28. #include "vardec.h"
  29.  
  30. int configfile,subsfile;
  31. FILE *printer;
  32. int num_subs;
  33. subboardrec subboards[64];
  34. subboardrec sub;
  35. configrec syscfg;
  36. int i,j,ls;
  37. char s[81],s2[3];
  38.  
  39.  
  40.  
  41. void main()
  42. {
  43.   char s3[80];
  44.  
  45.   configfile=-1;
  46.   strcpy(s,"D:\\wwiv\\CONFIG.DAT");
  47.   configfile=open(s,O_RDWR | O_BINARY);
  48.   if (configfile<0) {
  49.     printf("%s NOT FOUND.\n",s);
  50.     exit(0);
  51.     }
  52.   read(configfile,(void *) (&syscfg), sizeof(configrec));
  53.   close(configfile);
  54.  
  55.   subsfile=-1;
  56.   strcpy(s,syscfg.datadir);
  57.   strcat(s,"SUBS.DAT");
  58.   subsfile=open(s,O_RDWR | O_BINARY);
  59.   if (subsfile<0) {
  60.   printf("%s NOT FOUND.\n",s);
  61.     exit(0);
  62.     }
  63.   num_subs=(read(subsfile,(void *) (&subboards), (64*sizeof(subboardrec))))/
  64.              sizeof(subboardrec);
  65.   close(subsfile);
  66.  
  67.   printf("Welcome to Base Print.\n");
  68.   printf("Written By Lord Elric AKA Wayne McDaniel\n");
  69.   printf("This program is for use with WWIV 4.xx\n");
  70.   printf("Please contact Lord Elric, 1@8251 WWIVNet, with any problems\n");
  71.   printf("Or call The Kingdom Of Melnibone BBS, 1-812-877-3488\n");
  72.   printf("This is officially Elric's Mod #19\n\n");
  73.   printf("Please enter the name of the file\n");
  74.   printf("you wish to send this report to. Hit Return for printer.\n");
  75.   printf("?");
  76.   gets(s3);
  77.   if (s3[0]==0)
  78.     strcpy(s3,"prn");
  79.   printer=fopen(s3,"w");
  80.   if (printer==NULL) {
  81.   printf("Cannot access printer\n");
  82.     exit(0);
  83.     }
  84.  
  85.   sprintf(s,"Message base listing for %s\n\n",syscfg.systemname);
  86.   fputs(s,printer);
  87.  
  88.   fputs(" # RSL PSL AR ",printer);
  89.   fputs("Name                                    File     Age Msgs   Type\n",printer);
  90.  
  91.  
  92.   for (i=0;i<num_subs;i++)
  93.    {
  94.      sub=subboards[i];
  95. /*here's where we print things out! */
  96.  
  97.      s2[0]=0;
  98.      if (sub.ar!=0) {
  99.       for (j=0; j<16; j++)
  100.     if ((1 << j) & sub.ar)
  101.       s2[0]='A'+j;
  102.       s2[1]=0;}
  103.      sprintf(s,"%2u %3u %3u %1s  %-38.38s  %-8s  %2u  %3u  %5u\n",
  104.         i+1,sub.readsl,sub.postsl,s2,sub.name,sub.filename,
  105.         sub.age,sub.maxmsgs,sub.type);
  106.      fputs(s,printer);
  107.    }
  108.  
  109.   fputs("\f",printer);
  110.   fclose(printer);
  111.   }