Skip to content

Commit

Permalink
Fix PR 39648:
Browse files Browse the repository at this point in the history
	pkglocate --help enters a loop of `grep --help`

by checking the argument before passing it to grep.  Please note that
"grep -e" can't be used because of Solaris options, although I hope to
address that in the next commit.
  • Loading branch information
agc committed Nov 11, 2010
1 parent 8d84da8 commit ae62cd4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkglocate
@@ -1,6 +1,6 @@
#! /bin/sh
#
# $NetBSD: pkglocate,v 1.9 2004/07/04 16:12:10 jschauma Exp $
# $NetBSD: pkglocate,v 1.10 2010/11/11 19:56:34 agc Exp $
#
#-
# Copyright (c) 2000 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -74,7 +74,18 @@ if [ "$verbose" = "yes" ]; then
echo "===> Using $grepname to find matches"
fi

# do we need to show the help message?
showhelp=false
case "$1" in
--help)
showhelp=true
;;
esac
if [ $# -lt 1 ]; then
showhelp=true
fi

if $showhelp; then
echo "Usage: pkglocate [-i] [-f] [-p] [-v] word"
echo " [-i] ignore case when searching"
echo " [-f] look for a file, rather than a word or phrase"
Expand Down

0 comments on commit ae62cd4

Please sign in to comment.