* [PATCH] killall completion for FreeBSD
@ 2004-07-21 21:15 Jean-Baptiste Quenot
2004-07-23 14:08 ` Oliver Kiddle
0 siblings, 1 reply; 4+ messages in thread
From: Jean-Baptiste Quenot @ 2004-07-21 21:15 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 328 bytes --]
Dear workers,
I noticed that killall completion does not work on FreeBSD. This patch
addresses the issue, as the completion was originally only intended for
GNU/Linux. Indeed, FreeBSD uses a slightly different syntax for
expressing ps output options.
Best regards,
--
Jean-Baptiste Quenot
http://caraldi.com/jbq/
[-- Attachment #2: zsh-killall-freebsd --]
[-- Type: text/plain, Size: 700 bytes --]
--- Completion/Unix/_killall.orig Wed Jul 21 22:31:12 2004
+++ Completion/Unix/_killall Wed Jul 21 23:13:13 2004
@@ -4,6 +4,10 @@
_alternative \
'signals:: _signals -p' \
'processes:process:{ compadd "$expl[@]" ${${${${(f)"$(_call_program processes-names ps ${${EUID/(#s)0(#e)/xa}//[0-9]#/} ho cmd 2> /dev/null)"//[][\(\)]/}:#(ps|COMMAND|-*)}%%\ *}:t} }'
+elif [[ $service = killall && "$OSTYPE" = freebsd* ]]; then
+ _alternative \
+ 'signals:: _signals -p' \
+ 'processes:process:{ compadd "$expl[@]" ${${${${(f)"$(_call_program processes-names ps ${${EUID/(#s)0(#e)/xa}//[0-9]#/}ho comm 2> /dev/null)"//[][\(\)]/}:#(ps|COMMAND|-*)}%%\ *}:t} }'
else
_signals -p
fi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] killall completion for FreeBSD
2004-07-21 21:15 [PATCH] killall completion for FreeBSD Jean-Baptiste Quenot
@ 2004-07-23 14:08 ` Oliver Kiddle
2004-07-23 15:07 ` Jean-Baptiste Quenot
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2004-07-23 14:08 UTC (permalink / raw)
To: Jean-Baptiste Quenot; +Cc: zsh-workers
Jean-Baptiste Quenot wrote:
> I noticed that killall completion does not work on FreeBSD. This patch
> addresses the issue, as the completion was originally only intended for
> GNU/Linux. Indeed, FreeBSD uses a slightly different syntax for
> expressing ps output options.
Thanks.
That doesn't seem to work on the sourceforge FreeBSD 4.8 machine. As
you say, it comes down to the syntax for ps output options. `ps ho cmd'
seems to be Linux only. `ps ho comm' is more suitable because it
doesn't print arguments but it doesn't seem to work everywhere. `ps ho
command' seems to work on all the BSDs I tried. So I'll try this patch
instead.
Oliver
Index: Completion/Unix/Command/_killall
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_killall,v
retrieving revision 1.2
diff -u -r1.2 _killall
--- Completion/Unix/Command/_killall 19 Aug 2002 15:00:10 -0000 1.2
+++ Completion/Unix/Command/_killall 23 Jul 2004 13:51:37 -0000
@@ -1,9 +1,9 @@
#compdef killall killall5
-if [[ $service = killall && "$OSTYPE" = linux* ]]; then
+if [[ $service = killall && "$OSTYPE" = (linux*|*bsd*|darwin*) ]]; then
_alternative \
- 'signals:: _signals -p' \
- 'processes:process:{ compadd "$expl[@]" ${${${${(f)"$(_call_program processes-names ps ${${EUID/(#s)0(#e)/xa}//[0-9]#/} ho cmd 2> /dev/null)"//[][\(\)]/}:#(ps|COMMAND|-*)}%%\ *}:t} }'
+ 'signals:: _signals -p' \
+ 'processes-names:process:{ compadd "$expl[@]" ${${${${(f)"$(_call_program processes-names ps ${${EUID/(#s)0(#e)/xa}//[0-9]#/}ho command 2> /dev/null)"//[][\(\)]/}:#(ps|COMMAND|-*)}%%\ *}:t} }'
else
_signals -p
fi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] killall completion for FreeBSD
2004-07-23 14:08 ` Oliver Kiddle
@ 2004-07-23 15:07 ` Jean-Baptiste Quenot
2004-07-23 16:16 ` Oliver Kiddle
0 siblings, 1 reply; 4+ messages in thread
From: Jean-Baptiste Quenot @ 2004-07-23 15:07 UTC (permalink / raw)
To: zsh-workers
* Oliver Kiddle:
> Jean-Baptiste Quenot wrote:
>
> > I noticed that killall completion does not work on FreeBSD. This
> > patch addresses the issue, as the completion was originally only
> > intended for GNU/Linux. Indeed, FreeBSD uses a slightly different
> > syntax for expressing ps output options.
>
> That doesn't seem to work on the sourceforge FreeBSD 4.8 machine.
You're right, it doesn't work on FreeBSD 4.x. My patch addresses
FreeBSD 5.x only, sorry for that. As you say, using command would be
more appropriate. It does include command arguments, but apparently the
zsh _killall script already cuts them, so this is not an issue.
Apparently, the « command » option is also supported on GNU/Linux's ps.
Note that if the _killall script is run by root, the arguments « ax »
and « ho » must stick together for optimal interoperability, this is
compatible with all systems I tried.
Best regards,
--
Jean-Baptiste Quenot
http://caraldi.com/jbq/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] killall completion for FreeBSD
2004-07-23 15:07 ` Jean-Baptiste Quenot
@ 2004-07-23 16:16 ` Oliver Kiddle
0 siblings, 0 replies; 4+ messages in thread
From: Oliver Kiddle @ 2004-07-23 16:16 UTC (permalink / raw)
To: Jean-Baptiste Quenot; +Cc: zsh-workers
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 918 bytes --]
Jean-Baptiste Quenot wrote:
> Apparently, the « command » option is also supported on GNU/Linux's ps.
Yes, I'm using Linux here so I checked that. That said, I think there
is more than one fork of procps. I've checked both Debian and SuSE (and
judging by the version numbers of 3.2.1-2 and 2003.9.20-6, they have
different ps commands).
> Note that if the _killall script is run by root, the arguments « ax »
> and « ho » must stick together for optimal interoperability, this is
> compatible with all systems I tried.
You'll notice that I kept that change in my patch. I saw that you'd
done that in yours and it didn't do any harm on Linux so I kept that
part of your change.
I just had a look at _killall's history. Seems the change to cut out
command names was in 13312 and that not using `ps ho comm' was
intentional. With regard to 13314, I think it should just be removing a
leading hyphen.
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-07-23 16:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-21 21:15 [PATCH] killall completion for FreeBSD Jean-Baptiste Quenot
2004-07-23 14:08 ` Oliver Kiddle
2004-07-23 15:07 ` Jean-Baptiste Quenot
2004-07-23 16:16 ` Oliver Kiddle
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).