diff src/config/settings-get.pl @ 9011:c37f7113b1ee HEAD

doveconf now checks that all settings are ok by calling check functions.
author Timo Sirainen <tss@iki.fi>
date Mon, 09 Feb 2009 18:00:59 -0500
parents 9d0037a997f4
children 6324a79d3ee1
line wrap: on
line diff
--- a/src/config/settings-get.pl	Tue Feb 03 12:05:35 2009 -0500
+++ b/src/config/settings-get.pl	Mon Feb 09 18:00:59 2009 -0500
@@ -2,9 +2,11 @@
 use strict;
 
 print '#include "lib.h"'."\n";
+print '#include "array.h"'."\n";
 print '#include "settings-parser.h"'."\n";
 print '#include "all-settings.h"'."\n";
 print '#include <stddef.h>'."\n";
+print '#include <unistd.h>'."\n";
 print '#define CONFIG_BINARY'."\n";
 
 my %parsers = {};
@@ -16,6 +18,8 @@
   my $state = 0;
   my $file_contents = "";
   my $externs = "";
+  my $code = "";
+  my %funcs;
   
   while (<$f>) {
     my $write = 0;
@@ -29,6 +33,9 @@
 	$parsers{$2} = 1;
       } elsif (/^extern struct setting_parser_info (.*);/) {
 	$externs .= "extern struct setting_parser_info $1;\n";
+      } elsif (/\/\* <settings checks> \*\//) {
+	$state = 4;
+	$code .= $_;
       }
 
       if (/#define.*DEF/ || /^#undef.*DEF/) {
@@ -38,6 +45,9 @@
     } elsif ($state == 2) {
       $write = 1;
       $state = 0 if (!/\\$/);
+    } elsif ($state == 4) {
+      $code .= $_;
+      $state = 0 if (/\/\* <\/settings checks> \*\//);
     }
     
     if ($state == 1 || $state == 3) {
@@ -68,6 +78,7 @@
   
   print "/* $file */\n";
   print $externs;
+  print $code;
   print $file_contents;
 
   close $f;