From: Karel Zak <kzak@redhat.com>
To: Davidlohr Bueso <dave@gnu.org>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: Re: [PATCH v2] whereis: search in path
Date: Tue, 30 Aug 2011 11:47:02 +0200 [thread overview]
Message-ID: <20110830094702.GP1855@nb.net.home> (raw)
In-Reply-To: <1313171742.3305.3.camel@offbook>
On Fri, Aug 12, 2011 at 01:55:42PM -0400, Davidlohr Bueso wrote:
> misc-utils/whereis.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 68 insertions(+), 1 deletions(-)
Applied, thanks. ...but:
$ whereis -m git-rm-commit
git-rm-commit: /home/kzak/bin/git-rm-commit
the -m means "man pages only", but the result is executable file.
I have fixed this problem, the $PATH is used for binaries only and
ignored if -B is specified. See below.
Karel
>From 4ff826f68a7d9bd1239644ab53be9b81fc8b7a37 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 30 Aug 2011 11:44:15 +0200
Subject: [PATCH] whereis: search in path for binaries only
Signed-off-by: Karel Zak <kzak@redhat.com>
---
misc-utils/whereis.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c
index 90f7b90..03ea95e 100644
--- a/misc-utils/whereis.c
+++ b/misc-utils/whereis.c
@@ -299,8 +299,6 @@ findv(char **dirv, int dirc, char *cp)
while (dirc > 0)
findin(*dirv++, cp), dirc--;
- while (*dirp)
- findin(*dirp++, cp);
}
static void
@@ -315,9 +313,11 @@ looksrc(char *cp)
static void
lookbin(char *cp)
{
- if (Bflag == 0)
+ if (Bflag == 0) {
findv(bindirs, ARRAY_SIZE(bindirs)-1, cp);
- else
+ while (*dirp)
+ findin(*dirp++, cp); /* look $PATH */
+ } else
findv(Bflag, Bcnt, cp);
}
@@ -424,8 +424,6 @@ main(int argc, char **argv)
if (argc == 0)
usage(stderr);
- fillpath();
-
do
if (argv[0][0] == '-') {
register char *cp = argv[0] + 1;
@@ -475,8 +473,11 @@ main(int argc, char **argv)
usage(stderr);
}
argv++;
- } else
+ } else {
+ if (Bcnt == 0 && pathdir == NULL)
+ fillpath();
lookup(*argv++);
+ }
while (--argc > 0);
freepath();
--
1.7.6
prev parent reply other threads:[~2011-08-30 9:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-12 17:55 [PATCH v2] whereis: search in path Davidlohr Bueso
2011-08-30 9:47 ` Karel Zak [this message]
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=20110830094702.GP1855@nb.net.home \
--to=kzak@redhat.com \
--cc=dave@gnu.org \
--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