X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/b3181708f21c458b1cc9d8c605b5432eccbad196..99ba99c74c9d761a502e9d3ed59f1ff72311471f:/support/cull_options diff --git a/support/cull_options b/support/cull_options index 577746c4..3ef470df 100755 --- a/support/cull_options +++ b/support/cull_options @@ -3,16 +3,20 @@ # that the code in options.c might send to the server. This perl code # is included in the rrsync script. use strict; -no strict 'refs'; -our(%short_no_arg, %short_with_num); -our(%long_no_arg, %long_before_arg, %long_with_arg); +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 () { - if (/\Qargstr[x++]\E = '(.)'/) { + if (/\Qargstr[x++]\E = '([^.ie])'/) { $short_no_arg{$1} = 1; undef $last_long_opt; } elsif (/\Qasprintf(\E[^,]+, "-([a-zA-Z0-9])\%l?[ud]"/) { @@ -20,44 +24,47 @@ while () { undef $last_long_opt; } elsif (/\Qargs[ac++]\E = "--([^"=]+)"/) { $last_long_opt = $1; - $long_no_arg{$1} = 1; + $long_opt{$1} = 0; } elsif (defined($last_long_opt) && /\Qargs[ac++]\E = ([^["\s]+);/ && $1 ne 'dest_option') { - delete $long_no_arg{$last_long_opt}; - $long_before_arg{$last_long_opt} = 1; + $long_opt{$last_long_opt} = 2; undef $last_long_opt; - } elsif (/dest_option = "--([^"])"/) { - $long_before_arg{$1} = 1; + } elsif (/dest_option = "--([^"]+)"/) { + $long_opt{$1} = 2; undef $last_long_opt; } elsif (/\Qasprintf(\E[^,]+, "--([^"=]+)=/ || /\Qargs[ac++]\E = "--([^"=]+)=/) { - $long_with_arg{$1} = 1; + $long_opt{$1} = 1; undef $last_long_opt; } } close IN; -print "\n", - "# These options are the only options that rsync might send to the\n", - "# server, and only in the arg styles that the stock rsync produces.\n", - "our \$short_no_arg = '", sort(keys %short_no_arg), "';\n", - "our \$short_with_num = '", sort(keys %short_with_num), "';\n", - "# To disable a short-named option, add its letter to this string:\n", - "our \$short_disabled = '';\n", - "# To disable a long-named option, change its value to a 0. A value of -1\n", - "# means the arg doesn't need checking, a 2 means only check when receiving.\n"; - -foreach my $name (qw( long_no_arg long_with_arg long_before_arg )) { - $_ = "our \%$name = (\n '" . join("' => 1,\n '", sort keys %$name) . "' => 1,\n);\n"; - if ($name eq 'long_before_arg') { - s/ 1,/ 2,/g; - s/('files-from' =>) 2,/$1 1,/; - s/('max-.* =>) 2,/$1 -1,/g; - } else { - s/ 1,/ -1,/g; - s/('files-from' =>) -1,/$1 1,/; - } - s/('remove-.* =>) (-?\d),/$1 \$ro ? 0 : $2,/g; - print; +my $short_no_arg = join('', sort keys %short_no_arg); +my $short_with_num = join('', sort keys %short_with_num); + +print < $val,\n"; } -print "\n"; +print ");\n\n";