~ubuntu-branches/ubuntu/trusty/fftw/trusty-proposed

« back to all changes in this revision

Viewing changes to doc/mdate-sh

  • Committer: Bazaar Package Importer
  • Author(s): Paul Brossier
  • Date: 2006-10-05 01:53:10 UTC
  • mfrom: (3.1.3 edgy)
  • Revision ID: james.westby@ubuntu.com-20061005015310-pja7cks0f3dg5rch
Tags: 2.1.3-20
Add working makefiles to fftw-docs (closes: #378550)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
# Get modification time of a file or directory and pretty-print it.
3
 
# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
 
3
 
 
4
scriptversion=2003-11-09.00
 
5
 
 
6
# Copyright (C) 1995, 1996, 1997, 2003  Free Software Foundation, Inc.
4
7
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
5
8
#
6
9
# This program is free software; you can redistribute it and/or modify
17
20
# along with this program; if not, write to the Free Software Foundation,
18
21
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
22
 
 
23
# As a special exception to the GNU General Public License, if you
 
24
# distribute this file as part of a program that contains a
 
25
# configuration script generated by Autoconf, you may include it under
 
26
# the same distribution terms that you use for the rest of that program.
 
27
 
 
28
# This file is maintained in Automake, please report
 
29
# bugs to <bug-automake@gnu.org> or send patches to
 
30
# <automake-patches@gnu.org>.
 
31
 
 
32
case $1 in
 
33
  '')
 
34
     echo "$0: No file.  Try \`$0 --help' for more information." 1>&2
 
35
     exit 1;
 
36
     ;;
 
37
  -h | --h*)
 
38
    cat <<\EOF
 
39
Usage: mdate-sh [--help] [--version] FILE
 
40
 
 
41
Pretty-print the modification time of FILE.
 
42
 
 
43
Report bugs to <bug-automake@gnu.org>.
 
44
EOF
 
45
    exit 0
 
46
    ;;
 
47
  -v | --v*)
 
48
    echo "mdate-sh $scriptversion"
 
49
    exit 0
 
50
    ;;
 
51
esac
 
52
 
20
53
# Prevent date giving response in another language.
21
54
LANG=C
22
55
export LANG
25
58
LC_TIME=C
26
59
export LC_TIME
27
60
 
28
 
# Get the extended ls output of the file or directory.
29
 
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
 
61
save_arg1="$1"
 
62
 
 
63
# Find out how to get the extended ls output of a file or directory.
30
64
if ls -L /dev/null 1>/dev/null 2>&1; then
31
 
  set - x`ls -L -l -d $1`
 
65
  ls_command='ls -L -l -d'
32
66
else
33
 
  set - x`ls -l -d $1`
 
67
  ls_command='ls -l -d'
34
68
fi
35
 
# The month is at least the fourth argument
36
 
# (3 shifts here, the next inside the loop).
37
 
shift
38
 
shift
39
 
shift
40
 
 
41
 
# Find the month.  Next argument is day, followed by the year or time.
 
69
 
 
70
# A `ls -l' line looks as follows on OS/2.
 
71
#  drwxrwx---        0 Aug 11  2001 foo
 
72
# This differs from Unix, which adds ownership information.
 
73
#  drwxrwx---   2 root  root      4096 Aug 11  2001 foo
 
74
#
 
75
# To find the date, we split the line on spaces and iterate on words
 
76
# until we find a month.  This cannot work with files whose owner is a
 
77
# user named `Jan', or `Feb', etc.  However, it's unlikely that `/'
 
78
# will be owned by a user whose name is a month.  So we first look at
 
79
# the extended ls output of the root directory to decide how many
 
80
# words should be skipped to get the date.
 
81
 
 
82
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
 
83
set - x`$ls_command /`
 
84
 
 
85
# Find which argument is the month.
42
86
month=
 
87
command=
43
88
until test $month
44
89
do
45
90
  shift
 
91
  # Add another shift to the command.
 
92
  command="$command shift;"
46
93
  case $1 in
47
94
    Jan) month=January; nummonth=1;;
48
95
    Feb) month=February; nummonth=2;;
59
106
  esac
60
107
done
61
108
 
 
109
# Get the extended ls output of the file or directory.
 
110
set - x`eval "$ls_command \"\$save_arg1\""`
 
111
 
 
112
# Remove all preceding arguments
 
113
eval $command
 
114
 
 
115
# Get the month.  Next argument is day, followed by the year or time.
 
116
case $1 in
 
117
  Jan) month=January; nummonth=1;;
 
118
  Feb) month=February; nummonth=2;;
 
119
  Mar) month=March; nummonth=3;;
 
120
  Apr) month=April; nummonth=4;;
 
121
  May) month=May; nummonth=5;;
 
122
  Jun) month=June; nummonth=6;;
 
123
  Jul) month=July; nummonth=7;;
 
124
  Aug) month=August; nummonth=8;;
 
125
  Sep) month=September; nummonth=9;;
 
126
  Oct) month=October; nummonth=10;;
 
127
  Nov) month=November; nummonth=11;;
 
128
  Dec) month=December; nummonth=12;;
 
129
esac
 
130
 
62
131
day=$2
63
132
 
64
133
# Here we have to deal with the problem that the ls output gives either
90
159
 
91
160
# The result.
92
161
echo $day $month $year
 
162
 
 
163
# Local Variables:
 
164
# mode: shell-script
 
165
# sh-indentation: 2
 
166
# eval: (add-hook 'write-file-hooks 'time-stamp)
 
167
# time-stamp-start: "scriptversion="
 
168
# time-stamp-format: "%:y-%02m-%02d.%02H"
 
169
# time-stamp-end: "$"
 
170
# End: