version 1.1.1.1, 2012/02/17 15:09:30
|
version 1.1.1.3, 2021/03/17 00:32:36
|
Line 1
|
Line 1
|
#!/usr/bin/perl | #!/usr/bin/env perl |
# This script outputs some perl code that parses all possible options |
# This script outputs some perl code that parses all possible options |
# that the code in options.c might send to the server. This perl code |
# that the code in options.c might send to the server. This perl code |
# is included in the rrsync script. |
# is included in the rrsync script. |
use strict; |
use strict; |
|
|
our %short_no_arg; |
our %short_no_arg; |
our %short_with_num; | our %short_with_num = ( '@' => 1 ); |
our %long_opt = ( | our %long_opt = ( # These include some extra long-args that BackupPC uses: |
| 'block-size' => 1, |
'daemon' => -1, |
'daemon' => -1, |
|
'debug' => 1, |
'fake-super' => 0, |
'fake-super' => 0, |
|
'fuzzy' => 0, |
|
'group' => 0, |
|
'hard-links' => 0, |
|
'ignore-times' => 0, |
|
'info' => 1, |
|
'links' => 0, |
'log-file' => 3, |
'log-file' => 3, |
|
'one-file-system' => 0, |
|
'owner' => 0, |
|
'perms' => 0, |
|
'recursive' => 0, |
|
'times' => 0, |
|
'write-devices' => -1, |
); |
); |
our $last_long_opt; |
our $last_long_opt; |
|
|
Line 26 while (<IN>) {
|
Line 40 while (<IN>) {
|
$last_long_opt = $1; |
$last_long_opt = $1; |
$long_opt{$1} = 0 unless exists $long_opt{$1}; |
$long_opt{$1} = 0 unless exists $long_opt{$1}; |
} elsif (defined($last_long_opt) |
} elsif (defined($last_long_opt) |
&& /\Qargs[ac++]\E = ([^["\s]+);/ && $1 ne 'dest_option') { | && /\Qargs[ac++]\E = ([^["\s]+);/) { |
$long_opt{$last_long_opt} = 2; |
$long_opt{$last_long_opt} = 2; |
undef $last_long_opt; |
undef $last_long_opt; |
} elsif (/dest_option = "--([^"]+)"/) { | } elsif (/return "--([^"]+-dest)";/) { |
$long_opt{$1} = 2; |
$long_opt{$1} = 2; |
undef $last_long_opt; |
undef $last_long_opt; |
} elsif (/\Qasprintf(\E[^,]+, "--([^"=]+)=/ || /\Qargs[ac++]\E = "--([^"=]+)=/) { | } elsif (/\Qasprintf(\E[^,]+, "--([^"=]+)=/ || /\Qargs[ac++]\E = "--([^"=]+)=/ || /fmt = .*: "--([^"=]+)=/) { |
$long_opt{$1} = 1; |
$long_opt{$1} = 1; |
undef $last_long_opt; |
undef $last_long_opt; |
} |
} |
Line 63 foreach my $opt (sort keys %long_opt) {
|
Line 77 foreach my $opt (sort keys %long_opt) {
|
my $val = $long_opt{$opt}; |
my $val = $long_opt{$opt}; |
$val = 1 if $opt =~ /^(max-|min-)/; |
$val = 1 if $opt =~ /^(max-|min-)/; |
$val = 3 if $opt eq 'files-from'; |
$val = 3 if $opt eq 'files-from'; |
$val = '$ro ? -1 : ' . $val if $opt =~ /^remove-/; | $val = q"$only eq 'r' ? -1 : " . $val if $opt =~ /^(remove-|log-file)/; |
| $val = q"$only eq 'w' ? -1 : " . $val if $opt eq 'sender'; |
print " '$opt' => $val,\n"; |
print " '$opt' => $val,\n"; |
} |
} |
|
|