Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: check for no parameters to compdef
- X-seq: zsh-workers 7891
- From: Adam Spiers <adam@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh workers mailing list <zsh-workers@xxxxxxxxxxxxxx>
- Subject: PATCH: check for no parameters to compdef
- Date: Fri, 17 Sep 1999 03:52:38 +0100
- Mail-followup-to: zsh workers mailing list <zsh-workers@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- Reply-to: Adam Spiers <adam@xxxxxxxxxx>
Any call to compdef with too few parameters resulted in a rather ugly
error:
compdef: shift: shift count must be <= $# [194]
when shift ran out of things to shift. Here's a very crude check to
stop this happening.
Index: Completion/Core/compinit
===================================================================
RCS file: /usr/local/cvsroot/zsh/Completion/Core/compinit,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 compinit
--- Completion/Core/compinit 1999/09/16 11:37:17 1.1.1.3
+++ Completion/Core/compinit 1999/09/17 01:43:11
@@ -152,6 +152,11 @@
# Get the options.
+ if [[ $#* -eq 0 ]]; then
+ echo "compdef needs parameters"
+ return 1
+ fi
+
while getopts "anpPkd" opt; do
case "$opt" in
a) autol=yes;;
@@ -175,6 +180,11 @@
done
shift OPTIND-1
+ if [[ $#* -eq 0 ]]; then
+ echo "compdef needs parameters"
+ return 1
+ fi
+
if [[ -z "$delete" ]]; then
# Adding definitions, first get the name of the function name
# and probably do autoloading.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author