mdate.sh revision 73349
118099Spst#! /bin/sh 269671Sru# 369671Sru# $FreeBSD: head/contrib/groff/mdate.sh 73349 2001-03-02 16:52:14Z ru $ 418099Spst 518099Spst# Print the modification date of $1 `nicely'. 618099Spst 718099Spst# Don't want foreign dates. 818099Spst 918099SpstLANGUAGE= 1073349SruLC_ALL=C; export LC_ALL 1118099Spst 1218099Spst 1318099Spst(date; 1418099Spstif ls -L /dev/null 1>/dev/null 2>&1; then ls -L -l $1; else ls -l $1; fi 1518099Spst) | awk ' 1618099SpstBEGIN { 1718099Spst full["Jan"] = "January"; number["Jan"] = 1; 1818099Spst full["Feb"] = "February"; number["Feb"] = 2; 1918099Spst full["Mar"] = "March"; number["Mar"] = 3; 2018099Spst full["Apr"] = "April"; number["Apr"] = 4; 2118099Spst full["May"] = "May"; number["May"] = 5; 2218099Spst full["Jun"] = "June"; number["Jun"] = 6; 2318099Spst full["Jul"] = "July"; number["Jul"] = 7; 2418099Spst full["Aug"] = "August"; number["Aug"] = 8; 2518099Spst full["Sep"] = "September"; number["Sep"] = 9; 2618099Spst full["Oct"] = "October"; number["Oct"] = 10; 2718099Spst full["Nov"] = "November"; number["Nov"] = 11; 2818099Spst full["Dec"] = "December"; number["Dec"] = 12; 2918099Spst} 3018099Spst 3118099SpstNR == 1 { 3218099Spst month = $2; 3318099Spst year = $NF; 3418099Spst} 3518099Spst 3618099SpstNR == 2 { 3718099Spst if ($(NF-1) ~ /:/) { 3818099Spst if (number[$(NF-3)] > number[month]) 3918099Spst year--; 4018099Spst } 4118099Spst else 4218099Spst year = $(NF-1); 4318099Spst print $(NF-2), full[$(NF-3)], year 4418099Spst}' 45