Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Suggestion for _killall



Alexandre Duret-Lutz wrote:

> >>> "FH" == Falk Hueffner <falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx> writes:
> 
> [...]
> 
>  FH> Unfortunately, ps behaves different on each platform, so I don't know
>  FH> if this is really portable.
> 
> It isn't. Perhaps it could be done the same way as _kill?
> One other issue is that killall also behaves differently :
> 
> - On Debian (and probably most Linux distribution) it kill
>   process by names;
> 
> - On Solaris, Digital Unix, RISC/os and maybe others, it kills
>   *all* actives process and thus completing with process name is
>   inappropriate.

Uh, oh...

> Maybe there could be two _killall in Zsh ?  Let's say one in
> Completion/User/_killall and one in Completion/Linux/_killall.  Then
> ./configure and Makefile would be hacked to install Linux/* only on
> Linux system and in such a way that Linux/* functions would overwrite
> previously installed User/* completions.  Look quite ugly :(

I thought we had agreed that for this kind of stuff the function
itself does the test. at least _mount has been doing it for some time
now. And now _killall does the same. Dunno if the test is good enough, 
though.

On top of my previous one, obviously.

Bye
 Sven

diff -u oldcompletion/User/_killall Completion/User/_killall
--- oldcompletion/User/_killall	Fri Nov 19 09:56:05 1999
+++ Completion/User/_killall	Fri Nov 19 10:18:47 1999
@@ -1,5 +1,9 @@
 #compdef killall
 
-_alternative \
-    'signals:: _signals -p' \
-    'processes:process:{ compadd "$expl[@]" ${$(ps ho comm 2> /dev/null):#(ps|COMMAND)} }'
+if [[ "$OSTYPE" = linux* ]]; then
+  _alternative \
+      'signals:: _signals -p' \
+      'processes:process:{ compadd "$expl[@]" ${$(ps ho comm 2> /dev/null):#(ps|COMMAND)} }'
+else
+  _signals -p
+fi

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author