[MPlayer-cvslog] CVS: main version.sh,1.19,1.20

Diego Biurrun CVS syncmail at mplayerhq.hu
Sun Jun 5 19:38:13 CEST 2005


CVS change done by Diego Biurrun CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv32600

Modified Files:
	version.sh 
Log Message:
Generate the version string with awk on BSD systems and work around wrong
day/month order in the ls output.
based on a patch by Chris Roccati <roccati - at - pobox - dot - com>


Index: version.sh
===================================================================
RCS file: /cvsroot/mplayer/main/version.sh,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- version.sh	5 Jun 2005 14:17:34 -0000	1.19
+++ version.sh	5 Jun 2005 17:38:10 -0000	1.20
@@ -18,14 +18,17 @@
      Darwin|*BSD) 
 	# BSD 'date -r' does not print modification time
 	# LC_ALL=C sets month/day order and English language in the date string
-	LS=`LC_ALL=C ls -lT CVS/Entries`
-	year=`echo $LS | cut -d' ' -f9 | cut -c 3-4`
-	month=`echo $LS | awk -F" " '{printf "%.2d", \
-		(index("JanFebMarAprMayJunJulAugSepOctNovDec",$6)+2)/3}'`
-	day=`printf %.2d \` echo $LS | cut -d' ' -f7 \` `
-	hour=`echo $LS | cut -d' ' -f8 | cut -d: -f1`
-	minute=`echo $LS | cut -d' ' -f8 | cut -d: -f2`
-	last_cvs_update="${year}${month}${day}-${hour}:${minute}"
+	# The if in the awk call works around wrong day/month order.
+	last_cvs_update=`LC_ALL=C ls -lT CVS/Entries | \
+	  awk '{ \
+	    day=$7; \
+	    month=index(" JanFebMarAprMayJunJulAugSepOctNovDec", $6); \
+	    if(month==0) { \
+	      day=$6; \
+	      month=index(" JanFebMarAprMayJunJulAugSepOctNovDec",$7); } \
+	    printf("%s%.02d%.02d-%s", \
+	      substr($9, 3, 2), (month+1)/3, day, substr($8, 0, 5)); \
+	  }'`
 	;;
      *)
 	last_cvs_update=`date +%y%m%d-%H:%M`




More information about the MPlayer-cvslog mailing list