1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-19 11:31:26 +01:00

31417: age function needs protection against file names starting "-"

This commit is contained in:
Stephane Chazelas 2013-05-21 14:45:52 +01:00 committed by Peter Stephenson
parent aa7467b0bf
commit 2989e4b66e
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2013-05-21 Peter Stephenson <p.stephenson@samsung.com>
* Stephane: 31417: Functions/Calendar/age: needs --
to protect againts files starting with -.
2013-05-14 Peter Stephenson <p.stephenson@samsung.com>
* unposted: Completion/Unix/Command/_perforce: Improve

View file

@ -36,18 +36,18 @@ autoload -Uz calendar_scandate
local -a vals tmp
[[ -e $REPLY ]] || return 1
zstat -A vals +mtime $REPLY || return 1
zstat -A vals +mtime -- $REPLY || return 1
if (( $# >= 1 )); then
if [[ $1 = :* ]]; then
zstat -A tmp -F "%Y/%m/%d" +mtime ${1[2,-1]} || return 1
zstat -A tmp -F "%Y/%m/%d" +mtime -- ${1#:} || return 1
local AGEREF=$tmp[1]
else
local AGEREF=$1
fi
# if 1 argument given, never use globally defined AGEREF2
if [[ $2 = :* ]]; then
zstat -A tmp -F "%Y/%m/%d" +mtime ${2[2,-1]} || return 1
zstat -A tmp -F "%Y/%m/%d" +mtime -- ${2#:} || return 1
local AGEREF2=$tmp[1]
else
local AGEREF2=$2