- next if $line =~ m/^\#/;
- next if $line =~ m/^\s*$/;
-
- if ($line =~ m/^(\t| )(\w+): (.+)/){
- my $par = $2;
- my $value = $3;
-
- if ($par eq 'source_pool') {
- $cfg->{$source}->{$sync_name}->{$par} = $value;
- die "error in Config: SourcePool value doubled\n" if ($check & 1);
- $check += 1;
- } elsif ($par eq 'source_ip') {
- $cfg->{$source}->{$sync_name}->{$par} = $value;
- die "error in Config: SourceIP value doubled\n" if ($check & 2);
- $check += 2;
- } elsif ($par eq 'status') {
- $cfg->{$source}->{$sync_name}->{$par} = $value;
- die "error in Config: Status value doubled\n" if ($check & 4);
- $check += 4;
- } elsif ($par eq 'method') {
- $cfg -> {$source}->{$sync_name}->{$par} = $value;
- die "error in Config: Method value doubled\n" if ($check & 8);
- $check += 8;
- } elsif ($par eq 'interval') {
- $cfg -> {$source}->{$sync_name}->{$par} = $value;
- die "error in Config: Iterval value doubled\n" if ($check & 16);
- $check += 16;
- } elsif ($par eq 'limit') {
- $cfg -> {$source}->{$sync_name}->{$par} = $value;
- die "error in Config: Limit value doubled\n" if ($check & 32);
- $check += 32;
- } elsif ($par eq 'dest_pool') {
- $cfg -> {$source}->{$sync_name}->{$par} = $value;
- die "error in Config: DestPool value doubled\n" if ($check & 64);
- $check += 64;
- } elsif ($par eq 'dest_ip') {
- $cfg -> {$source}->{$sync_name}->{$par} = $value;
- die "error in Config: DestIp value doubled\n" if ($check & 128);
- $check += 128;
- } elsif ($par eq 'dest_path') {
- $cfg -> {$source}->{$sync_name}->{$par} = $value;
- die "error in Config: DestPath value doubled\n" if ($check & 256);
- $check += 256;
- } elsif ($par eq 'source_path') {
- $cfg -> {$source}->{$sync_name}->{$par} = $value;
- die "error in Config: SourcePath value doubled\n" if ($check & 512);
- $check += 512;
- } elsif ($par eq 'vmid') {
- $cfg -> {$source}->{$sync_name}->{$par} = $value;
- die "error in Config: Vmid value doubled\n" if ($check & 1024);
- $check += 1024;
- } elsif ($par =~ 'lsync') {
- $cfg->{$source}->{$sync_name}->{$par} = $value;
- die "error in Config: lsync value doubled\n" if ($check & 2048);
- $check += 2048;
- } elsif ($par =~ 'maxsnap') {
- $cfg->{$source}->{$sync_name}->{$par} = $value;
- die "error in Config: maxsnap value doubled\n" if ($check & 4096);
- $check += 4096;
- } else {
- die "error in Config\n";
- }
- } elsif ($line =~ m/^((\d+.\d+.\d+.\d+):)?([\w\-\_\/]+): (.+){0,1}/){
- $source = $3;
- $sync_name = $4 ? $4 : 'default' ;
- $cfg->{$source}->{$sync_name} = undef;
- $cfg->{$source}->{$sync_name}->{source_ip} = $2 if $2;
- $check = 0;
+ while (my $line = shift(@text)) {
+
+ my @arg = split('\s', $line);
+ my $param = parse_argv(@arg);
+
+ if ($param->{source} && $param->{dest}) {
+ $cfg->{$param->{source}}->{$param->{name}}->{dest} = $param->{dest};
+ $cfg->{$param->{source}}->{$param->{name}}->{verbose} = $param->{verbose};
+ $cfg->{$param->{source}}->{$param->{name}}->{limit} = $param->{limit};
+ $cfg->{$param->{source}}->{$param->{name}}->{maxsnap} = $param->{maxsnap};
+ $cfg->{$param->{source}}->{$param->{name}}->{skip} = $param->{skip};
+ $cfg->{$param->{source}}->{$param->{name}}->{method} = $param->{method};