a45253729cc48fa4d8cfb8c00ea7dcd9df36b0fa
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 {
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;
60 foreach my $config (keys %cfg) {
61 $config{$config} = $cfg{$config};
72 foreach my $config (keys %$cfg2) {
73 if (!$cfg1->{$config} or $cfg1->{$config} ne $cfg2->{$config}) {
74 $config{$config} = $cfg2->{$config};
83 my %config = %{$cfg1};
85 foreach my $config (keys %$cfg2) {
86 delete $config{$config};
91 sub print_cfgline
($$) {
95 print "# CONFIG_$name is not set\n";
97 print "CONFIG_$name=$val\n";
104 die "argument error in dump_config" unless ($cfg);
106 foreach my $config (sort keys %config) {
107 print_cfgline
($config, $config{$config});
115 my $arg = $arg[$$pos++];
117 die "Parse error" if (!$arg);
120 my $arg1 = parse_expr
($pos);
121 my $arg2 = parse_expr
($pos);
122 return config_and
($arg1, $arg2);
123 } elsif ($arg =~ /^\+/) {
124 my $arg1 = parse_expr
($pos);
125 my $arg2 = parse_expr
($pos);
126 return config_add
($arg1, $arg2);
127 } elsif ($arg eq '>') {
128 my $arg1 = parse_expr
($pos);
129 my $arg2 = parse_expr
($pos);
130 return config_diff
($arg1, $arg2);
131 } elsif ($arg eq '-') {
132 my $arg1 = parse_expr
($pos);
133 my $arg2 = parse_expr
($pos);
134 return config_sub
($arg1, $arg2);
136 return load_config
($arg);
141 dump_config
(parse_expr
(\
$pos));
142 die "Parse error" if ($arg[$pos]);
This page took 0.047014 seconds and 3 git commands to generate.