about summary refs log tree commit diff
diff options
context:
space:
mode:
-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