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:
parent
aa7467b0bf
commit
2989e4b66e
2 changed files with 8 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue