Add default encoding option -D to preconv and groff.
[s-roff.git] / mdate.sh
blob984379fc7dbaaf58b64bc79c914c38bdce32d6e2
1 #! /bin/sh
3 # Copyright (C) 1991, 1992, 2001
4 # Free Software Foundation, Inc.
5 #
6 # This file is part of groff.
7 #
8 # groff is free software; you can redistribute it and/or modify it under
9 # the terms of the GNU General Public License as published by the Free
10 # Software Foundation; either version 2, or (at your option) any later
11 # version.
13 # groff is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 # for more details.
18 # You should have received a copy of the GNU General Public License along
19 # with groff; see the file COPYING. If not, write to the Free Software
20 # Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
22 # Print the modification date of $1 `nicely'.
24 # Don't want foreign dates.
26 LANGUAGE=
27 LC_ALL=C; export LC_ALL
30 (date;
31 if ls -L /dev/null 1>/dev/null 2>&1; then ls -L -l $1; else ls -l $1; fi
32 ) | awk '
33 BEGIN {
34 full["Jan"] = "January"; number["Jan"] = 1;
35 full["Feb"] = "February"; number["Feb"] = 2;
36 full["Mar"] = "March"; number["Mar"] = 3;
37 full["Apr"] = "April"; number["Apr"] = 4;
38 full["May"] = "May"; number["May"] = 5;
39 full["Jun"] = "June"; number["Jun"] = 6;
40 full["Jul"] = "July"; number["Jul"] = 7;
41 full["Aug"] = "August"; number["Aug"] = 8;
42 full["Sep"] = "September"; number["Sep"] = 9;
43 full["Oct"] = "October"; number["Oct"] = 10;
44 full["Nov"] = "November"; number["Nov"] = 11;
45 full["Dec"] = "December"; number["Dec"] = 12;
48 NR == 1 {
49 month = $2;
50 year = $NF;
53 NR == 2 {
54 if ($(NF-1) ~ /:/) {
55 if (number[$(NF-3)] > number[month])
56 year--;
58 else
59 year = $(NF-1);
60 print $(NF-2), full[$(NF-3)], year