Skip to content

Commit 3a3b97d

Browse files
bagderptitSeb
authored andcommitted
gen.pl: escape all dashes (ascii minus) to avoid unicode hyphens
Reported-by: FC Stegerman Fixes curl#11635 Closes curl#11637
1 parent f6f3ac8 commit 3a3b97d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/cmdline-opts/gen.pl

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ sub manpageify {
6868
my $l;
6969
if($optlong{$k} ne "") {
7070
# both short + long
71-
$l = "\\fI-".$optlong{$k}.", --$k\\fP";
71+
$l = "\\fI-".$optlong{$k}.", \\-\\-$k\\fP";
7272
}
7373
else {
7474
# only long
75-
$l = "\\fI--$k\\fP";
75+
$l = "\\fI\\-\\-$k\\fP";
7676
}
7777
return $l;
7878
}
@@ -117,8 +117,7 @@ sub printdesc {
117117
}
118118
}
119119
# quote "bare" minuses in the output
120-
$d =~ s/( |\\fI|^)--/$1\\-\\-/g;
121-
$d =~ s/([ -]|\\fI|^)-/$1\\-/g;
120+
$d =~ s/([^\\])-/$1\\-/g;
122121
# handle single quotes first on the line
123122
$d =~ s/^(\s*)\'/$1\\(aq/;
124123
# handle double quotes first on the line
@@ -450,6 +449,7 @@ sub single {
450449
print "\nExample$s:\n.nf\n";
451450
foreach my $e (@examples) {
452451
$e =~ s!\$URL!https://example.com!g;
452+
$e =~ s/\-/\\-/g;
453453
print " curl $e\n";
454454
}
455455
print ".fi\n";

0 commit comments

Comments
 (0)