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

[PATCH 4/5] cogito: try harder to find gnu date

From
Bryan Larsen <bryanlarsen@yahoo.com>
Date
Jul 16, 2005, 23:24 UTC
Message-ID
<20050716232353.7317.63574.sendpatchset@bryan-larsens-ibook-g4.local>
In-Reply-To
<20050716232308.7317.56890.sendpatchset@bryan-larsens-ibook-g4.local>
Look harder for gnu date, use if available.
Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---
 cg-Xlib |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/cg-Xlib b/cg-Xlib
--- a/cg-Xlib
+++ b/cg-Xlib
@@ -70,7 +70,7 @@ showdate () {
 	secs=$(($secs + $tzhours * 3600 + $tzmins * 60))
 	[ "$format" ] || format="+%a, %d %b %Y %H:%M:%S $2"
 	if [ "$has_gnudate" ]; then
-		LANG=C date -ud "1970-01-01 UTC + $secs sec" "$format"
+		LANG=C ${has_gnudate} -ud "1970-01-01 UTC + $secs sec" "$format"
 	else
 		LANG=C date -u -r $secs "$format"
 	fi
@@ -236,4 +236,8 @@ has_stat=$(which gnustat 2> /dev/null ||
     which gstat 2> /dev/null ||
     which stat 2>/dev/null)
 [ "$has_stat" ] && $has_stat -c %s / 2>/dev/null >&2 || has_stat=
-has_gnudate=$(date -Rud "1970-01-01 UTC" 2>/dev/null)
+has_gnudate=$(which gnudate 2> /dev/null || 
+    which gdate 2> /dev/null || 
+    which stat 2>/dev/null)
+[ "$has_gnudate" ] && 
+    $has_gnudate -Rud  "1970-01-01 UTC" 2> /dev/null >&2 || has_gnudate=
Previous: Bryan LarsenNext: Bryan Larsen
Message 5 of 6 in “cogito: compatibility with OS X”
  1. 0/5 cogito: compatibility with OS XBryan Larsen, Jul 16, 2005
  2. 1/5 cogito: remove use of xargs -r, a non-portable GNU extensionBryan Larsen, Jul 16, 2005
  3. 2/5 cogito: remove use of cp -a, a non-portable GNU extensionBryan Larsen, Jul 16, 2005
  4. 3/5 cogito: try harder to find gnu statBryan Larsen, Jul 16, 2005
  5. 4/5 cogito: try harder to find gnu dateBryan Larsen, Jul 16, 2005
  6. 5/5 cogito: remove findutils dependency from PortfileBryan Larsen, Jul 16, 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.