Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
_getconf
- X-seq: zsh-workers 28092
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxx (Zsh hackers list)
- Subject: _getconf
- Date: Mon, 19 Jul 2010 17:38:09 +0100
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
_getconf has been written on the basis that all the variables are listed
inline and presumably the list can be kept up to date. Wow, is my
outlook on life different from that.
Here's a modified version which I don't think loses anything but fixes
the implausible assumption. (It appears it was only missing 261
variables on my system, however.)
Index: Completion/Unix/Command/_getconf
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_getconf,v
retrieving revision 1.3
diff -p -u -r1.3 _getconf
--- Completion/Unix/Command/_getconf 20 Feb 2006 21:34:06 -0000 1.3
+++ Completion/Unix/Command/_getconf 19 Jul 2010 16:36:55 -0000
@@ -2,48 +2,57 @@
local expl ret=1
+local -a syskeys posixkeys confkeys pathkeys1 pathkeys2 allkeys mykeys restkeys
+syskeys=(ARG_MAX BC_BASE_MAX BC_DIM_MAX BC_SCALE_MAX
+ BC_STRING_MAX CHILD_MAX COLL_WEIGHTS_MAX EXPR_NEST_MAX LINE_MAX
+ NGROUPS_MAX OPEN_MAX RE_DUP_MAX STREAM_MAX TZNAME_MAX)
+posixkeys=(_POSIX_CHILD_MAX _POSIX_LINK_MAX
+ _POSIX_MAX_CANON _POSIX_MAX_INPUT _POSIX_NAME_MAX _POSIX_NGROUPS_MAX
+ _POSIX_OPEN_MAX _POSIX_PATH_MAX _POSIX_PIPE_BUF _POSIX_SSIZE_MAX
+ _POSIX_STREAM_MAX _POSIX_TZNAME_MAX _POSIX_VERSION
+ POSIX2_BC_BASE_MAX POSIX2_BC_DIM_MAX POSIX2_BC_SCALE_MAX
+ POSIX2_BC_STRING_MAX POSIX2_COLL_WEIGHTS_MAX POSIX2_EXPR_NEST_MAX
+ POSIX2_LINE_MAX POSIX2_RE_DUP_MAX POSIX2_VERSION POSIX2_C_BIND
+ POSIX2_C_DEV POSIX2_FORT_DEV POSIX2_FORT_RUN POSIX2_LOCALEDEF
+ POSIX2_SW_DEV _XOPEN_VERSION)
+confkeys=(PATH GNU_LIBC_VERSION GNU_LIBPTHREAD_VERSION
+ LFS_CFLAGS LFS_LDFLAGS LFS_LIBS LFS_LINTFLAGS
+ LFS64_CFLAGS LFS64_LDFLAGS LFS64_LIBS LFS64_LINTFLAGS)
+pathkeys1=(PIPE_BUF _POSIX_CHOWN_RESTRICTED
+ _POSIX_NO_TRUNC _POSIX_VDISABLE)
+pathkeys2=(LINK_MAX MAX_CANON MAX_INPUT NAME_MAX PATH_MAX PIPE_BUF)
+mykeys=($syskeys $posixkeys $confkeys $pathkeys1 $pathkeys2)
+
if [[ CURRENT -eq 2 ]]; then
- _tags syswideconfig pathconfig standardsconfig confstring
+ _tags syswideconfig pathconfig standardsconfig confstring restconfig
+
+ allkeys=(${${(f)"$(getconf -a 2>/dev/null)"}%%[: ]*})
+ restkeys=(${allkeys:#(${(j.|.)~mykeys})})
while _tags; do
_requested -V syswideconfig expl 'systemwide configuration variables' \
- compadd -S '' ARG_MAX BC_BASE_MAX BC_DIM_MAX BC_SCALE_MAX \
- BC_STRING_MAX CHILD_MAX COLL_WEIGHTS_MAX EXPR_NEST_MAX LINE_MAX \
- NGROUPS_MAX OPEN_MAX RE_DUP_MAX STREAM_MAX TZNAME_MAX && ret=0
+ compadd -S '' $syskeys && ret=0
_requested -V standardsconfig \
expl 'system-standards configuration variables' \
- compadd -S '' _POSIX_CHILD_MAX _POSIX_LINK_MAX \
- _POSIX_MAX_CANON _POSIX_MAX_INPUT _POSIX_NAME_MAX _POSIX_NGROUPS_MAX \
- _POSIX_OPEN_MAX _POSIX_PATH_MAX _POSIX_PIPE_BUF _POSIX_SSIZE_MAX \
- _POSIX_STREAM_MAX _POSIX_TZNAME_MAX _POSIX_VERSION \
- POSIX2_BC_BASE_MAX POSIX2_BC_DIM_MAX POSIX2_BC_SCALE_MAX \
- POSIX2_BC_STRING_MAX POSIX2_COLL_WEIGHTS_MAX POSIX2_EXPR_NEST_MAX \
- POSIX2_LINE_MAX POSIX2_RE_DUP_MAX POSIX2_VERSION POSIX2_C_BIND \
- POSIX2_C_DEV POSIX2_FORT_DEV POSIX2_FORT_RUN POSIX2_LOCALEDEF \
- POSIX2_SW_DEV _XOPEN_VERSION && ret=0
+ compadd -S '' $posixkeys && ret=0
_requested -V confstring \
expl 'configuration-dependent string variables' \
- compadd -S '' PATH GNU_LIBC_VERSION GNU_LIBPTHREAD_VERSION \
- LFS_CFLAGS LFS_LDFLAGS LFS_LIBS LFS_LINTFLAGS \
- LFS64_CFLAGS LFS64_LDFLAGS LFS64_LIBS LFS64_LINTFLAGS \
- && ret=0
-
- _requested -V confstring \
- expl 'configuration-dependent string variables' \
- compadd -S '' PATH GNU_LIBC_VERSION GNU_LIBPTHREAD_VERSION \
- LFS_CFLAGS LFS_LDFLAGS LFS_LIBS LFS_LINTFLAGS \
- LFS64_CFLAGS LFS64_LDFLAGS LFS64_LIBS LFS64_LINTFLAGS \
- && ret=0
+ compadd -S '' $confkeys && ret=0
_requested pathconfig &&
- while _next_label -V pathconfig expl 'system path configuration variables'; do
- compadd "$expl[@]" -S '' PIPE_BUF _POSIX_CHOWN_RESTRICTED \
- _POSIX_NO_TRUNC _POSIX_VDISABLE && ret=0
- compadd "$expl[@]" -S ' ' LINK_MAX MAX_CANON MAX_INPUT NAME_MAX \
- PATH_MAX PIPE_BUF && ret=0
- done
+ while _next_label -V pathconfig expl 'system path configuration variables'; do
+ compadd "$expl[@]" -S '' $pathkeys1 && ret=0
+ compadd "$expl[@]" -S ' ' $pathkeys2 && ret=0
+ done
+
+ if (( ${#restkeys} )); then
+ _requested -V restconfig \
+ expl 'remaining unclassified configuration variables' \
+ compadd -S '' $restkeys && ret=0
+ fi
+
(( ret )) || return 0
done
else
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author