-print "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 <<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";