]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/groff/mdate.sh
This commit was generated by cvs2svn to compensate for changes in r98503,
[FreeBSD/FreeBSD.git] / contrib / groff / mdate.sh
1 #! /bin/sh
2 #
3 # $FreeBSD$
4
5 # Print the modification date of $1 `nicely'.
6
7 # Don't want foreign dates.
8
9 LANGUAGE=
10 LC_ALL=C; export LC_ALL
11
12
13 (date;
14 if ls -L /dev/null 1>/dev/null 2>&1; then ls -L -l $1; else ls -l $1; fi
15 ) | awk '
16 BEGIN {
17         full["Jan"] = "January"; number["Jan"] = 1;
18         full["Feb"] = "February"; number["Feb"] = 2;
19         full["Mar"] = "March"; number["Mar"] = 3;
20         full["Apr"] = "April"; number["Apr"] = 4;
21         full["May"] = "May"; number["May"] = 5;
22         full["Jun"] = "June"; number["Jun"] = 6;
23         full["Jul"] = "July"; number["Jul"] = 7;
24         full["Aug"] = "August"; number["Aug"] = 8;
25         full["Sep"] = "September"; number["Sep"] = 9;
26         full["Oct"] = "October"; number["Oct"] = 10;
27         full["Nov"] = "November"; number["Nov"] = 11;
28         full["Dec"] = "December"; number["Dec"] = 12;
29 }
30
31 NR == 1 {
32         month = $2;
33         year = $NF;
34 }
35
36 NR == 2 {
37         if ($(NF-1) ~ /:/) {
38                 if (number[$(NF-3)] > number[month])
39                         year--;
40         }
41         else
42                 year = $(NF-1);
43         print $(NF-2), full[$(NF-3)], year
44 }'