home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
UTIL
/
WWIVE
/
OLDDEV.ARJ
/
NETINIT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-04-08
|
2KB
|
74 lines
/****************************************************************************
*
* This program should be used by registered WWIV sysops with modified
* userrecords. Compile this with your modified vardec.h, and run it
* in your main WWIV directory. It will appropriately update your
* config.dat file.
*
****************************************************************************/
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <dos.h>
#include <stdlib.h>
#include <string.h>
#include "vardec.h"
int f,configfile,urlen,uroff,nl,no,uroff1,no1;
configrec syscfg;
char ch,s[81];
userrec *u;
void main()
{
printf("The netinit program is a utility for registered WWIV sysops.\n");
printf("It is necessary to run netinit.exe ONLY if you are a registered WWIV sysop and\n");
printf("have modified some of the data in the vardec.h file.\n\n");
printf("Compile (with your modified vardec.h file) and run netinit, and it\n");
printf("will set the appropriate fields in the config.dat file.\n\n");
configfile=open("CONFIG.DAT",O_RDWR | O_BINARY);
if (configfile<0) {
printf("CONFIG.DAT NOT FOUND.\n");
exit(1);
}
read(configfile,(&syscfg), sizeof(configrec));
close(configfile);
/* these are the default values */
urlen=700;
uroff=423;
uroff1=385;
/* doesn't hurt to put them in here, even though they'll be overwritten */
if (syscfg.userreclen==0)
syscfg.userreclen=urlen;
if (syscfg.waitingoffset==0)
syscfg.waitingoffset=uroff;
if (syscfg.inactoffset==0)
syscfg.inactoffset=uroff1;
/* find the new values to use */
urlen=sizeof(userrec);
uroff=FP_OFF(&(u->waiting))-FP_OFF(u->name);
uroff1=FP_OFF(&(u->inact))-FP_OFF(u->name);
/* tell the user what the new values are */
printf("setting: userreclen=%d, waitingoffset=%d, inactoffset=%d\n\n",
urlen, uroff, uroff1);
/* put the new values into the syscfg structure */
syscfg.userreclen=urlen;
syscfg.waitingoffset=uroff;
syscfg.inactoffset=uroff1;
/* store the new config.dat file */
configfile=open("CONFIG.DAT",O_RDWR | O_BINARY);
write(configfile,(void *) (&syscfg), sizeof(configrec));
close(configfile);
printf("\nConfiguration set.\n");
}