From owner-freebsd-bugs Sun Jan 28 9:50:22 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 9ABFA37B402 for ; Sun, 28 Jan 2001 09:50:03 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f0SHo3W08301; Sun, 28 Jan 2001 09:50:03 -0800 (PST) (envelope-from gnats) Date: Sun, 28 Jan 2001 09:50:03 -0800 (PST) Message-Id: <200101281750.f0SHo3W08301@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Peter Pentchev Subject: Re: bin/24695: [patch] pkg_info: prefix search for a package Reply-To: Peter Pentchev Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/24695; it has been noted by GNATS. From: Peter Pentchev To: mavetju@chello.nl Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: bin/24695: [patch] pkg_info: prefix search for a package Date: Sun, 28 Jan 2001 19:44:49 +0200 On Sun, Jan 28, 2001 at 05:51:36PM +0100, mavetju@chello.nl wrote: > > >Number: 24695 > >Category: bin > >Synopsis: [patch] pkg_info: prefix search for a package > >Originator: Edwin Groothuis > >Release: FreeBSD 4.2-RELEASE i386 > >Organization: > - > >Environment: > > pkg_install, HEAD tag > main.c: 1.27 > pkg_info.1: 1.31 > perform.c: 1.32 > > > >Description: > > Sometimes I need to find the know the description or the > version of an installed package. Of course, pkg_info -a | > grep string works fine, but userfriendly? By adding the -F > option (fuzzy search), it will not check for the full name > of the package but use the given pkg-name as a prefix in > the package to search for. > > >How-To-Repeat: > > [~] edwin@p6>pkg_info -F screen > Information for screen-3.9.5: > > Comment: > A multi-screen window manager > [...] Hmm.. I've been meaning to try and do something like this for a long time, but I haven't been able to find the time :) Still, now that I've taken a look at code someone has actually written, there are a couple of comments. Shouldn't the FuzzySearch opendir/readdir logic be outside of the pkg_do() routine, and call pkg_do() once for every file it finds? Currently you stop at the very first file you find, which might not be so good if multiple versions of a package are installed, or if the user deliberately tries to query several packages with a common prefix (e.g. mysql-client/ mysql-server). Apart from that, it's great that you've actually taken the time and implemented this :) G'luck, Peter -- This inert sentence is my body, but my soul is alive, dancing in the sparks of your brain. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message