Fix a bug where the wrong digit was used for prioritizing filenames
authorschwarze <schwarze@openbsd.org>
Mon, 4 Sep 2023 13:08:11 +0000 (13:08 +0000)
committerschwarze <schwarze@openbsd.org>
Mon, 4 Sep 2023 13:08:11 +0000 (13:08 +0000)
in the standard man(1) mode that formats a single resulting page
if the respective manpath contained digits, like X11R6 does.
Fortunately, this bug did not trigger for any Xenocara manual page.

usr.bin/mandoc/main.c

index 280f365..fe8e5a2 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.262 2021/10/04 21:28:50 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.263 2023/09/04 13:08:11 schwarze Exp $ */
 /*
  * Copyright (c) 2010-2012, 2014-2021 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -504,7 +504,8 @@ main(int argc, char *argv[])
 
                        best_prio = 40;
                        for (ib = i = 0; i < resnsz; i++) {
-                               sec = resn[i].file;
+                               sec = resn[i].file +
+                                   strlen(conf.manpath.paths[resn[i].ipath]);
                                sec += strcspn(sec, "123456789");
                                if (sec[0] == '\0')
                                        continue; /* No section at all. */