summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorGravatar Lucien Van Elsen <lwvanels@mit.edu>1992-01-17 02:48:44 +0000
committerGravatar Lucien Van Elsen <lwvanels@mit.edu>1992-01-17 02:48:44 +0000
commite478e7488e6b5fc84c1b647c59df8557a66a5f4c (patch)
treec3fd8691c69d3469de13dd8f8c86ca5e97837c49 /server
parentd4c1ce69b8a6c8c14c36c796fd5f19064ecb2ca0 (diff)
add stub function for init'ing db from file on startup
turn off other debugging info (for speed) always increment reference counts when dup'ing zstrings.
Diffstat (limited to 'server')
-rw-r--r--server/main.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/server/main.c b/server/main.c
index 08ff333..eac9c33 100644
--- a/server/main.c
+++ b/server/main.c
@@ -98,6 +98,7 @@ static SIGNAL_RETURN_TYPE bye P((int sig)), dbug_on P((int)),
dbug_off P((int));
static SIGNAL_RETURN_TYPE dump_db P((int)), reset P((int)), reap P((int));
static SIGNAL_RETURN_TYPE dump_strings P((int));
+static void read_from_dump P((char *dumpfile));
#ifndef DEBUG
static void detach P((void));
#endif /* DEBUG */
@@ -132,6 +133,7 @@ u_long npackets; /* number of packets processed */
long uptime; /* when we started operations */
static int nofork;
struct in_addr my_addr;
+char *bdump_version = "1";
int
main(argc, argv)
@@ -141,6 +143,8 @@ main(argc, argv)
int nfound; /* #fildes ready on select */
fd_set readable;
struct timeval *tvp;
+ int init_from_dump = 0;
+ char *dumpfile;
#ifdef _POSIX_SOURCE
struct sigaction action;
/* Set up sigaction structure */
@@ -161,7 +165,7 @@ main(argc, argv)
/* process arguments */
- while ((optchar = getopt(argc, argv, "dsn")) != EOF) {
+ while ((optchar = getopt(argc, argv, "dsnv:f:")) != EOF) {
switch(optchar) {
case 'd':
zdebug = 1;
@@ -174,6 +178,13 @@ main(argc, argv)
case 'n':
nofork = 1;
break;
+ case 'v':
+ bdump_version = optarg;
+ break;
+ case 'f':
+ init_from_dump = 0;
+ dumpfile = optarg;
+ break;
case '?':
default:
usage();
@@ -221,6 +232,9 @@ main(argc, argv)
if (initialize())
exit(1);
+ if (init_from_dump)
+ read_from_dump(dumpfile);
+
/* Seed random number set. */
srandom (getpid () ^ time (0));
@@ -415,8 +429,8 @@ initialize()
matchall_sub.q_forw = &matchall_sub;
matchall_sub.q_back = &matchall_sub;
matchall_sub.zst_dest.classname = wildcard_class;
- matchall_sub.zst_dest.inst = empty;
- matchall_sub.zst_dest.recip = empty;
+ matchall_sub.zst_dest.inst = dup_zstring(empty);
+ matchall_sub.zst_dest.recip = dup_zstring(empty);
set_ZDestination_hash(&matchall_sub.zst_dest);
/* restrict certain classes */
@@ -490,9 +504,9 @@ static void
usage()
{
#ifdef DEBUG
- fprintf(stderr,"Usage: %s [-d] [-s] [-n]\n",programname);
+ fprintf(stderr,"Usage: %s [-d] [-s] [-n] [-f dumpfile]\n",programname);
#else
- fprintf(stderr,"Usage: %s [-d] [-n]\n",programname);
+ fprintf(stderr,"Usage: %s [-d] [-n] [-f dumpfile]\n",programname);
#endif /* DEBUG */
exit(2);
}
@@ -595,7 +609,7 @@ dump_db(int sig)
static SIGNAL_RETURN_TYPE
reset(int sig)
{
-#if 0
+#if 1
zdbug((LOG_DEBUG,"reset()"));
#endif
doreset = 1;
@@ -672,3 +686,10 @@ detach()
(void) close(i);
}
#endif
+
+static void
+read_from_dump(dumpfile)
+ char *dumpfile;
+{
+ return;
+}