mdate-sh revision 2
70N/A# Get modification time of a file or directory and pretty-print it. 70N/A# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software 70N/A# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995 70N/A# This program is free software; you can redistribute it and/or modify 70N/A# it under the terms of the GNU General Public License as published by 70N/A# the Free Software Foundation; either version 2, or (at your option) 70N/A# any later version. 70N/A# This program is distributed in the hope that it will be useful, 70N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of 70N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 70N/A# GNU General Public License for more details. 70N/A# You should have received a copy of the GNU General Public License 70N/A# along with this program; if not, write to the Free Software Foundation, 70N/A# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 70N/A# As a special exception to the GNU General Public License, if you 70N/A# distribute this file as part of a program that contains a 70N/A# configuration script generated by Autoconf, you may include it under 70N/A# the same distribution terms that you use for the rest of that program. 70N/A# This file is maintained in Automake, please report 70N/A# bugs to <bug-automake@gnu.org> or send patches to 649N/A# <automake-patches@gnu.org>. 359N/A echo "$0: No file. Try \`$0 --help' for more information." 1>&
2 456N/A# Prevent date giving response in another language. 347N/A# GNU ls changes its time format in response to the TIME_STYLE 532N/A# variable. Since we cannot assume `unset' works, revert this 525N/A# variable to its documented default. 463N/Aif test "${TIME_STYLE+set}" =
set;
then 310N/A# Find out how to get the extended ls output of a file or directory. 509N/A# A `ls -l' line looks as follows on OS/2. 332N/A# drwxrwx--- 0 Aug 11 2001 foo 210N/A# This differs from Unix, which adds ownership information. 493N/A# drwxrwx--- 2 root root 4096 Aug 11 2001 foo 414N/A# To find the date, we split the line on spaces and iterate on words 484N/A# until we find a month. This cannot work with files whose owner is a 326N/A# user named `Jan', or `Feb', etc. However, it's unlikely that `/' 493N/A# will be owned by a user whose name is a month. So we first look at 335N/A# the extended ls output of the root directory to decide how many 493N/A# words should be skipped to get the date. 425N/A# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. 400N/A# Find which argument is the month. 277N/A # Add another shift to the command. 70N/A# Get the extended ls output of the file or directory. 455N/A# Remove all preceding arguments 332N/A# Because of the dummy argument above, month is in $2. 493N/A# On a POSIX system, we should have 98N/A# On Darwin 7.7.0 and 7.6.0, we have # Here we have to deal with the problem that the ls output gives either # the time of day or the year. # For the first six month of the year the time notation can also # be used for files modified in the last year. # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H"