]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Add cftest flag which just tests config file but doesn't actually run.
authorTed Lemon <source@isc.org>
Mon, 2 Jun 1997 23:26:29 +0000 (23:26 +0000)
committerTed Lemon <source@isc.org>
Mon, 2 Jun 1997 23:26:29 +0000 (23:26 +0000)
server/dhcpd.c

index bb7b58329f2bd05c21a2c54f2ee3979ba31875b0..4a29a09b3b3bac1bbf2506efdaf5ae51a1f97cf3 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhcpd.c,v 1.41 1997/05/09 08:27:56 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
+"$Id: dhcpd.c,v 1.42 1997/06/02 23:26:29 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
 #endif
 
 static char copyright[] =
@@ -85,6 +85,7 @@ int main (argc, argv, envp)
        int i, status;
        struct servent *ent;
        char *s;
+       int cftest;
 #ifndef DEBUG
        int pidfilewritten = 0;
        int pid;
@@ -143,6 +144,13 @@ int main (argc, argv, envp)
                        if (++i == argc)
                                usage ();
                        path_dhcpd_db = argv [i];
+                } else if (!strcmp (argv [i], "-t")) {
+                       /* test configurations only */
+#ifndef DEBUG
+                       daemon = 0;
+#endif
+                       cftest = 1;
+                       log_perror = -1;
                } else if (argv [i][0] == '-') {
                        usage ();
                } else {
@@ -216,6 +224,10 @@ int main (argc, argv, envp)
        if (!readconf ())
                error ("Configuration file errors encountered -- exiting");
 
+        /* test option should cause an early exit */
+       if (cftest) 
+               exit(0);
+
        /* Start up the database... */
        db_startup ();