CFR: Replace man/manpath/whatis/apropos with a shell script

Anonymous swell.k at gmail.com
Thu Aug 19 00:01:16 UTC 2010


Gordon Tetlow <gordon at tetlows.org> writes:

> I've tried to make this mirror the functionality, directory search order,
> and arguments as the current base implementation.
>
> This brings me to my next point. I need some testers willing to try this
> out. It would be particularly great if I could get some foreign language
> testers with localized manpage installations. If something doesn't work the
> way you expect, please contact me and I can help debug it (using man -ddd
> <whatever> will generally give me the debug information I need).

It doesn't search in bin/../man nor in bin/.man. For example,
my PATH contains $LOCALBASE/bin:$HOME/.bin, while /etc/manpath.config
is default one and contains /usr/local/man which does not exist here.

  $ man -w mplayer rsync
  HOME/.bin/man/man1/mplayer.1
  LOCALBASE/man/man1/rsync.1.gz

  $ echo $PATH
  LOCALBASE/libexec/ccache:HOME/.bin:LOCALBASE/sbin:LOCALBASE/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:HOME/blah/bin

Unfortunately, if ~/.bin is in PATH it still will not search in ~/.man
without touching MANPATH.

But with man.sh it doesn't respect PATH at all.

  $ man -ddd -w mplayer rsync
  -- Using architecture: amd64:amd64
  -- Using pager: less
  -- Using manual sections: 1:1aout:8:2:3:n:4:5:6:7:9:l
  -- Using manual path: /usr/share/man:/usr/share/openssl/man:/usr/local/man
  -- Using locale paths: en_US.UTF-8:en.UTF-8:.
  -- Searching for mplayer
  -- Searching section 1
  --   Searching directory /usr/share/man/en.UTF-8/man1
  --   Searching directory /usr/share/man/man1
  --   Searching directory /usr/share/openssl/man/man1
  -- Searching section 1aout
  --   Searching directory /usr/share/man/en.UTF-8/man1aout
  --   Searching directory /usr/share/man/man1aout
  -- Searching section 8
  --   Searching directory /usr/share/man/en.UTF-8/man8/amd64
  --   Searching directory /usr/share/man/en.UTF-8/man8/amd64
  --   Searching directory /usr/share/man/en.UTF-8/man8
  --   Searching directory /usr/share/man/man8/amd64
  --   Searching directory /usr/share/man/man8/amd64
  --   Searching directory /usr/share/man/man8
  -- Searching section 2
  --   Searching directory /usr/share/man/en.UTF-8/man2
  --   Searching directory /usr/share/man/man2
  -- Searching section 3
  --   Searching directory /usr/share/man/en.UTF-8/man3
  --   Searching directory /usr/share/man/man3
  --   Searching directory /usr/share/openssl/man/man3
  -- Searching section n
  -- Searching section 4
  --   Searching directory /usr/share/man/en.UTF-8/man4/amd64
  --   Searching directory /usr/share/man/en.UTF-8/man4/amd64
  --   Searching directory /usr/share/man/en.UTF-8/man4
  --   Searching directory /usr/share/man/man4/amd64
  --   Searching directory /usr/share/man/man4/amd64
  --   Searching directory /usr/share/man/man4
  -- Searching section 5
  --   Searching directory /usr/share/man/en.UTF-8/man5
  --   Searching directory /usr/share/man/man5
  -- Searching section 6
  --   Searching directory /usr/share/man/en.UTF-8/man6
  --   Searching directory /usr/share/man/man6
  -- Searching section 7
  --   Searching directory /usr/share/man/en.UTF-8/man7
  --   Searching directory /usr/share/man/man7
  -- Searching section 9
  --   Searching directory /usr/share/man/en.UTF-8/man9
  --   Searching directory /usr/share/man/man9
  -- Searching section l
  No manual entry for mplayer
  -- Searching for rsync
  -- Searching section 1
  --   Searching directory /usr/share/man/en.UTF-8/man1
  --   Searching directory /usr/share/man/man1
  --   Searching directory /usr/share/openssl/man/man1
  -- Searching section 1aout
  --   Searching directory /usr/share/man/en.UTF-8/man1aout
  --   Searching directory /usr/share/man/man1aout
  -- Searching section 8
  --   Searching directory /usr/share/man/en.UTF-8/man8/amd64
  --   Searching directory /usr/share/man/en.UTF-8/man8/amd64
  --   Searching directory /usr/share/man/en.UTF-8/man8
  --   Searching directory /usr/share/man/man8/amd64
  --   Searching directory /usr/share/man/man8/amd64
  --   Searching directory /usr/share/man/man8
  -- Searching section 2
  --   Searching directory /usr/share/man/en.UTF-8/man2
  --   Searching directory /usr/share/man/man2
  -- Searching section 3
  --   Searching directory /usr/share/man/en.UTF-8/man3
  --   Searching directory /usr/share/man/man3
  --   Searching directory /usr/share/openssl/man/man3
  -- Searching section n
  -- Searching section 4
  --   Searching directory /usr/share/man/en.UTF-8/man4/amd64
  --   Searching directory /usr/share/man/en.UTF-8/man4/amd64
  --   Searching directory /usr/share/man/en.UTF-8/man4
  --   Searching directory /usr/share/man/man4/amd64
  --   Searching directory /usr/share/man/man4/amd64
  --   Searching directory /usr/share/man/man4
  -- Searching section 5
  --   Searching directory /usr/share/man/en.UTF-8/man5
  --   Searching directory /usr/share/man/man5
  -- Searching section 6
  --   Searching directory /usr/share/man/en.UTF-8/man6
  --   Searching directory /usr/share/man/man6
  -- Searching section 7
  --   Searching directory /usr/share/man/en.UTF-8/man7
  --   Searching directory /usr/share/man/man7
  -- Searching section 9
  --   Searching directory /usr/share/man/en.UTF-8/man9
  --   Searching directory /usr/share/man/man9
  -- Searching section l
  No manual entry for rsync

I guess there is one more bug.

      $ MANPATH=$HOME/.bin/man man mplayer
      zcat: HOME/.bin/man/man1/mplayer.1: not in gzip format
      $ MANPATH=$HOME/.bin/man man -ddd mplayer
      -- Using architecture: amd64:amd64
      -- Using pager: less
      -- Using manual sections: 1:1aout:8:2:3:n:4:5:6:7:9:l
      -- Using locale paths: en_US.UTF-8:en.UTF-8:.
      -- Searching for mplayer
      -- Searching section 1
      --   Searching directory HOME/.bin/man/man1
      --     Found manpage HOME/.bin/man/man1/mplayer.1
      --     Skipping catpage: not found or old
      -- Command: /usr/bin/zcat HOME/.bin/man/man1/mplayer.1 | /usr/bin/tbl | /usr/bin/groff -S -Wall -mtty-char -man -Tascii | /usr/bin/col | less


More information about the freebsd-current mailing list