~ubuntu-branches/ubuntu/precise/pcb/precise

« back to all changes in this revision

Viewing changes to doc/mdate-sh

  • Committer: Bazaar Package Importer
  • Author(s): Hamish Moffatt
  • Date: 2005-02-20 13:14:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050220131400-pfz66g5vhx0azl8f
Tags: 1.99j+20050127-2
* Improved package description: (closes: #295405)
* Fixed dependency: tk84 -> tk8.4 (closes: #295404)
* Updated README.debian (closes: #269578)
* Applied patch to src/djopt.c to allow compilation with gcc-4.0
  (closes: #294319), thanks to Andreas Jochens for the patch.
* Prevent example files from being compressed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
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
 
6
#
 
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)
 
10
# any later version.
 
11
#
 
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.
 
16
#
 
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.
 
20
 
 
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.
 
25
 
 
26
# Prevent date giving response in another language.
 
27
LANG=C
 
28
export LANG
 
29
LC_ALL=C
 
30
export LC_ALL
 
31
LC_TIME=C
 
32
export LC_TIME
 
33
 
 
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`
 
38
else
 
39
  set - x`ls -l -d $1`
 
40
fi
 
41
# The month is at least the fourth argument
 
42
# (3 shifts here, the next inside the loop).
 
43
shift
 
44
shift
 
45
shift
 
46
 
 
47
# Find the month.  Next argument is day, followed by the year or time.
 
48
month=
 
49
until test $month
 
50
do
 
51
  shift
 
52
  case $1 in
 
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;;
 
65
  esac
 
66
done
 
67
 
 
68
day=$2
 
69
 
 
70
# Here we have to deal with the problem that the ls output gives either
 
71
# the time of day or the year.
 
72
case $3 in
 
73
  *:*) set `date`; eval year=\$$#
 
74
       case $2 in
 
75
         Jan) nummonthtod=1;;
 
76
         Feb) nummonthtod=2;;
 
77
         Mar) nummonthtod=3;;
 
78
         Apr) nummonthtod=4;;
 
79
         May) nummonthtod=5;;
 
80
         Jun) nummonthtod=6;;
 
81
         Jul) nummonthtod=7;;
 
82
         Aug) nummonthtod=8;;
 
83
         Sep) nummonthtod=9;;
 
84
         Oct) nummonthtod=10;;
 
85
         Nov) nummonthtod=11;;
 
86
         Dec) nummonthtod=12;;
 
87
       esac
 
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;
 
91
       then
 
92
         year=`expr $year - 1`
 
93
       fi;;
 
94
  *) year=$3;;
 
95
esac
 
96
 
 
97
# The result.
 
98
echo $day $month $year