-------- Posredovano sporočilo -------- Zadeva: Re: [man-db] remove magic to act like -l without -l ? Datum: Fri, 5 Sep 2025 17:49:03 +0100 Od: Colin Watson Za: man-db-devel@nongnu.org, groff@gnu.org I don't have time to read this message in full right now and decide whether or not the quoted code is mistaken, but just a very quick partial response before I go to get extra dinner supplies: On Fri, Sep 05, 2025 at 05:50:10PM +0200, Ingo Schwarze wrote: > * man-db says in its manual page: > "If this option is not used, then man will also fall back to > interpreting manual page arguments as local file names if the > argument contains a "/" character." > Code inspection shows that the code structure in main() with > the "nextarg" variable is still in place (though there is lots > of new complication), but instead of man(), a new function > man_maybe_local() was introducted: > > if (strchr (name, '/')) { > int status = local_man_loop (name); > if (status == OK) > *found = 1; > return status; > } > return man (name, found); > > Now this looks as if: > - Around the "*found = 1; return status;" the block braces were > forgotten, which is a classic programming mistake. The code you're quoting has never looked like this in any git commit. It was introduced in de6005491317a49b4892ee1c653c557bc9d0d74c which had the following (the indentation uses tabs, but they are consistent; nowadays, man-db uses clang-format via pre-commit to enforce formatting consistency, so any such mistake would be immediately visible in git commits and the introduction of clang-format did not change that code): + if (strchr (name, '/')) { + int status = local_man_loop (name); + if (status == OK) + *found = 1; + return status; + } af4f7dc8faf6b9492424fa0dc1f3041081aeb6a0 then moved that around slightly, but it preserved the same indentation structure. So I don't know where the extra level of indentation before "return status;" that you quote could possibly have come from; it appears to be fictional. >The mandoc manual pages just call arguments you can pass to man(1) >for lookup "names", plain and simple. I also prefer "name". man-db's man(1) does use "page" in a couple of places and "item" in another when referring to the argument, but I am inclined to canonicalize all of those to "name". -- Colin Watson (he/him) [cjwatson@debian.org]