~x2go/x2go/pinentry-x2go_master

« back to all changes in this revision

Viewing changes to doc/mdate-sh

  • Committer: Mike Gabriel
  • Date: 2012-06-13 12:55:37 UTC
  • Revision ID: git-v1:d2060291d5cc7beb92f78168e48ececfe765d552
Strip code project down to its essentials, remove a lot of unneeded cruft. / Make code tree fully build with autotools, see README file for further info.

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
3
 
4
 
scriptversion=2003-11-09.00
 
4
scriptversion=2009-04-28.21; # UTC
5
5
 
6
 
# Copyright (C) 1995, 1996, 1997, 2003  Free Software Foundation, Inc.
 
6
# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009 Free
 
7
# Software Foundation, Inc.
7
8
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
8
9
#
9
10
# This program is free software; you can redistribute it and/or modify
17
18
# GNU General Public License for more details.
18
19
#
19
20
# You should have received a copy of the GNU General Public License
20
 
# along with this program; if not, write to the Free Software Foundation,
21
 
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
21
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
22
 
23
23
# As a special exception to the GNU General Public License, if you
24
24
# distribute this file as part of a program that contains a
42
42
 
43
43
Report bugs to <bug-automake@gnu.org>.
44
44
EOF
45
 
    exit 0
 
45
    exit $?
46
46
    ;;
47
47
  -v | --v*)
48
48
    echo "mdate-sh $scriptversion"
49
 
    exit 0
 
49
    exit $?
50
50
    ;;
51
51
esac
52
52
 
58
58
LC_TIME=C
59
59
export LC_TIME
60
60
 
61
 
save_arg1="$1"
 
61
# GNU ls changes its time format in response to the TIME_STYLE
 
62
# variable.  Since we cannot assume `unset' works, revert this
 
63
# variable to its documented default.
 
64
if test "${TIME_STYLE+set}" = set; then
 
65
  TIME_STYLE=posix-long-iso
 
66
  export TIME_STYLE
 
67
fi
 
68
 
 
69
save_arg1=$1
62
70
 
63
71
# Find out how to get the extended ls output of a file or directory.
64
72
if ls -L /dev/null 1>/dev/null 2>&1; then
66
74
else
67
75
  ls_command='ls -l -d'
68
76
fi
 
77
# Avoid user/group names that might have spaces, when possible.
 
78
if ls -n /dev/null 1>/dev/null 2>&1; then
 
79
  ls_command="$ls_command -n"
 
80
fi
69
81
 
70
82
# A `ls -l' line looks as follows on OS/2.
71
83
#  drwxrwx---        0 Aug 11  2001 foo
80
92
# words should be skipped to get the date.
81
93
 
82
94
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
83
 
set - x`$ls_command /`
 
95
set x`$ls_command /`
84
96
 
85
97
# Find which argument is the month.
86
98
month=
107
119
done
108
120
 
109
121
# Get the extended ls output of the file or directory.
110
 
set - x`eval "$ls_command \"\$save_arg1\""`
 
122
set dummy x`eval "$ls_command \"\$save_arg1\""`
111
123
 
112
124
# Remove all preceding arguments
113
125
eval $command
114
126
 
115
 
# Get the month.  Next argument is day, followed by the year or time.
116
 
case $1 in
 
127
# Because of the dummy argument above, month is in $2.
 
128
#
 
129
# On a POSIX system, we should have
 
130
#
 
131
# $# = 5
 
132
# $1 = file size
 
133
# $2 = month
 
134
# $3 = day
 
135
# $4 = year or time
 
136
# $5 = filename
 
137
#
 
138
# On Darwin 7.7.0 and 7.6.0, we have
 
139
#
 
140
# $# = 4
 
141
# $1 = day
 
142
# $2 = month
 
143
# $3 = year or time
 
144
# $4 = filename
 
145
 
 
146
# Get the month.
 
147
case $2 in
117
148
  Jan) month=January; nummonth=1;;
118
149
  Feb) month=February; nummonth=2;;
119
150
  Mar) month=March; nummonth=3;;
128
159
  Dec) month=December; nummonth=12;;
129
160
esac
130
161
 
131
 
day=$2
 
162
case $3 in
 
163
  ???*) day=$1;;
 
164
  *) day=$3; shift;;
 
165
esac
132
166
 
133
167
# Here we have to deal with the problem that the ls output gives either
134
168
# the time of day or the year.
166
200
# eval: (add-hook 'write-file-hooks 'time-stamp)
167
201
# time-stamp-start: "scriptversion="
168
202
# time-stamp-format: "%:y-%02m-%02d.%02H"
169
 
# time-stamp-end: "$"
 
203
# time-stamp-time-zone: "UTC"
 
204
# time-stamp-end: "; # UTC"
170
205
# End: