git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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)
Previous: Bryan LarsenNext: Bryan Larsen
Message 4 of 8 in “cogito: compatibility with OS X”
  1. 0/6 cogito: compatibility with OS XBryan Larsen, Jul 18, 2005
  2. 1/6 cogito: remove use of xargs -r, a non-portable GNU extensionBryan Larsen, Jul 18, 2005
  3. 2/6 cogito: remove use of cp -a, a non-portable GNU extensionBryan Larsen, Jul 18, 2005
  4. 3/6 cogito: try harder to find gnu statBryan Larsen, Jul 18, 2005
  5. 4/6 cogito: try harder to find gnu dateBryan Larsen, Jul 18, 2005
  6. 5/6 cogito: remove findutils dependency from PortfileBryan Larsen, Jul 18, 2005
  7. 6/6 cogito: update documentationBryan Larsen, Jul 18, 2005
  8. Petr BaudisJul 20, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.