https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288089

            Bug ID: 288089
           Summary: mandoc has a lot of undocumented command line options
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: [email protected]
          Reporter: [email protected]

I called the usage output:

/usr/bin/mandoc -?
mandoc: illegal option -- ?
usage: mandoc [-ac] [-I os=name] [-K encoding] [-mdoc | -man] [-O options]
      [-T output] [-W level] [file ...]

so the valid command line options are -a, -c, -I, -K, -m, -O, -T, -W

I called -h and expected a help message, but mandoc hangs and waiting for input
on stdin:

/usr/bin/mandoc -h
^D

mandoc is hard linked to apropos:
ls -li /usr/bin/mandoc /usr/bin/apropos
223004 -r-xr-xr-x  4 root wheel 526456 Jul  7 07:32 /usr/bin/apropos
223004 -r-xr-xr-x  4 root wheel 526456 Jul  7 07:32 /usr/bin/mandoc

I called apropos -h and it worked as expected:

/usr/bin/apropos -h
usage: apropos [-afk] [-C file] [-M path] [-m path] [-O outkey] [-S arch]
      [-s section] expression ...


same for makewhatis:

/usr/bin/makewhatis  -h
makewhatis: illegal option -- h
usage: makewhatis [-aDnpQ] [-C file] [-Tutf8]
       makewhatis [-aDnpQ] [-Tutf8] dir ...
       makewhatis [-DnpQ] [-Tutf8] -d dir [file ...]
       makewhatis [-Dnp] -u dir [file ...]
       makewhatis [-Q] -t file ...


PS: the problems seems to be the getopt() call in contrib/mandoc/main.c
while ((c = getopt(argc, argv,  "aC:cfhI:iK:klM:m:O:S:s:T:VW:w")) != -1) {

which contains much more than the supported -a, -c, -I, -K, -m, -O, -T, -W
options.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to