--- embedaddon/rsync/packaging/cull_options 2012/02/17 15:09:30 1.1 +++ embedaddon/rsync/packaging/cull_options 2021/03/17 00:32:36 1.1.1.3 @@ -1,15 +1,29 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # 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 # is included in the rrsync script. use strict; our %short_no_arg; -our %short_with_num; -our %long_opt = ( +our %short_with_num = ( '@' => 1 ); +our %long_opt = ( # These include some extra long-args that BackupPC uses: + 'block-size' => 1, 'daemon' => -1, + 'debug' => 1, 'fake-super' => 0, + 'fuzzy' => 0, + 'group' => 0, + 'hard-links' => 0, + 'ignore-times' => 0, + 'info' => 1, + 'links' => 0, 'log-file' => 3, + 'one-file-system' => 0, + 'owner' => 0, + 'perms' => 0, + 'recursive' => 0, + 'times' => 0, + 'write-devices' => -1, ); our $last_long_opt; @@ -26,13 +40,13 @@ while () { $last_long_opt = $1; $long_opt{$1} = 0 unless exists $long_opt{$1}; } elsif (defined($last_long_opt) - && /\Qargs[ac++]\E = ([^["\s]+);/ && $1 ne 'dest_option') { + && /\Qargs[ac++]\E = ([^["\s]+);/) { $long_opt{$last_long_opt} = 2; undef $last_long_opt; - } elsif (/dest_option = "--([^"]+)"/) { + } elsif (/return "--([^"]+-dest)";/) { $long_opt{$1} = 2; undef $last_long_opt; - } elsif (/\Qasprintf(\E[^,]+, "--([^"=]+)=/ || /\Qargs[ac++]\E = "--([^"=]+)=/) { + } elsif (/\Qasprintf(\E[^,]+, "--([^"=]+)=/ || /\Qargs[ac++]\E = "--([^"=]+)=/ || /fmt = .*: "--([^"=]+)=/) { $long_opt{$1} = 1; undef $last_long_opt; } @@ -63,7 +77,8 @@ foreach my $opt (sort keys %long_opt) { my $val = $long_opt{$opt}; $val = 1 if $opt =~ /^(max-|min-)/; $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"; }