]>
git.ipfire.org Git - thirdparty/squid.git/blob - scripts/split-cf.data.pre.pl
3 ## Copyright (C) 1996-2018 The Squid Software Foundation and contributors
5 ## Squid software is distributed under GPLv2+ license and includes
6 ## contributions from numerous individuals and organizations.
7 ## Please see the COPYING and CONTRIBUTORS files for details.
15 # This mess is designed to parse the squid config template file
16 # cf.data.pre and split it into separare files, one per option
18 # Henrik Nordstrom <henrik@henriknordstrom.net>
21 # The template file is reasonably simple to parse. There's a number of
22 # directives which delineate sections but there's no section delineation.
23 # A section will "look" somewhat like this, most of the time:
25 # IFDEF: <the ifdef bit>
26 # TYPE: <the config type>
27 # DEFAULT: <the default value>
28 # LOC: <location in the Config struct>
30 # documentation goes here
32 # stuff which goes verbatim into the config file goes here
36 # or alternatively instead of the DOC_START/DOC_END block just
37 # DOC_NONE if the option is documented by the next option
39 # Configuration sections are broken up by COMMENT_START/COMMENT_END
40 # bits, which we can use in the top-level index page.
46 my ($index) = new IO
::File
;
47 my ($out) = new IO
::File
;
50 my $top = dirname
($0);
53 'verbose' => \
$verbose, 'v' => \
$verbose,
60 return $path . "/" . $name . ".txt";
63 $index->open(filename
("0-index"), "w") || die "Couldn't open ".filename
("0-index").": $!\n";
67 print $index $_."\n" if !defined $name;
69 if ($_ =~ /^NAME: (.*)$/) {
70 print "DEBUG: new option: $name\n" if $verbose;
72 my (@aliases) = split(/ /, $1);
73 $name = shift @aliases;
75 $out->open(filename
($name), "w") || die "Couldn't open ".filename
($name).": $!\n";
77 print $out $_."\n" if defined $name;
79 if ($_ =~ /^DOC_END/ ||