1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-22 20:01:31 +02:00

27308, based on 27305 from Edgar Merino:

search for init scripts in other locations
This commit is contained in:
Peter Stephenson 2009-10-04 18:20:00 +00:00
parent 179cd828a5
commit 8ed0fad414
3 changed files with 38 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2009-10-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 27308, based on 27305 from Edgar Merino:
Completion/Unix/Command/_init_d, Completion/Unix/Type/_services:
search for init scripts in other locations.
* Lionel Flandrin: 27307:
Functions/VCS_Info/Backends/VCS_INFO_get_data_hg,
Doc/Zsh/contrib.yo: enhanced VCS_INFO support for Mecurial.
2009-09-30 Peter Stephenson <p.w.stephenson@ntlworld.com>
* http://www.opensource.apple.com/source/zsh/zsh-53/patches/utils.c.patch:
@ -12233,5 +12243,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.4790 $
* $Revision: 1.4791 $
*****************************************************

View File

@ -7,7 +7,20 @@ _compskip=all
# This should probably be system specific...
script=$words[1]
[[ $script = */* ]] || script=/etc/init.d/$script
if [[ $script != */* ]]; then
local -a scriptpath
local dir
# Known locations of init scripts
# C.f. Unix/Type/_services
scriptpath=(/etc/init.d /etc/rc.d /etc/rc.d/init.d)
for dir in $scriptpath; do
if [[ -f $dir/$script ]]; then
script=$dir/$script
break
fi
done
fi
# If the file starts with `#!' we hope that this is a shell script
# and get lines looking like <space>foo|bar) with the words in $what.

View File

@ -12,7 +12,19 @@ if chkconfig --list > /dev/null 2>&1; then
'init:init service:compadd -a inits' \
'xinetd:xinetd service:compadd -a xinetds' && ret=0
else
_wanted services expl service compadd "$@" - /etc/init.d/*(-*:t) && ret=0
local -a scriptpath
local dir
# Known locations of init scripts
# C.f. Unix/Commands/_init_d
scriptpath=(/etc/init.d /etc/rc.d /etc/rc.d/init.d)
for dir in $scriptpath; do
if [[ -d $dir ]]; then
break
fi
done
_wanted services expl service compadd "$@" - $dir/*(-*:t) &&
ret=0
fi
return ret