about summary refs log tree commit diff
path: root/Completion/compaudit
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 /Completion/compaudit
parent3023ddf132825bb29c94fbd0860b7785887cc5c5 (diff)
downloadzsh-3876601c794b57342d14152bef1884f2a4213621.tar.gz
zsh-3876601c794b57342d14152bef1884f2a4213621.tar.xz
zsh-3876601c794b57342d14152bef1884f2a4213621.zip
19708: change getent() to handle two arguments
Diffstat (limited to 'Completion/compaudit')
-rw-r--r--Completion/compaudit8
1 files changed, 7 insertions, 1 deletions
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