Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: strace completion (Re: grouping/joining _values)
- X-seq: zsh-users 12912
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Tomasz Pala <gotar@xxxxxxxxxx>
- Subject: Re: strace completion (Re: grouping/joining _values)
- Date: Fri, 13 Jun 2008 04:33:02 -0700
- Cc: zsh-users@xxxxxxxxxx
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=d200803; d=spodhuis.org; h=Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=raDSyJdoP3CSPk5n0d1U+ewhKl2RVHv+pL53UuXk64AIeeXJAtnbB23o1sEGO2LPYiT7NPJTst5IObnAEHbxb+dWMV2vFiEH4YUXz4QhL/KFVgtCzAeaSuiKrLzeH7nwUK505XKwjxCx7v4hQN+k/X2H0M2mR7GfYY2TZLOVFsQ=;
- In-reply-to: <20080613002731.GA11526@xxxxxxxxxxxxxxxx>
- Mail-followup-to: Tomasz Pala <gotar@xxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20080607193937.GA14443@xxxxxxxxxxxxxxxx> <20080613002731.GA11526@xxxxxxxxxxxxxxxx>
On 2008-06-13 at 02:27 +0200, Tomasz Pala wrote:
> I've found solution myself using _wanted and _describe. See attached
> file - it's almost complete strace completion. I think it's ready for
> inclusion into zsh repo.
System calls are OS-specific, as you noted in the TODO; getting the list
involves looking at /usr/include/sys/syscalls but I note that on Linux
that involves having to pull in #include's within that file. I suspect
that of the Unices today, those which don't include a compiler are
likely to be some Linux variants, default MacOS installs (? not sure,
this one has it but I don't recall if that's because of post-install
work) and ... who knows what else?
Perhaps move the array to a default list, capture a specific set of
defaults in an OS-specific array which can be grabbed with an autoloaded
function if needed, then try to get the real list, the first time, with
cpp? Unfortunately, SUSv3 only seems to specify that c99(1) exist, not
cpp(1) and I believe that "cpp -dN" is a GCC feature anyway.
Someone with more experience in providing completions may have better
advice, but perhaps:
if [[ -x =gcc ]]; then
[[ ${#_sys_calls_generated} -eq 0 ]] && _sys_calls_generated=(
${${(M)${(@f)"$(gcc -E -dN /usr/include/sys/syscall.h)"}%SYS_*}#SYS_}
)
sys_calls=($_sys_calls_generated)
elif [[ $OSTYPE == linux-gnu ]]; then
# ...
else
sys_calls=()
fi
Are there any other useful strategies for extracting the real list of
syscalls at runtime, so that on systems which package up the same
version of zsh for N years the list doesn't grow stale?
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author