about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Completion/User/_su6
2 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index d81143076..38a030659 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-05-19  Oliver Kiddle  <opk@zsh.org>
+
+	* 11470: Completion/User/_su: fix to use user's shell after -c
+
 2000-05-19  Bart Schaefer  <schaefer@zsh.org>
 
 	* 11469: Completion/Commands/_complete_debug,
diff --git a/Completion/User/_su b/Completion/User/_su
index e5bf09d80..daf301555 100644
--- a/Completion/User/_su
+++ b/Completion/User/_su
@@ -6,7 +6,7 @@ local shell comp name usr base
 (( base=$?+2 ))
 
 if [[ CURRENT -eq base ]]; then
-  compgen -u && return
+  _users && return
   usr=root
 elif [[ CURRENT -ge base+1 ]]; then
   usr=$words[base]
@@ -14,9 +14,9 @@ else
   return
 fi
 
-shell=${"$(egrep "^$usr:" </etc/passwd)"##*:}
+shell="${${(M@)${(@f)$(</etc/passwd)}:#$usr*}##*:}"
 compset -n $base
 for name in $shell $shell:t -default-; do
   comp="$_comps[$name]"
-  [[ ! -z "$comp" ]] && "$comp" && return
+  [[ -n "$comp" ]] && "$comp" && return
 done