comparison version.sh @ 15649:c3688869c2e5

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>
author diego
date Sun, 05 Jun 2005 17:38:10 +0000
parents 65a8ce32e9f1
children 5c5219508907
comparison
equal deleted inserted replaced
15648:3cc7c23f6f32 15649:c3688869c2e5
16 last_cvs_update="${year}${month}${day}-${hour}:${minute}" 16 last_cvs_update="${year}${month}${day}-${hour}:${minute}"
17 ;; 17 ;;
18 Darwin|*BSD) 18 Darwin|*BSD)
19 # BSD 'date -r' does not print modification time 19 # BSD 'date -r' does not print modification time
20 # LC_ALL=C sets month/day order and English language in the date string 20 # LC_ALL=C sets month/day order and English language in the date string
21 LS=`LC_ALL=C ls -lT CVS/Entries` 21 # The if in the awk call works around wrong day/month order.
22 year=`echo $LS | cut -d' ' -f9 | cut -c 3-4` 22 last_cvs_update=`LC_ALL=C ls -lT CVS/Entries | \
23 month=`echo $LS | awk -F" " '{printf "%.2d", \ 23 awk '{ \
24 (index("JanFebMarAprMayJunJulAugSepOctNovDec",$6)+2)/3}'` 24 day=$7; \
25 day=`printf %.2d \` echo $LS | cut -d' ' -f7 \` ` 25 month=index(" JanFebMarAprMayJunJulAugSepOctNovDec", $6); \
26 hour=`echo $LS | cut -d' ' -f8 | cut -d: -f1` 26 if(month==0) { \
27 minute=`echo $LS | cut -d' ' -f8 | cut -d: -f2` 27 day=$6; \
28 last_cvs_update="${year}${month}${day}-${hour}:${minute}" 28 month=index(" JanFebMarAprMayJunJulAugSepOctNovDec",$7); } \
29 printf("%s%.02d%.02d-%s", \
30 substr($9, 3, 2), (month+1)/3, day, substr($8, 0, 5)); \
31 }'`
29 ;; 32 ;;
30 *) 33 *)
31 last_cvs_update=`date +%y%m%d-%H:%M` 34 last_cvs_update=`date +%y%m%d-%H:%M`
32 ;; 35 ;;
33 esac 36 esac