| Commit | Line | Data |
|---|---|---|
| 92d0a6a6 | 1 | #! /bin/sh |
| 4d3e9548 JL |
2 | # |
| 3 | # Copyright (C) 1991, 1992, 2001, 2009 | |
| 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 3 of the License, or | |
| 11 | # (at your option) any later version. | |
| 12 | # | |
| 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. | |
| 17 | # | |
| 18 | # You should have received a copy of the GNU General Public License | |
| 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 20 | # | |
| 92d0a6a6 JR |
21 | # Print the modification date of $1 `nicely'. |
| 22 | ||
| 23 | # Don't want foreign dates. | |
| 24 | ||
| 25 | LANGUAGE= | |
| 26 | LC_ALL=C; export LC_ALL | |
| 27 | ||
| 28 | ||
| 29 | (date; | |
| 30 | if ls -L /dev/null 1>/dev/null 2>&1; then ls -L -l $1; else ls -l $1; fi | |
| 31 | ) | awk ' | |
| 32 | BEGIN { | |
| 33 | full["Jan"] = "January"; number["Jan"] = 1; | |
| 34 | full["Feb"] = "February"; number["Feb"] = 2; | |
| 35 | full["Mar"] = "March"; number["Mar"] = 3; | |
| 36 | full["Apr"] = "April"; number["Apr"] = 4; | |
| 37 | full["May"] = "May"; number["May"] = 5; | |
| 38 | full["Jun"] = "June"; number["Jun"] = 6; | |
| 39 | full["Jul"] = "July"; number["Jul"] = 7; | |
| 40 | full["Aug"] = "August"; number["Aug"] = 8; | |
| 41 | full["Sep"] = "September"; number["Sep"] = 9; | |
| 42 | full["Oct"] = "October"; number["Oct"] = 10; | |
| 43 | full["Nov"] = "November"; number["Nov"] = 11; | |
| 44 | full["Dec"] = "December"; number["Dec"] = 12; | |
| 45 | } | |
| 46 | ||
| 47 | NR == 1 { | |
| 48 | month = $2; | |
| 49 | year = $NF; | |
| 50 | } | |
| 51 | ||
| 52 | NR == 2 { | |
| 53 | if ($(NF-1) ~ /:/) { | |
| 54 | if (number[$(NF-3)] > number[month]) | |
| 55 | year--; | |
| 56 | } | |
| 57 | else | |
| 58 | year = $(NF-1); | |
| 59 | print $(NF-2), full[$(NF-3)], year | |
| 60 | }' |