whereis: rewrite most of the command

The earlier code gave little or no change to fix bugs and improve the
command.  This rewrite attempts to make further patching easier.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
whereis: add search scope listing option

Mostly useful when debugging why the command does, or does not, work.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
whereis: align with howto-usage-function.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
whereis: support MANPATH environment variable

The MANPATH has been around long enough that it can be added to whereis
default search path.

Reference: manpath(1)
Addresses: http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
docs: generic whereis.1 clean up

Align with howto-man-page.txt, and more importantly remove out dated 'SEE
ALSO' and 'BUGS' sections.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
whereis: canonicalize files before printing

The whereis gives promise to find files so it seems to be more correct
print symlink destinations than locations of symlinks.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
whereis: remove duplicates from search results

Now when the whereis will not have search directory duplicates, and it
finds real path for symlinked files in paths it is time to remove search
result duplicates.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=835211
Signed-off-by: Sami Kerola <kerolasa@iki.fi>