summaryrefslogtreecommitdiff
path: root/Functions/Misc/zargs
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-04-12 18:45:59 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-04-12 18:45:59 +0000
commit5e2fe3ca18887063f02a677baeb35eb669dec7eb (patch)
treecb3cc6d753d00c3908574096cfb2b8b98a6447a1 /Functions/Misc/zargs
parent4a4d9f3cbe72d3976f2df7053208c671c22c0410 (diff)
downloadzsh-5e2fe3ca18887063f02a677baeb35eb669dec7eb.tar.gz
zsh-5e2fe3ca18887063f02a677baeb35eb669dec7eb.zip
30388, 30389 (Stephane): zargs: handle zero-length arguments.
Diffstat (limited to 'Functions/Misc/zargs')
-rw-r--r--Functions/Misc/zargs16
1 files changed, 8 insertions, 8 deletions
diff --git a/Functions/Misc/zargs b/Functions/Misc/zargs
index 8350b1aba..71fd42835 100644
--- a/Functions/Misc/zargs
+++ b/Functions/Misc/zargs
@@ -167,14 +167,14 @@ if [[ $eof == -(e|-eof) ]]; then ((end=ARGC+1))
elif (( $#eof )); then end=$argv[(i)${eof##-(e|-eof=)}]
else end=$argv[(i)--]
fi
-local -a args call command; command=( ${argv[end+1,-1]} )
+local -a args call command; command=( "${(@)argv[end+1,-1]}" )
if (( $opts[(I)-(null|0)] ))
-then set -- ${(ps:\000:)argv[1,end-1]}
-else set -- $argv[1,end-1]
+then set -- "${(@ps:\000:)argv[1,end-1]}"
+else set -- "${(@)argv[1,end-1]}"
fi
-if [[ -n $command ]]
+if (( $#command ))
then (( c = $#command - 1 ))
else command=( print -r -- )
fi
@@ -187,7 +187,7 @@ local execute='
then print -u2 -r -- "$call"
fi
eval "{
- \$call
+ \"\${(@)call}\"
} $bg"'
local ret=0 analyze='
case $? in
@@ -275,11 +275,11 @@ do
((ARGC)) || break
for (( end=l; end && ${(c)#argv[1,end]} > s; end/=2 )) { }
(( end > n && ( end = n ) ))
- args=( $argv[1,end] )
+ args=( "${(@)argv[1,end]}" )
shift $((end > ARGC ? ARGC : end))
if (( $#i ))
- then call=( ${command/$i/$args} )
- else call=( $command $args )
+ then call=( "${(@)command/$i/$args}" )
+ else call=( "${(@)command}" "${(@)args}" )
fi
if (( ${(c)#call} > s ))
then