From: Ted Lemon Date: Fri, 1 Oct 1999 03:26:01 +0000 (+0000) Subject: Implement -T flag. X-Git-Tag: V3-BETA-1-PATCH-2~5^2~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f450cacb8bbd58ddf714dcf9a300ec9a60272b4;p=thirdparty%2Fdhcp.git Implement -T flag. --- diff --git a/server/dhcpd.c b/server/dhcpd.c index d55b93c33..7010c05f2 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -22,7 +22,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhcpd.c,v 1.73 1999/09/09 21:11:27 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; +"$Id: dhcpd.c,v 1.74 1999/10/01 03:26:01 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; #endif static char copyright[] = @@ -69,6 +69,7 @@ int main (argc, argv, envp) struct servent *ent; char *s; int cftest = 0; + int lftest = 0; #ifndef DEBUG int pidfilewritten = 0; int pid; @@ -145,6 +146,14 @@ int main (argc, argv, envp) #endif cftest = 1; log_perror = -1; + } else if (!strcmp (argv [i], "-T")) { + /* test configurations and lease file only */ +#ifndef DEBUG + daemon = 0; +#endif + cftest = 1; + lftest = 1; + log_perror = -1; } else if (!strcmp (argv [i], "-q")) { quiet = 1; quiet_interface_discovery = 1; @@ -225,15 +234,18 @@ int main (argc, argv, envp) dhcp_db_objects_setup (); /* Read the dhcpd.conf file... */ - if (!readconf ()) + if (readconf () != ISC_R_SUCCESS) log_fatal ("Configuration file errors encountered -- exiting"); /* test option should cause an early exit */ - if (cftest) + if (cftest && !lftest) exit(0); /* Start up the database... */ - db_startup (); + db_startup (lftest); + + if (lftest) + exit (0); /* Discover all the network interfaces and initialize them. */ discover_interfaces (DISCOVER_SERVER);