Hi Ted, Ted Unangst wrote on Mon, Mar 20, 2017 at 10:44:21AM -0400: > Ingo Schwarze wrote:
>> CVSROOT: /cvs >> Module name: src >> Changes by: schwa...@cvs.openbsd.org 2017/03/20 08:30:43 >> >> Modified files: >> usr.bin/mandoc : main.c mandoc.1 >> >> Log message: >> Silently ignore invalid -m input formats rather than erroring out. >> As observed by Jan Stary <hans at stare dot cz>, this is useful such >> that after 'alias man="man -m $HOME/man"', 'man -l foo.1' still works. >> Simplify and shorten the description of -m, and use .Ic for macros. > Might I suggest separating the getopt loops per utility? No. All the options except -m agree both syntactically and semantically. Basically, it's just one utility, and the command names mandoc(1), apropos(1), and whatis(1) are obsolete (though i have no intention to remove them, that would just hurt people's finger memory for no gain). mandoc is just man -cl apropos is just man -k whatis is just man -f The conflict in -m is an unfortunate historical accident, but it is not a huge issue because the -mdoc and -man flags are becoming more and more obsolete. They are not needed in practice, except maybe when processing incomplete documents in unit testing. But even there, i recommend using correct file headers instead. Remember that option unification was done to simplify the user interface. On other systems, you typically have to learn three different sets of command line options for man, apropos, and groff. Here, you have just one set, and every options works for all the commands. Yet, the number of options is *smaller* than for man(1) alone on other systems (try "man man" and "man groff" on Linux), and i'm trying hard to shrink it rather than grow it. > I notice mandoc silently accepts -Mandoc which I think has no effect, > but typically unrecognized options result in errors. That is documented, see man(1): -l A synonym for mandoc(1) -a. The name arguments are interpreted as filenames. No search is done and file, *path*, section, and subsection are ignored. Maybe i could tweak the manuals a bit to make it clearer that man(1) is the main user interface, and to reduce duplication and simplify explanations in the other two pages, mandoc(1) and apropos(1). I'll think about that. But erroring out on -M, -C, or -S when -l is also given really provides no benefit. It would only hurt people who use shell aliases. Yours, Ingo