[PATCH 3/6] cogito: try harder to find gnu stat
- From
Bryan Larsen <bryanlarsen@yahoo.com>
- Date
- Jul 18, 2005, 02:51 UTC
- Message-ID
- <20050718025057.11198.96144.sendpatchset@bryan-larsens-ibook-g4.local>
- In-Reply-To
- <20050718025024.11198.10556.sendpatchset@bryan-larsens-ibook-g4.local>
Look harder for gnu stat.
Cogito has code to use awk if gnu stat is missing. Look harder for gnu stat under alternate names such as gstat and gnustat, avoiding the use of awk if possible.
Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com> ---
cg-Xlib | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/cg-Xlib b/cg-Xlib --- a/cg-Xlib +++ b/cg-Xlib @@ -229,11 +229,16 @@ fi # Compatibility hacks: -# Fortunately none as of now. - export BROKEN_MKTEMP=1 del=$($(which mktemp) -t 2>/dev/null) && { rm $del; export BROKEN_MKTEMP=; } -has_stat=$(which stat 2>/dev/null) -[ "$has_stat" ] && $has_stat -c %s / 2>/dev/null >&2 || has_stat= + +has_stat= +for stat in "$(which gnustat)" "$(which gstat)" "$(which stat)" ; do + if ( [ $stat ] && $stat -c %s / 2> /dev/null >&2 ) ; then + has_stat=$stat + break + fi +done + has_gnudate=$(date -Rud "1970-01-01 UTC" 2>/dev/null)