]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmdline/gen: fix the sorting of the man page options
authorDaniel Stenberg <daniel@haxx.se>
Sat, 9 Dec 2023 23:05:04 +0000 (00:05 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 10 Dec 2023 13:04:52 +0000 (14:04 +0100)
They were previously sorted based on the file names, which use a .d
extension, making "data" get placed after "data-binary" etc. Making the
sort ignore the extention fixes the ordering.

Reported-by: Boris Verkhovskiy
Bug: https://curl.se/mail/archive-2023-12/0014.html
Closes #12494

docs/cmdline-opts/gen.pl

index edf90622b2ea1a8e7460dff58a9cf8f0ce0c9657..16324550888cf2d876fc11e9d4738eda2dd25c2b 100755 (executable)
@@ -675,6 +675,16 @@ sub listglobals {
     }
 }
 
+sub noext {
+    my $in = $_[0];
+    $in =~ s/\.d//;
+    return $in;
+}
+
+sub sortnames {
+    return noext($a) cmp noext($b);
+}
+
 sub mainpage {
     my (@files) = @_;
     my $ret;
@@ -682,7 +692,7 @@ sub mainpage {
     header("page-header");
 
     # output docs for all options
-    foreach my $f (sort @files) {
+    foreach my $f (sort sortnames @files) {
         $ret += single($f, 0);
     }