From 4a1549e058ac25d7ea9d2821292eeb5a3eefdd55 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sat, 2 Jun 2007 17:52:10 +0000 Subject: unposted: more uses of zstat --- ChangeLog | 5 +++++ Functions/Calendar/age | 22 +++------------------- Functions/Example/zls | 4 ++-- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e7b80cf0..0b6c3d869 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-06-02 Peter Stephenson + + * unposted: Functions/Calendar/age, Functions/Example/zls: + some more uses of zsh/stat that should only enable b:zstat. + 2007-05-30 Peter Stephenson * 23495: Completion/Base/Completer/_ignored, diff --git a/Functions/Calendar/age b/Functions/Calendar/age index b6f648adb..d47f975ad 100644 --- a/Functions/Calendar/age +++ b/Functions/Calendar/age @@ -27,24 +27,16 @@ # any argument is passed in the first format. emulate -L zsh -integer mystat disable_stat -zmodload -i zsh/stat -# Allow the builtin stat to be hidden. +zmodload -F zsh/stat b:zstat zmodload -i zsh/parameter -{ -if [[ $builtins[stat] != defined ]]; then - (( disable_stat = 1 )) - enable stat -fi - autoload -U calendar_scandate local -a vals [[ -e $REPLY ]] || return 1 -stat -A vals +mtime $REPLY || return 1 +zstat -A vals +mtime $REPLY || return 1 if (( $# >= 1 )); then local AGEREF=$1 @@ -72,14 +64,6 @@ if calendar_scandate -t $AGEREF; then fi (( date1 <= mtime && mtime <= date2 )) - mystat=$? else - mystat=1 + return 1 fi - -} always { -# If the builtin stat was previously disabled, disable it again. -(( disable_stat )) && disable stat -} - -return $mystat diff --git a/Functions/Example/zls b/Functions/Example/zls index 30a8fb9ed..f03ec0952 100644 --- a/Functions/Example/zls +++ b/Functions/Example/zls @@ -1,7 +1,7 @@ # zls () { # simple internal ls using the stat module -zmodload -i zsh/stat || return 1 +zmodload -F zsh/stat b:zstat || return 1 emulate -R zsh setopt localoptions @@ -49,7 +49,7 @@ fi for f in $* do - stat -s$L -H stat -F "%b %e %H:%M" - $f || continue + zstat -s$L -H stat -F "%b %e %H:%M" - $f || continue if [[ $opts != *d* && $stat[mode] == d* ]] then dirs=( $dirs $f ) elif [[ $opts == *l* ]] then -- cgit 1.4.1