public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH 4/7] whereis: support MANPATH environment variable
Date: Sat, 16 Mar 2013 23:40:16 +0000	[thread overview]
Message-ID: <1363477219-29245-5-git-send-email-kerolasa@iki.fi> (raw)
In-Reply-To: <1363477219-29245-1-git-send-email-kerolasa@iki.fi>

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>
---
 misc-utils/whereis.1 | 31 +++++++++++++++++--------------
 misc-utils/whereis.c |  1 +
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/misc-utils/whereis.1 b/misc-utils/whereis.1
index 9b33999..4ce7a07 100644
--- a/misc-utils/whereis.1
+++ b/misc-utils/whereis.1
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" @(#)whereis.1 from UCB 4.2
-.TH WHEREIS 1 "January 2013" "util-linux" "User Commands"
+.TH WHEREIS 1 "March 2013" "util-linux" "User Commands"
 .SH NAME
 whereis \- locate the binary, source, and manual page files for a command
 .SH SYNOPSIS
@@ -113,21 +113,24 @@ or have no source in
 .B $ cd /usr/bin
 .br
 .B $ whereis \-u \-ms \-M /usr/man/man1 \-S /usr/src \-f *
-
-.SH FILES
+.SH "FILE SEARCH PATHS"
+By default
 .B whereis
-contains a basic set of hard-coded paths (see below), but if the
-.B \-B
-option is not specified, it also follows the
+tries to find files from hard-coded paths, which are defined with glob
+patterns. The command attempst to use contents of
 .B $PATH
-environment variable (since version 2.21).
-.IP
-.br
-/{bin,sbin,etc}
-.br
-/usr/{lib,\:bin,\:old,\:new,\:local,\:games,\:include,\:etc,\:src,\:man,\:sbin,\:X386,\:TeX,\:g++-include}
-.br
-/usr/local/{X386,\:TeX,\:X11,\:include,\:lib,\:man,\:etc,\:bin,\:games,\:emacs}
+and
+.B $MANPATH
+environment variables as default search path.  The easiest way to know
+what paths are in use is to add
+.B \-l
+listing option.  Effects of the
+.BR \-B ,
+.BR \-M ,
+and
+.BR \-S
+are display with
+.BR \-l .
 .SH "SEE ALSO"
 .BR chdir (2)
 .SH BUGS
diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c
index e3cfb5f..3fad843 100644
--- a/misc-utils/whereis.c
+++ b/misc-utils/whereis.c
@@ -426,6 +426,7 @@ int main(int argc, char **argv)
 	construct_list(dirlist, BIN_DIR, bindirs);
 	environ_list("PATH", dirlist, BIN_DIR);
 	construct_list(dirlist, MAN_DIR, mandirs);
+	environ_list("MANPATH", dirlist, MAN_DIR);
 	construct_list(dirlist, SRC_DIR, srcdirs);
 
 	do
-- 
1.8.2


  parent reply	other threads:[~2013-03-16 23:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-16 23:40 [PATCH 0/7] pull: whereis changes Sami Kerola
2013-03-16 23:40 ` [PATCH 1/7] whereis: rewrite most of the command Sami Kerola
2013-03-16 23:40 ` [PATCH 2/7] whereis: add search scope listing option Sami Kerola
2013-03-16 23:40 ` [PATCH 3/7] whereis: align with howto-usage-function.txt Sami Kerola
2013-03-16 23:40 ` Sami Kerola [this message]
2013-03-16 23:40 ` [PATCH 5/7] docs: generic whereis.1 clean up Sami Kerola
2013-03-16 23:40 ` [PATCH 6/7] whereis: canonicalize files before printing Sami Kerola
2013-03-20 12:56   ` Karel Zak
2013-03-20 14:03     ` Sami Kerola
2013-03-16 23:40 ` [PATCH 7/7] whereis: remove duplicates from search results Sami Kerola
2013-03-20 12:59   ` Karel Zak
2013-03-17  9:23 ` [PATCH 0/7] pull: whereis changes Sami Kerola
2013-03-20 13:02 ` Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363477219-29245-5-git-send-email-kerolasa@iki.fi \
    --to=kerolasa@iki.fi \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox