summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-03-06 23:06:28 +0100
committerDan McGee <dan@archlinux.org>2007-03-06 23:06:28 +0100
commit48181e9a84c84b698b7fdce859889d6c24849da3 (patch)
tree848297c07384707d4382376cfd187cde08965105
parente6d6ee2c5a3f25004dc1b9688d07838e3c4b3138 (diff)
downloadpacman-48181e9a84c84b698b7fdce859889d6c24849da3.tar.gz
pacman-48181e9a84c84b698b7fdce859889d6c24849da3.tar.xz
* -Qs was returning an error if no package found, which is not the same behavior as -Ss.
-rwxr-xr-xcontrib/pacsearch20
-rw-r--r--src/pacman/query.c2
2 files changed, 20 insertions, 2 deletions
diff --git a/contrib/pacsearch b/contrib/pacsearch
index 71d45287..63a74abd 100755
--- a/contrib/pacsearch
+++ b/contrib/pacsearch
@@ -20,6 +20,7 @@
#TODO: colors flag on commandline
readonly progname="pacsearch"
+readonly version="1.0"
readonly CLR1='\\\e[0;34m'
readonly CLR2='\\\e[0;32m'
@@ -31,21 +32,36 @@ readonly CLR7='\\\e[1;36m'
readonly INST='\\\e[1;31m'
readonly BASE='\\\e[0m'
-if [ -z "$1" ]; then
+if [ "$1" = "--help" -o "$1" = "-h" ]; then
echo "Usage: $progname <pattern>"
echo "Ex: $progname ^gnome"
exit 0
fi
+if [ "$1" = "--version" -o "$1" = "-v" ]; then
+ echo "$progname version $version"
+ echo "Copyright (C) 2006-2007 Dan McGee"
+ exit 0
+fi
+
+if [ -z "$1" -o "${1:0:1}" = "-" ]; then
+ echo "Usage: $progname <pattern>"
+ echo "Ex: $progname ^gnome"
+ exit 1
+fi
+
+echo "debug 1"
# Make two temp files and send output of commands to these files
querydump=$(mktemp)
pacman -Qs $1 > $querydump
syncdump=$(mktemp)
pacman -Ss $1 > $syncdump
+echo "debug 2"
# Strip descriptions and 'local/' from -Qs query
instpkg=$(mktemp)
egrep '^[^ ]' $querydump | sed -e 's@^local/@@' > $instpkg
+echo "debug 3"
# Add pkgs not in sync db, mark pkgs that are installed
cat $instpkg | while read -r pkg; do
@@ -57,6 +73,7 @@ cat $instpkg | while read -r pkg; do
sed -i "s@^\(.\+/$pkg\)@\***\1@" $syncdump
done
+echo "debug 4"
# Print colorized package list and descriptions to screen
echo -e "$(sed -r \
-e "s@current/.*@$CLR1&$BASE@" \
@@ -71,6 +88,7 @@ echo -e "$(sed -r \
< $syncdump )"
echo -en "\e[0m"
+echo "debug 5"
rm $querydump
rm $syncdump
rm $instpkg
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 2964a7cb..b4888d05 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -92,7 +92,7 @@ int pacman_query(alpm_list_t *targets)
if(config->op_q_search) {
alpm_list_t *ret = alpm_db_search(db_local, targets);
if(ret == NULL) {
- return(1);
+ return(0);
}
for(i = ret; i; i = alpm_list_next(i)) {
char *group = NULL;