about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2004-03-30 16:38:04 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2004-03-30 16:38:04 +0000
commit3876601c794b57342d14152bef1884f2a4213621 (patch)
tree468be5827ebe2c43cd5558d86c0452e20531195c
parent3023ddf132825bb29c94fbd0860b7785887cc5c5 (diff)
downloadzsh-3876601c794b57342d14152bef1884f2a4213621.tar.gz
zsh-3876601c794b57342d14152bef1884f2a4213621.tar.xz
zsh-3876601c794b57342d14152bef1884f2a4213621.zip
19708: change getent() to handle two arguments
-rw-r--r--ChangeLog3
-rw-r--r--Completion/compaudit8
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a234a790..6e0ca4a97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-03-30  Oliver Kiddle  <opk@zsh.org>
 
+	* 19708: Completion/compaudit: change getent() function to
+	handle two arguments
+
 	* 19707: Src/params.c, Test/D05array.ztst: fix bug where a
 	nagative index into an array returned a one element array
 	instead of a scalar
diff --git a/Completion/compaudit b/Completion/compaudit
index c4dbb6e11..25ba21c94 100644
--- a/Completion/compaudit
+++ b/Completion/compaudit
@@ -15,7 +15,13 @@ compaudit() {                           # Define and then call
 emulate -L zsh
 setopt extendedglob
 
-[[ -x /usr/bin/getent ]] || getent() { cat /etc/$1 }
+[[ -x /usr/bin/getent ]] || getent() {
+  if [[ $2 = <-> ]]; then
+    grep ":$2:[^:]*$" /etc/$1
+  else
+    grep "^$2:" /etc/$1
+  fi
+}
 
 # The positional parameters are the directories to check, else fpath.
 if (( $# )); then