mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-30 15:02:18 +01:00
unposted: Perforce "attribute" command
21551: FEATURES description for file<20-> 21546: oddities of subscripts when searching arrays 21544: ioctl() prototyping
This commit is contained in:
parent
3d562f576c
commit
8c095a5169
6 changed files with 131 additions and 34 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2005-08-01 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
|
* unposted: Completion/Unix/Command/_perforce: add the as yet
|
||||||
|
undocumented "attribute" command.
|
||||||
|
|
||||||
|
* 21551: Matthias Kopfermann: FEATURES: file<20-> globbing
|
||||||
|
example is confusing.
|
||||||
|
|
||||||
|
* 21546: Doc/Zsh/params.yo: document the oddities of subscripts
|
||||||
|
when searching arrays.
|
||||||
|
|
||||||
|
* 21544: Thorsten Dahlheimer: configure.ac, Src/system.h: ioctl()
|
||||||
|
prototyping was substandard and missing on Cygwin.
|
||||||
|
|
||||||
2005-07-31 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
|
2005-07-31 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
|
||||||
|
|
||||||
* 21553: Doc/Makefile.in, Doc/.distfiles: Create zsh.pdf
|
* 21553: Doc/Makefile.in, Doc/.distfiles: Create zsh.pdf
|
||||||
|
|
|
@ -397,7 +397,7 @@ _perforce_call_p4() {
|
||||||
(( $+functions[_perforce_gen_cmd_list] )) ||
|
(( $+functions[_perforce_gen_cmd_list] )) ||
|
||||||
_perforce_gen_cmd_list() {
|
_perforce_gen_cmd_list() {
|
||||||
(( ${+_perforce_cmd_list} )) || typeset -ga _perforce_cmd_list
|
(( ${+_perforce_cmd_list} )) || typeset -ga _perforce_cmd_list
|
||||||
local hline
|
local hline line match mbegin mend
|
||||||
# Output looks like <tab>command-name<space>description in words...
|
# Output looks like <tab>command-name<space>description in words...
|
||||||
# Ignore blank lines and the heading line beginning `Perforce...'
|
# Ignore blank lines and the heading line beginning `Perforce...'
|
||||||
# Just gets run once, then cached, so don't bother optimising
|
# Just gets run once, then cached, so don't bother optimising
|
||||||
|
@ -407,6 +407,18 @@ _perforce_gen_cmd_list() {
|
||||||
[[ $hline[1] = (#i)perforce ]] && continue
|
[[ $hline[1] = (#i)perforce ]] && continue
|
||||||
_perforce_cmd_list+=("${hline[1]}:${hline[2,-1]}")
|
_perforce_cmd_list+=("${hline[1]}:${hline[2,-1]}")
|
||||||
done
|
done
|
||||||
|
# Also cache the server version for nefarious purposes.
|
||||||
|
_perforce_call_p4 info info | while read line; do
|
||||||
|
if [[ $line = (#b)"Server version: "*/*/(<->.<->)/*" "(*) ]]; then
|
||||||
|
_perforce_server_version=$match[1]
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ -n ${_perforce_server_version} && \
|
||||||
|
${_perforce_server_version%%.*} -ge 2004 && \
|
||||||
|
${_perforce_cmd_list[(r)attribute:*]} = '' ]]; then
|
||||||
|
# As yet unsupported attribute command
|
||||||
|
_perforce_cmd_list+=("attribute:Set attributes for open file (EXPERIMENTAL)")
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1389,6 +1401,23 @@ _perforce_cmd_annotate() {
|
||||||
'*::file:_perforce_files -tR'
|
'*::file:_perforce_files -tR'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
(( $+functions[_perforce_cmd_attribute] )) ||
|
||||||
|
_perforce_cmd_attribute() {
|
||||||
|
# This is currently (2005.1) an unsupported command.
|
||||||
|
# See "p4 help undoc".
|
||||||
|
local limit
|
||||||
|
# If -f is present, search unopened files, else don't
|
||||||
|
[[ ${words[(I)-f]} -eq 0 ]] && limit=" -to"
|
||||||
|
_arguments -s : \
|
||||||
|
'-e[Value is in hex]' \
|
||||||
|
'-f[Set the attribute on a submitted file]' \
|
||||||
|
'-n[Set name of attribute]:attribute: ' \
|
||||||
|
'-v[Set value of attribute]:value: ' \
|
||||||
|
"*::file:_perforce_files$limit"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
(( $+functions[_perforce_cmd_branch] )) ||
|
(( $+functions[_perforce_cmd_branch] )) ||
|
||||||
_perforce_cmd_branch() {
|
_perforce_cmd_branch() {
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
|
@ -1620,6 +1649,12 @@ _perforce_cmd_flush() {
|
||||||
|
|
||||||
(( $+functions[_perforce_cmd_fstat] )) ||
|
(( $+functions[_perforce_cmd_fstat] )) ||
|
||||||
_perforce_cmd_fstat() {
|
_perforce_cmd_fstat() {
|
||||||
|
local Oattr Aattr
|
||||||
|
if [[ ${_perforce_cmd_list[(r)attribute:*]} != '' ]]; then
|
||||||
|
# Unsupported feature, try not to show if not present
|
||||||
|
Oattr=' a\:show\ attributes d\:attributes\ digest e\:attributes\ in\ hex'
|
||||||
|
Aattr='-A[Restrict attributes by pattern]:attribute pattern: '
|
||||||
|
fi
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
'-c+[affected since change]:change:_perforce_changes -ts' \
|
'-c+[affected since change]:change:_perforce_changes -ts' \
|
||||||
'-e+[affected by change]:change:_perforce_changes -ts' \
|
'-e+[affected by change]:change:_perforce_changes -ts' \
|
||||||
|
@ -1627,10 +1662,11 @@ _perforce_cmd_fstat() {
|
||||||
'-H[select synced files (-Rh)]' \
|
'-H[select synced files (-Rh)]' \
|
||||||
'-W[select opened files (-Ro)]' \
|
'-W[select opened files (-Ro)]' \
|
||||||
'-l[include fileSize, possibly slow (-Ol)]' \
|
'-l[include fileSize, possibly slow (-Ol)]' \
|
||||||
'-O-[select output type]:output type:((f\:all\ revisions l\:fileSize p\:client\ path\ format r\:pending\ integrations s\:exclude\ local\ path))' \
|
"-O-[select output type]:output type:((f\:all\ revisions l\:fileSize p\:client\ path\ format r\:pending\ integrations s\:exclude\ local\ path$Oattr))" \
|
||||||
'-P[output clientFile in full Perforce syntax (-Op)]' \
|
'-P[output clientFile in full Perforce syntax (-Op)]' \
|
||||||
'-R-[restrict selected files]:restriction:((c\:mapped\ in\ client h\:synced\ to\ client n\:not\ synced\ to\ head o\:opened r\:resolved u\:unresolved))' \
|
'-R-[restrict selected files]:restriction:((c\:mapped\ in\ client h\:synced\ to\ client n\:not\ synced\ to\ head o\:opened r\:resolved u\:unresolved))' \
|
||||||
'-s[shorten, no client-related data (-Os)]' \
|
'-s[shorten, no client-related data (-Os)]' \
|
||||||
|
$Aattr \
|
||||||
'*::file:_perforce_files'
|
'*::file:_perforce_files'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,11 +201,30 @@ is the number of the matching element, so that pairs of subscripts such as
|
||||||
possible if the parameter is not an associative array. If the
|
possible if the parameter is not an associative array. If the
|
||||||
parameter is an associative array, only the value part of each pair is
|
parameter is an associative array, only the value part of each pair is
|
||||||
compared to the pattern, and the result is that value.
|
compared to the pattern, and the result is that value.
|
||||||
|
|
||||||
|
If a search through an ordinary array failed, the search sets the
|
||||||
|
subscript to one past the end of the array, and hence
|
||||||
|
tt(${array[(r)pattern]}) will substitute the empty string. Thus the
|
||||||
|
success of a search can be tested by using the tt((i)) flag, for
|
||||||
|
example (assuming the option tt(KSH_ARRAYS) is not in effect):
|
||||||
|
|
||||||
|
example([[ ${array[(i)pattern]} -le ${#array} ]])
|
||||||
|
|
||||||
|
If tt(KSH_ARRAYS) is in effect, the tt(-le) should be replaced by tt(-lt).
|
||||||
)
|
)
|
||||||
item(tt(R))(
|
item(tt(R))(
|
||||||
Like `tt(r)', but gives the last match. For associative arrays, gives
|
Like `tt(r)', but gives the last match. For associative arrays, gives
|
||||||
all possible matches. May be used for assigning to ordinary array
|
all possible matches. May be used for assigning to ordinary array
|
||||||
elements, but not for assigning to associative arrays.
|
elements, but not for assigning to associative arrays.
|
||||||
|
|
||||||
|
Note that this flag can give odd results on failure. For an ordinary array
|
||||||
|
the item substituted is that corresponding to subscript 0. If the option
|
||||||
|
tt(KSH_ARRAYS) is not in effect, this is the same as the element
|
||||||
|
corresponding to subscript 1, although the form tt(${array[(I)pattern]})
|
||||||
|
will evaluate to 0 for a failed match. If the option tt(KSH_ARRAYS) is in
|
||||||
|
effect, the subscript is still 0 for a failed match; this cannot be
|
||||||
|
distinguished from a successful match without testing tt(${array[0]})
|
||||||
|
against the pattern.
|
||||||
)
|
)
|
||||||
item(tt(i))(
|
item(tt(i))(
|
||||||
Like `tt(r)', but gives the index of the match instead; this may not be
|
Like `tt(r)', but gives the index of the match instead; this may not be
|
||||||
|
@ -213,10 +232,14 @@ combined with a second argument. On the left side of an assignment,
|
||||||
behaves like `tt(r)'. For associative arrays, the key part of each pair
|
behaves like `tt(r)'. For associative arrays, the key part of each pair
|
||||||
is compared to the pattern, and the first matching key found is the
|
is compared to the pattern, and the first matching key found is the
|
||||||
result.
|
result.
|
||||||
|
|
||||||
|
See `tt(r)' for discussion of subscripts of failed matches.
|
||||||
)
|
)
|
||||||
item(tt(I))(
|
item(tt(I))(
|
||||||
Like `tt(i)', but gives the index of the last match, or all possible
|
Like `tt(i)', but gives the index of the last match, or all possible
|
||||||
matching keys in an associative array.
|
matching keys in an associative array.
|
||||||
|
|
||||||
|
See `tt(R)' for discussion of subscripts of failed matches.
|
||||||
)
|
)
|
||||||
item(tt(k))(
|
item(tt(k))(
|
||||||
If used in a subscript on an associative array, this flag causes the keys
|
If used in a subscript on an associative array, this flag causes the keys
|
||||||
|
|
2
FEATURES
2
FEATURES
|
@ -19,7 +19,7 @@ generalized pipes (ls foo >>(cmd1) 2>>(cmd2) pipes stdout to cmd1
|
||||||
arithmetic expressions
|
arithmetic expressions
|
||||||
advanced globbing:
|
advanced globbing:
|
||||||
ls **/file searches recursively for "file" in subdirectories
|
ls **/file searches recursively for "file" in subdirectories
|
||||||
ls file<20-> matches file20, file30, file100, etc.
|
ls file<20-> matches file20, file21, file22, etc.
|
||||||
ls *.(c|pro) matches *.c and *.pro
|
ls *.(c|pro) matches *.c and *.pro
|
||||||
ls *(R) matches only world-readable files
|
ls *(R) matches only world-readable files
|
||||||
ls *.c~lex.c matches all .c files except lex.c
|
ls *.c~lex.c matches all .c files except lex.c
|
||||||
|
|
|
@ -337,7 +337,7 @@ struct timezone {
|
||||||
# endif /* HAVE_TERMIO_H */
|
# endif /* HAVE_TERMIO_H */
|
||||||
#endif /* HAVE_TERMIOS_H */
|
#endif /* HAVE_TERMIOS_H */
|
||||||
|
|
||||||
#if defined(GWINSZ_IN_SYS_IOCTL) || defined(CLOBBERS_TYPEAHEAD)
|
#if defined(GWINSZ_IN_SYS_IOCTL) || defined(IOCTL_IN_SYS_IOCTL)
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef WINSIZE_IN_PTEM
|
#ifdef WINSIZE_IN_PTEM
|
||||||
|
|
84
configure.ac
84
configure.ac
|
@ -575,18 +575,15 @@ if test $ac_cv_header_sys_time_h = yes && test $ac_cv_header_sys_select_h = yes;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK(POSIX termios, zsh_cv_sys_posix_termios,
|
AH_TEMPLATE([GWINSZ_IN_SYS_IOCTL],
|
||||||
[AC_TRY_LINK([#include <sys/types.h>
|
[Define if TIOCGWINSZ is defined in sys/ioctl.h but not in termios.h.])
|
||||||
#include <unistd.h>
|
if test $ac_cv_header_termios_h = yes; then
|
||||||
#include <termios.h>],
|
|
||||||
[/* SunOS 4.0.3 has termios.h but not the library calls. */
|
|
||||||
tcgetattr(0, 0);],
|
|
||||||
zsh_cv_sys_posix_termios=yes, zsh_cv_sys_posix_termios=no)])
|
|
||||||
|
|
||||||
if test $zsh_cv_sys_posix_termios = yes; then
|
|
||||||
AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
|
AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
|
||||||
zsh_cv_header_termios_h_tiocgwinsz,
|
zsh_cv_header_termios_h_tiocgwinsz,
|
||||||
[AC_TRY_LINK([#include <sys/types.h>
|
[AC_TRY_LINK([
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
# include <sys/types.h>
|
||||||
|
#endif
|
||||||
#include <termios.h>],
|
#include <termios.h>],
|
||||||
[int x = TIOCGWINSZ;],
|
[int x = TIOCGWINSZ;],
|
||||||
zsh_cv_header_termios_h_tiocgwinsz=yes,
|
zsh_cv_header_termios_h_tiocgwinsz=yes,
|
||||||
|
@ -594,13 +591,13 @@ if test $zsh_cv_sys_posix_termios = yes; then
|
||||||
else
|
else
|
||||||
zsh_cv_header_termios_h_tiocgwinsz=no
|
zsh_cv_header_termios_h_tiocgwinsz=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AH_TEMPLATE([GWINSZ_IN_SYS_IOCTL],
|
|
||||||
[Define if your system defines TIOCGWINSZ in sys/ioctl.h.])
|
|
||||||
if test $zsh_cv_header_termios_h_tiocgwinsz = no; then
|
if test $zsh_cv_header_termios_h_tiocgwinsz = no; then
|
||||||
AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
|
AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
|
||||||
zsh_cv_header_sys_ioctl_h_tiocgwinsz,
|
zsh_cv_header_sys_ioctl_h_tiocgwinsz,
|
||||||
[AC_TRY_LINK([#include <sys/types.h>
|
[AC_TRY_LINK([
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
# include <sys/types.h>
|
||||||
|
#endif
|
||||||
#include <sys/ioctl.h>],
|
#include <sys/ioctl.h>],
|
||||||
[int x = TIOCGWINSZ;],
|
[int x = TIOCGWINSZ;],
|
||||||
zsh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
|
zsh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
|
||||||
|
@ -1694,24 +1691,12 @@ if test $zsh_cv_header_unistd_h_sbrk_proto = yes; then
|
||||||
AC_DEFINE(HAVE_SBRK_PROTO)
|
AC_DEFINE(HAVE_SBRK_PROTO)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl ----------------------------------
|
dnl -----------------------
|
||||||
dnl ioctl and mknod prototypes for OSF
|
dnl mknod prototype for OSF
|
||||||
dnl ----------------------------------
|
dnl -----------------------
|
||||||
|
|
||||||
AH_TEMPLATE([HAVE_IOCTL_PROTO],
|
|
||||||
[Define to 1 if there is a prototype defined for ioctl() on your system])
|
|
||||||
AH_TEMPLATE([HAVE_MKNOD_PROTO],
|
AH_TEMPLATE([HAVE_MKNOD_PROTO],
|
||||||
[Define to 1 if there is a prototype defined for mknod() on your system])
|
[Define to 1 if there is a prototype defined for mknod() on your system.])
|
||||||
if test "$ac_cv_prog_cc_stdc" != no; then
|
if test "$ac_cv_prog_cc_stdc" != no; then
|
||||||
AC_CACHE_CHECK(for ioctl prototype in <sys/ioctl.h>,
|
|
||||||
zsh_cv_header_sys_ioctl_h_ioctl_proto,
|
|
||||||
[AC_TRY_COMPILE([#include <sys/ioctl.h>
|
|
||||||
int ioctl(double x);], [int i;],
|
|
||||||
zsh_cv_header_sys_ioctl_h_ioctl_proto=no,
|
|
||||||
zsh_cv_header_sys_ioctl_h_ioctl_proto=yes)])
|
|
||||||
if test $zsh_cv_header_sys_ioctl_h_ioctl_proto = yes; then
|
|
||||||
AC_DEFINE(HAVE_IOCTL_PROTO)
|
|
||||||
fi
|
|
||||||
AC_CACHE_CHECK(for mknod prototype in <sys/stat.h>,
|
AC_CACHE_CHECK(for mknod prototype in <sys/stat.h>,
|
||||||
zsh_cv_header_sys_stat_h_mknod_proto,
|
zsh_cv_header_sys_stat_h_mknod_proto,
|
||||||
[AC_TRY_COMPILE([#include <sys/stat.h>
|
[AC_TRY_COMPILE([#include <sys/stat.h>
|
||||||
|
@ -1723,6 +1708,45 @@ if test "$ac_cv_prog_cc_stdc" != no; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl ----------------------------------------
|
||||||
|
dnl presence and location of ioctl prototype
|
||||||
|
dnl ----------------------------------------
|
||||||
|
AC_CACHE_CHECK(for ioctl prototype in <unistd.h> or <termios.h>,
|
||||||
|
zsh_cv_header_unistd_h_termios_h_ioctl_proto,
|
||||||
|
[AC_TRY_COMPILE([
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_TERMIOS_H
|
||||||
|
# include <termios.h>
|
||||||
|
#endif
|
||||||
|
double ioctl();], [int i;],
|
||||||
|
zsh_cv_header_unistd_h_termios_h_ioctl_proto=no,
|
||||||
|
zsh_cv_header_unistd_h_termios_h_ioctl_proto=yes)])
|
||||||
|
|
||||||
|
if test $zsh_cv_header_unistd_h_termios_h_ioctl_proto = no; then
|
||||||
|
AC_CACHE_CHECK(for ioctl prototype in <sys/ioctl.h>,
|
||||||
|
zsh_cv_header_sys_ioctl_h_ioctl_proto,
|
||||||
|
[AC_TRY_COMPILE([#include <sys/ioctl.h>
|
||||||
|
double ioctl();], [int i;],
|
||||||
|
zsh_cv_header_sys_ioctl_h_ioctl_proto=no,
|
||||||
|
zsh_cv_header_sys_ioctl_h_ioctl_proto=yes)])
|
||||||
|
else
|
||||||
|
zsh_cv_header_sys_ioctl_h_ioctl_proto=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
AH_TEMPLATE([HAVE_IOCTL_PROTO],
|
||||||
|
[Define to 1 if there is a prototype defined for ioctl() on your system.])
|
||||||
|
if test $zsh_cv_header_unistd_h_termios_h_ioctl_proto = yes || \
|
||||||
|
test $zsh_cv_header_sys_ioctl_h_ioctl_proto = yes; then
|
||||||
|
AC_DEFINE(HAVE_IOCTL_PROTO)
|
||||||
|
fi
|
||||||
|
AH_TEMPLATE([IOCTL_IN_SYS_IOCTL],
|
||||||
|
[Define to 1 if we must include <sys/ioctl.h> to get a prototype for ioctl().])
|
||||||
|
if test $zsh_cv_header_sys_ioctl_h_ioctl_proto = yes; then
|
||||||
|
AC_DEFINE(IOCTL_IN_SYS_IOCTL)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl -------------------
|
dnl -------------------
|
||||||
dnl select() defined in <sys/socket.h>, ie BeOS R4.51
|
dnl select() defined in <sys/socket.h>, ie BeOS R4.51
|
||||||
dnl -------------------
|
dnl -------------------
|
||||||
|
|
Loading…
Reference in a new issue