|
|
1.1 ! root 1: /* SBLPACK.C */ ! 2: ! 3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */ ! 4: ! 5: /***************************************/ ! 6: /* Synchronet BBS List Database Packer */ ! 7: /***************************************/ ! 8: ! 9: #include <stdio.h> ! 10: #include <share.h> ! 11: #include <time.h> ! 12: #include <io.h> ! 13: #include <fcntl.h> ! 14: #include <sys/stat.h> ! 15: #include "gen_defs.h" ! 16: #include "sbldefs.h" ! 17: ! 18: int main(void) ! 19: { ! 20: int file; ! 21: FILE *in,*out; ! 22: bbs_t bbs; ! 23: ! 24: printf("\nSBLPACK v1.00 Developed 1995-1997 Rob Swindell\n\n"); ! 25: ! 26: if((file=open("SBL.DAB",O_RDWR|O_BINARY|O_DENYNONE|O_CREAT ! 27: ,S_IWRITE|S_IREAD))==-1) { ! 28: printf("\n\7Error opening/creating SBL.DAB\n"); ! 29: exit(1); } ! 30: if((in=fdopen(file,"w+b"))==NULL) { ! 31: printf("\n\7Error converting SBL.DAB file handle to stream\n"); ! 32: exit(1); } ! 33: setvbuf(in,0L,_IOFBF,2048); ! 34: if((out=fopen("SBL.TMP","wb"))==NULL) { ! 35: printf("\n\7Error opening SBL.TMP file\n"); ! 36: exit(1); } ! 37: ! 38: while(!feof(in)) { ! 39: if(!fread(&bbs,sizeof(bbs_t),1,in)) ! 40: break; ! 41: putchar('.'); ! 42: if(!bbs.name[0]) ! 43: continue; ! 44: fwrite(&bbs,sizeof(bbs_t),1,out); } ! 45: fcloseall(); ! 46: putchar('\n'); ! 47: if(remove("SBL.DAB")) { ! 48: printf("\n\7Data file in use, can't remove.\n"); ! 49: remove("SBL.TMP"); ! 50: exit(1); } ! 51: rename("SBL.TMP","SBL.DAB"); ! 52: printf("\nDone.\n"); ! 53: return(0); ! 54: } ! 55:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.