3 # Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
18 open FILE
, "$file" or die "can't open file";
21 /^CONFIG_(.+?)=(.+)/ and do {
25 /^# CONFIG_(.+?) is not set/ and do {
26 $config{$1} = "#undef";
30 /^(.+)$/ and print "WARNING: can't parse line: $1\n";
41 foreach my $config (keys %$cfg1) {
42 my $val1 = $cfg1->{$config};
43 my $val2 = $cfg2->{$config};
44 $val2 and ($val1 eq $val2) and do {
45 $config{$config} = $val1;
61 foreach my $config (keys %cfg) {
62 next if $mod_plus and $config{$config} and $config{$config} eq "y";
63 $config{$config} = $cfg{$config};
74 foreach my $config (keys %$cfg2) {
75 if (!defined($cfg1->{$config}) or $cfg1->{$config} ne $cfg2->{$config}) {
76 $config{$config} = $cfg2->{$config};
85 my %config = %{$cfg1};
87 foreach my $config (keys %$cfg2) {
88 delete $config{$config};
93 sub print_cfgline
($$) {
96 if ($val eq '#undef') {
97 print "# CONFIG_$name is not set\n";
99 print "CONFIG_$name=$val\n";
106 die "argument error in dump_config" unless ($cfg);
108 foreach my $config (sort keys %config) {
109 print_cfgline
($config, $config{$config});
117 my $arg = $arg[$$pos++];
119 die "Parse error" if (!$arg);
122 my $arg1 = parse_expr
($pos);
123 my $arg2 = parse_expr
($pos);
124 return config_and
($arg1, $arg2);
125 } elsif ($arg =~ /^\+/) {
126 my $arg1 = parse_expr
($pos);
127 my $arg2 = parse_expr
($pos);
128 return config_add
($arg1, $arg2, 0);
129 } elsif ($arg =~ /^m\+/) {
130 my $arg1 = parse_expr
($pos);
131 my $arg2 = parse_expr
($pos);
132 return config_add
($arg1, $arg2, 1);
133 } elsif ($arg eq '>') {
134 my $arg1 = parse_expr
($pos);
135 my $arg2 = parse_expr
($pos);
136 return config_diff
($arg1, $arg2);
137 } elsif ($arg eq '-') {
138 my $arg1 = parse_expr
($pos);
139 my $arg2 = parse_expr
($pos);
140 return config_sub
($arg1, $arg2);
142 return load_config
($arg);
147 dump_config
(parse_expr
(\
$pos));
148 die "Parse error" if ($arg[$pos]);
This page took 0.051928 seconds and 5 git commands to generate.