home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
WWIVMODS
/
PRE412.ZIP
/
UPRINT.C
< prev
next >
Wrap
Text File
|
1990-05-02
|
3KB
|
108 lines
/* ELRIC12.MOD */
/* Print out user stats, V1.1 */
/* Written by Lord Elric AKA Wayne McDaniel */
/* Dedicated to Slug-Bug */
/* WWIVNet 1@8251 WWIV Link 1@18251*/
/* Thanks to The Black Dragon for some clues on file opening/closing/reading.
You are free to use/modify/distribute this however you desire, as long as
you leave the credits alone, except to add your own. */
#include <stdio.h>
#include <string.h>
#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
#include "vardec.h"
char userfile[81];
int configfile;
configrec syscfg;
void print_recs(char *outfile)
{
FILE *prnt;
int f,i;
unsigned int loop,num=0;
unsigned long len;
userrec user;
char line[81];
if ((f=open(userfile,O_RDWR|O_BINARY,S_IREAD|S_IWRITE))<=0)
{
printf("\nCould not open user list %s\n",userfile);
abort();
}
if ((prnt=fopen(outfile,"w"))==NULL)
{
printf("Can't access printer! ");
abort();
}
len=filelength(f);
num=(len/sizeof(userrec))+!(len%sizeof(userrec));
for (loop=0;loop<=num;loop++)
{
if (sizeof(userrec)==read(f,&user,sizeof(userrec))) {
if (loop>0) {
printf("\015Printing user #%u of %u",loop,(num-1));
if (!(user.inact)) {
if (loop>1)
fputs("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n",prnt);
sprintf(line,"# %4d Handle: %-30s Name: %-20s\n",
loop,user.name,user.realname);
fputs(line,prnt);
sprintf(line,"Phone: %s Posts: %5d Mails: %5d FeedBacks %5d\n",
user.phone,user.msgpost,user.emailsent,user.feedbacksent);
fputs(line,prnt);
sprintf(line,"Logons: %4d Uploads: %3d Downloads: %3d\n",
user.logons,user.uploaded,user.downloaded);
fputs(line,prnt);
sprintf(line,"Age: %2d Birthday %02d/%02d/%02d\n\n",user.age,
user.month,user.day,user.year);
fputs(line,prnt);}
}
}
}
close(f);
fclose(prnt);
}
main()
{
char out[81];
char s[81];
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);
sprintf(userfile,"%sUSER.LST",syscfg.datadir);
printf("\n\nUser Stats printout for WWIV 4.xx\n");
printf("By Lord Elric 1@2851 WWIVnet\n\n");
printf("If you have modified you VARDEC.H file, you need\n");
printf("to recompile this, or you will get bad data....\n\n");
printf("Enter name of output file\n<CR> will send to printer\n");
gets(out);
if (out[0]==0)
strcpy(out,"prn");
print_recs(out);
}