2
# $Id: mdate-sh,v 1.1.1.1 2003/02/20 00:22:42 danmc Exp $
3
# Get modification time of a file or directory and pretty-print it.
4
# Copyright 1995, 1996, 1997 Free Software Foundation, Inc.
5
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
7
# This program is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 2, or (at your option)
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software Foundation,
19
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
# As a special exception to the GNU General Public License, if you
22
# distribute this file as part of a program that contains a
23
# configuration script generated by Autoconf, you may include it under
24
# the same distribution terms that you use for the rest of that program.
26
# Prevent date giving response in another language.
34
# Get the extended ls output of the file or directory.
35
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
36
if ls -L /dev/null 1>/dev/null 2>&1; then
37
set - x`ls -L -l -d $1`
41
# The month is at least the fourth argument
42
# (3 shifts here, the next inside the loop).
47
# Find the month. Next argument is day, followed by the year or time.
53
Jan) month=January; nummonth=1;;
54
Feb) month=February; nummonth=2;;
55
Mar) month=March; nummonth=3;;
56
Apr) month=April; nummonth=4;;
57
May) month=May; nummonth=5;;
58
Jun) month=June; nummonth=6;;
59
Jul) month=July; nummonth=7;;
60
Aug) month=August; nummonth=8;;
61
Sep) month=September; nummonth=9;;
62
Oct) month=October; nummonth=10;;
63
Nov) month=November; nummonth=11;;
64
Dec) month=December; nummonth=12;;
70
# Here we have to deal with the problem that the ls output gives either
71
# the time of day or the year.
73
*:*) set `date`; eval year=\$$#
88
# For the first six month of the year the time notation can also
89
# be used for files modified in the last year.
90
if (expr $nummonth \> $nummonthtod) > /dev/null;
98
echo $day $month $year