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