2 # This script outputs some perl code that parses all possible options
3 # that the code in options.c might send to the server. This perl code
4 # is included in the rrsync script.
16 open(IN
, '../options.c') or die "Unable to open ../options.c: $!\n";
19 if (/\Qargstr[x++]\E = '([^.ie])'/) {
20 $short_no_arg{$1} = 1;
22 } elsif (/\Qasprintf(\E[^,]+, "-([a-zA-Z0-9])\%l?[ud]"/) {
23 $short_with_num{$1} = 1;
25 } elsif (/\Qargs[ac++]\E = "--([^"=]+)"/) {
28 } elsif (defined($last_long_opt)
29 && /\Qargs[ac++]\E = ([^["\s]+);/ && $1 ne 'dest_option') {
30 $long_opt{$last_long_opt} = 2;
32 } elsif (/dest_option = "--([^"]+)"/) {
35 } elsif (/\Qasprintf(\E[^,]+, "--([^"=]+)=/ || /\Qargs[ac++]\E = "--([^"=]+)=/) {
42 my $short_no_arg = join('', sort keys %short_no_arg);
43 my $short_with_num = join('', sort keys %short_with_num);
47 # These options are the only options that rsync might send to the server,
48 # and only in the option format that the stock rsync produces.
50 # To disable a short-named option, add its letter to this string:
51 our \$short_disabled = 's';
53 our \$short_no_arg = '$short_no_arg'; # DO NOT REMOVE ANY
54 our \$short_with_num = '$short_with_num'; # DO NOT REMOVE ANY
56 # To disable a long-named option, change its value to a -1. The values mean:
57 # 0 = the option has no arg; 1 = the arg doesn't need any checking; 2 = only
58 # check the arg when receiving; and 3 = always check the arg.
62 foreach my $opt (sort keys %long_opt) {
63 my $val = $long_opt{$opt};
64 $val = 1 if $opt =~ /^(max-|min-)/;
65 $val = 3 if $opt eq 'files-from';
66 $val = '$ro ? -1 : ' . $val if $opt =~ /^remove-/;
67 print " '$opt' => $val,\n";