home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
WWIVMODS
/
MODSUNKN.ZIP
/
ARPRINT.C
< prev
next >
Wrap
Text File
|
1990-04-28
|
6KB
|
232 lines
/*ARPrint.c */
/* Elric22.zip*/
/*
This program will print out a list of directories, message bases, games, and
gfiles sections. I have been wanting something like this for a long time,
so I wrote it. What could it possibly be good for? Well, let's say you were
in a situation where you needed to put in a new message base for you and 4
other people for a class project you are working on. So you assign it an AR
or A. But then you find out you used that for your "adult" discussion base,
and now 37 other people have access to it. This program is designed to
prevent exactly that sort of problem.
If you use this, the only payment I ask is that you send me a
note through WWIVNet to 1@8251 saying you are using it...not too much to
ask is it?
If you have any problems, you can reach me through WWIV-Net, 1@8251, or call
my BBS.
The Kingdom of Melnibone
812-877-3488 24 Hrs a day
3/12/2400/4800/9600/12,000/14,400 baud HST MNP5
Auto-validation of WWIV sysops on first call
Xmodem, Ymodem, DSZ Zmodem with retry, Ymodem-G
Lord Elric
*/
#include <io.h>
#include <stdio.h>
#include <fcntl.h>
#include "vardec.h"
int configfile,dirsfile,gamesfile,gfilesfile,subsfile;
FILE *printer;
int num_dirs,num_subs,num_games,num_gfiles;
directoryrec dirs[64];
subboardrec subs[64];
chainfilerec games[50];
gfiledirrec gfiles[32];
configrec syscfg;
int i,j,k;
unsigned short AR;
char s[81],s2[3];
void main()
{
char s3[80],ch;
char a1[10];
configfile=-1;
strcpy(s,"CONFIG.DAT");
configfile=open(s,O_RDWR | O_BINARY);
if (configfile<0) {
printf("%s NOT FOUND.\n",s);
printf("This program must be run from the main BBS directory");
exit(0);
}
read(configfile,(void *) (&syscfg), sizeof(configrec));
close(configfile);
dirsfile=-1;
strcpy(s,syscfg.datadir);
strcat(s,"DIRS.DAT");
dirsfile=open(s,O_RDWR | O_BINARY);
if (dirsfile<0) {
printf("%s NOT FOUND.\n",s);
exit(0);
}
num_dirs=(read(dirsfile,(void *) (&dirs), (64*sizeof(directoryrec))))/
sizeof(directoryrec);
close(dirsfile);
subsfile=-1;
strcpy(s,syscfg.datadir);
strcat(s,"SUBS.DAT");
subsfile=open(s,O_RDWR | O_BINARY);
if (subsfile<0) {
printf("%s NOT FOUND.\n",s);
exit(0);
}
num_subs=(read(subsfile,(void *) (&subs), (64*sizeof(subboardrec))))/
sizeof(subboardrec);
close(subsfile);
gamesfile=-1;
strcpy(s,syscfg.datadir);
strcat(s,"CHAINS.DAT");
gamesfile=open(s,O_RDWR | O_BINARY);
if (gamesfile<0) {
printf("%s NOT FOUND.\n",s);
exit(0);
}
num_games=(read(gamesfile,(void *) (&games), (64*sizeof(chainfilerec))))/
sizeof(chainfilerec);
close(gamesfile);
gfilesfile=-1;
strcpy(s,syscfg.datadir);
strcat(s,"GFILE.DAT");
gfilesfile=open(s,O_RDWR | O_BINARY);
if (gfilesfile<0) {
printf("%s NOT FOUND.\n",s);
exit(0);
}
num_gfiles=(read(gfilesfile,(void *) (&gfiles), (64*sizeof(gfiledirrec))))/
sizeof(gfiledirrec);
close(gfilesfile);
printf("Welcome to AR Print.\n");
printf("Written By Lord Elric AKA Wayne McDaniel\n");
printf("This program is for use with WWIV 4.xx\n");
printf("Please contact Lord Elric, 1@8251 WWIVNet, with any problems\n");
printf("Or call The Kingdom Of Melnibone BBS, 1-812-877-3488\n");
printf("This is officially Elric's Mod #22\n\n");
printf("Please enter the name of the file\n");
printf("you wish to send this report to. Hit Return for printer.\n");
printf("?");
gets(s3);
if (s3[0]==0)
strcpy(s3,"prn");
printer=fopen(s3,"w");
if (printer==NULL) {
printf("Cannot access printer\n");
exit(0);
}
sprintf(s,"\nComplete AR Listing for %s\n\n",syscfg.systemname);
fputs(s,printer);
for (i=0;i<17;i++) {
/* first set up our AR letter, mask, and everything */
a1[0]='A'+i;
a1[1]=0;
if (i<16)
AR=1L << i;
else
AR=0L;
if (i==16)
strcpy(a1,"none");
sprintf(s,"Listing for AR: %s\n",a1);
fputs(s,printer);
fputs("-----------------------\n",printer);
/* Now let's cycle through the Message bases */
sprintf(s,"Message Bases with AR : %s\n",a1);
fputs(s,printer);
fputs("Base ReadSL PostSL Age Name\n",printer);
fputs("--------------------------------------------------------\n",printer);
j=0; /* set our count of found subs to 0 */
for (k=0;k<num_subs;k++) {
if (subs[k].ar==AR) {
sprintf(s," %2d %3d %3d %2d %-50s\n",++j,
subs[k].readsl,subs[k].postsl,subs[k].age,subs[k].name);
fputs(s,printer);
}
}
if (j==0)
fputs("none\n",printer);
fputs("\n\n",printer);
/* Now let's cycle through the Games */
sprintf(s,"Games with AR : %s\n",a1);
fputs(s,printer);
fputs("Game SL Name\n-------------------------------\n",printer);
j=0; /* set our count of found games to 0 */
for (k=0;k<num_games;k++) {
if (games[k].ar==AR) {
sprintf(s," %2d %3d %-65s\n",++j,
games[k].sl,games[k].description);
fputs(s,printer);
}
}
if (j==0)
fputs("none\n",printer);
fputs("\n\n",printer);
/* Now let's cycle through the Gfile Sections */
sprintf(s,"Gfile Sections with AR : %s\n",a1);
fputs(s,printer);
fputs("Base SL Age Name\n",printer);
fputs("--------------------------------------------------------\n",printer);
j=0; /* set our count of found subs to 0 */
for (k=0;k<num_gfiles;k++) {
if (gfiles[k].ar==AR) {
sprintf(s," %2d %3d %2d %-50s\n",++j,
gfiles[k].sl,gfiles[k].age,gfiles[k].name);
fputs(s,printer);
}
}
if (j==0)
fputs("none\n",printer);
fputs("\n\n",printer);
/* Now let's cycle through the Transfer dirs */
sprintf(s,"Transfer Directories with DAR : %s\n",a1);
fputs(s,printer);
fputs("Dir DSL Age Name\n",printer);
fputs("--------------------------------------------------------\n",printer);
j=0; /* set our count of found subs to 0 */
for (k=0;k<num_dirs;k++) {
if (dirs[k].dar==AR) {
sprintf(s," %2d %3d %2d %-50s\n",++j,
dirs[k].dsl,dirs[k].age,dirs[k].name);
fputs(s,printer);
}
}
if (j==0)
fputs("none\n",printer);
fputs("\n\n",printer);
}
fputs("\f",printer);
fclose(printer);
}