summaryrefslogtreecommitdiff
path: root/packaging/cull_options
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-04-05 22:45:12 -0700
committerWayne Davison <wayned@samba.org>2008-04-05 22:45:12 -0700
commit0668bfe077a9e2101f8ef0fea60780f30273a826 (patch)
tree691b5c5409a48b7838e3919f9c4f440fc996f3d0 /packaging/cull_options
parent214af6ad83f3cdaa728e03180f77b0396409c2f7 (diff)
downloadrsync-0668bfe077a9e2101f8ef0fea60780f30273a826.tar.gz
rsync-0668bfe077a9e2101f8ef0fea60780f30273a826.tar.bz2
rsync-0668bfe077a9e2101f8ef0fea60780f30273a826.zip
Moving some files from support into packaging.
Diffstat (limited to 'packaging/cull_options')
-rwxr-xr-xpackaging/cull_options70
1 files changed, 70 insertions, 0 deletions
diff --git a/packaging/cull_options b/packaging/cull_options
new file mode 100755
index 00000000..3ef470df
--- /dev/null
+++ b/packaging/cull_options
@@ -0,0 +1,70 @@
+#!/usr/bin/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 = (
+ 'no-i-r' => 0,
+ 'fake-super' => 0,
+ 'log-file' => 3,
+);
+our $last_long_opt;
+
+open(IN, '../options.c') or die "Unable to open ../options.c: $!\n";
+
+while (<IN>) {
+ if (/\Qargstr[x++]\E = '([^.ie])'/) {
+ $short_no_arg{$1} = 1;
+ undef $last_long_opt;
+ } elsif (/\Qasprintf(\E[^,]+, "-([a-zA-Z0-9])\%l?[ud]"/) {
+ $short_with_num{$1} = 1;
+ undef $last_long_opt;
+ } elsif (/\Qargs[ac++]\E = "--([^"=]+)"/) {
+ $last_long_opt = $1;
+ $long_opt{$1} = 0;
+ } elsif (defined($last_long_opt)
+ && /\Qargs[ac++]\E = ([^["\s]+);/ && $1 ne 'dest_option') {
+ $long_opt{$last_long_opt} = 2;
+ undef $last_long_opt;
+ } elsif (/dest_option = "--([^"]+)"/) {
+ $long_opt{$1} = 2;
+ undef $last_long_opt;
+ } elsif (/\Qasprintf(\E[^,]+, "--([^"=]+)=/ || /\Qargs[ac++]\E = "--([^"=]+)=/) {
+ $long_opt{$1} = 1;
+ undef $last_long_opt;
+ }
+}
+close IN;
+
+my $short_no_arg = join('', sort keys %short_no_arg);
+my $short_with_num = join('', sort keys %short_with_num);
+
+print <<EOT;
+
+# These options are the only options that rsync might send to the server,
+# and only in the option format that the stock rsync produces.
+
+# To disable a short-named option, add its letter to this string:
+our \$short_disabled = 's';
+
+our \$short_no_arg = '$short_no_arg'; # DO NOT REMOVE ANY
+our \$short_with_num = '$short_with_num'; # DO NOT REMOVE ANY
+
+# To disable a long-named option, change its value to a -1. The values mean:
+# 0 = the option has no arg; 1 = the arg doesn't need any checking; 2 = only
+# check the arg when receiving; and 3 = always check the arg.
+our \%long_opt = (
+EOT
+
+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-/;
+ print " '$opt' => $val,\n";
+}
+
+print ");\n\n";