From: Daniel Stenberg Date: Wed, 9 Aug 2023 07:00:23 +0000 (+0200) Subject: [PATCH] gen.pl: escape all dashes (ascii minus) to avoid unicode hyphens X-Git-Tag: archive/raspbian/8.2.1-2+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d52586205ac9a0d5cad39459468bd428d4c338c5;p=curl.git [PATCH] gen.pl: escape all dashes (ascii minus) to avoid unicode hyphens Reported-by: FC Stegerman Fixes #11635 Gbp-Pq: Name gen_pl_escape_all_dashes.patch --- diff --git a/docs/cmdline-opts/gen.pl b/docs/cmdline-opts/gen.pl index db68d31d..8542b171 100755 --- a/docs/cmdline-opts/gen.pl +++ b/docs/cmdline-opts/gen.pl @@ -68,11 +68,11 @@ sub manpageify { my $l; if($optlong{$k} ne "") { # both short + long - $l = "\\fI-".$optlong{$k}.", --$k\\fP"; + $l = "\\fI-".$optlong{$k}.", \\-\\-$k\\fP"; } else { # only long - $l = "\\fI--$k\\fP"; + $l = "\\fI\\-\\-$k\\fP"; } return $l; } @@ -117,8 +117,7 @@ sub printdesc { } } # quote "bare" minuses in the output - $d =~ s/( |\\fI|^)--/$1\\-\\-/g; - $d =~ s/([ -]|\\fI|^)-/$1\\-/g; + $d =~ s/([^\\])-/$1\\-/g; # handle single quotes first on the line $d =~ s/^(\s*)\'/$1\\(aq/; # handle double quotes first on the line @@ -450,6 +449,7 @@ sub single { print "\nExample$s:\n.nf\n"; foreach my $e (@examples) { $e =~ s!\$URL!https://example.com!g; + $e =~ s/\-/\\-/g; print " curl $e\n"; } print ".fi\n";