groff before CVS: release 1.07
[s-roff.git] / mdate.sh
blob6bdac9d477d379cbde49176a2245bcb9e758ce09
1 #! /bin/sh
3 # Print the modification date of $1 `nicely'.
5 # Don't want foreign dates.
7 LANGUAGE=
10 (date;
11 if ls -L /dev/null 1>/dev/null 2>&1; then ls -L -l $1; else ls -l $1; fi
12 ) | awk '
13 BEGIN {
14 full["Jan"] = "January"; number["Jan"] = 1;
15 full["Feb"] = "February"; number["Feb"] = 2;
16 full["Mar"] = "March"; number["Mar"] = 3;
17 full["Apr"] = "April"; number["Apr"] = 4;
18 full["May"] = "May"; number["May"] = 5;
19 full["Jun"] = "June"; number["Jun"] = 6;
20 full["Jul"] = "July"; number["Jul"] = 7;
21 full["Aug"] = "August"; number["Aug"] = 8;
22 full["Sep"] = "September"; number["Sep"] = 9;
23 full["Oct"] = "October"; number["Oct"] = 10;
24 full["Nov"] = "November"; number["Nov"] = 11;
25 full["Dec"] = "December"; number["Dec"] = 12;
28 NR == 1 {
29 month = $2;
30 year = $NF;
33 NR == 2 {
34 if ($(NF-1) ~ /:/) {
35 if (number[$(NF-3)] > number[month])
36 year--;
38 else
39 year = $(NF-1);
40 print $(NF-2), full[$(NF-3)], year