~ubuntu-branches/ubuntu/vivid/gnupg2/vivid-proposed

« back to all changes in this revision

Viewing changes to scripts/mdate-sh

  • Committer: Package Import Robot
  • Author(s): Stéphane Graber
  • Date: 2013-05-24 18:27:04 UTC
  • mfrom: (18.1.2 ubuntu)
  • Revision ID: package-import@ubuntu.com-20130524182704-d9uwh9lrj91elnm6
* Resynchronize on Debian, remaining changes:
  - Add udev rules to give gpg access to some smartcard readers;
    Debian #543217.
    . debian/gnupg2.udev: udev rules to set ACLs on SCM smartcard readers.
  - Add upstart user job for gpg-agent.

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=2005-06-29.22
 
4
scriptversion=2010-08-21.06; # UTC
5
5
 
6
 
# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software
7
 
# Foundation, Inc.
 
6
# Copyright (C) 1995-2013 Free Software Foundation, Inc.
8
7
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
9
8
#
10
9
# This program is free software; you can redistribute it and/or modify
18
17
# GNU General Public License for more details.
19
18
#
20
19
# You should have received a copy of the GNU General Public License
21
 
# along with this program; if not, see <http://www.gnu.org/licenses/>.
 
20
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
 
22
22
# As a special exception to the GNU General Public License, if you
23
23
# distribute this file as part of a program that contains a
24
24
# configuration script generated by Autoconf, you may include it under
28
28
# bugs to <bug-automake@gnu.org> or send patches to
29
29
# <automake-patches@gnu.org>.
30
30
 
 
31
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
 
32
  emulate sh
 
33
  NULLCMD=:
 
34
  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
 
35
  # is contrary to our usage.  Disable this feature.
 
36
  alias -g '${1+"$@"}'='"$@"'
 
37
  setopt NO_GLOB_SUBST
 
38
fi
 
39
 
31
40
case $1 in
32
41
  '')
33
 
     echo "$0: No file.  Try \`$0 --help' for more information." 1>&2
 
42
     echo "$0: No file.  Try '$0 --help' for more information." 1>&2
34
43
     exit 1;
35
44
     ;;
36
45
  -h | --h*)
37
46
    cat <<\EOF
38
47
Usage: mdate-sh [--help] [--version] FILE
39
48
 
40
 
Pretty-print the modification time of FILE.
 
49
Pretty-print the modification day of FILE, in the format:
 
50
1 January 1970
41
51
 
42
52
Report bugs to <bug-automake@gnu.org>.
43
53
EOF
49
59
    ;;
50
60
esac
51
61
 
 
62
error ()
 
63
{
 
64
  echo "$0: $1" >&2
 
65
  exit 1
 
66
}
 
67
 
 
68
 
52
69
# Prevent date giving response in another language.
53
70
LANG=C
54
71
export LANG
58
75
export LC_TIME
59
76
 
60
77
# GNU ls changes its time format in response to the TIME_STYLE
61
 
# variable.  Since we cannot assume `unset' works, revert this
 
78
# variable.  Since we cannot assume 'unset' works, revert this
62
79
# variable to its documented default.
63
80
if test "${TIME_STYLE+set}" = set; then
64
81
  TIME_STYLE=posix-long-iso
73
90
else
74
91
  ls_command='ls -l -d'
75
92
fi
 
93
# Avoid user/group names that might have spaces, when possible.
 
94
if ls -n /dev/null 1>/dev/null 2>&1; then
 
95
  ls_command="$ls_command -n"
 
96
fi
76
97
 
77
 
# A `ls -l' line looks as follows on OS/2.
 
98
# A 'ls -l' line looks as follows on OS/2.
78
99
#  drwxrwx---        0 Aug 11  2001 foo
79
100
# This differs from Unix, which adds ownership information.
80
101
#  drwxrwx---   2 root  root      4096 Aug 11  2001 foo
81
102
#
82
103
# To find the date, we split the line on spaces and iterate on words
83
104
# until we find a month.  This cannot work with files whose owner is a
84
 
# user named `Jan', or `Feb', etc.  However, it's unlikely that `/'
 
105
# user named "Jan", or "Feb", etc.  However, it's unlikely that '/'
85
106
# will be owned by a user whose name is a month.  So we first look at
86
107
# the extended ls output of the root directory to decide how many
87
108
# words should be skipped to get the date.
88
109
 
89
110
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
90
 
set x`ls -l -d /`
 
111
set x`$ls_command /`
91
112
 
92
113
# Find which argument is the month.
93
114
month=
94
115
command=
95
116
until test $month
96
117
do
 
118
  test $# -gt 0 || error "failed parsing '$ls_command /' output"
97
119
  shift
98
120
  # Add another shift to the command.
99
121
  command="$command shift;"
113
135
  esac
114
136
done
115
137
 
 
138
test -n "$month" || error "failed parsing '$ls_command /' output"
 
139
 
116
140
# Get the extended ls output of the file or directory.
117
 
set dummy x`eval "$ls_command \"\$save_arg1\""`
 
141
set dummy x`eval "$ls_command \"\\\$save_arg1\""`
118
142
 
119
143
# Remove all preceding arguments
120
144
eval $command
195
219
# eval: (add-hook 'write-file-hooks 'time-stamp)
196
220
# time-stamp-start: "scriptversion="
197
221
# time-stamp-format: "%:y-%02m-%02d.%02H"
198
 
# time-stamp-end: "$"
 
222
# time-stamp-time-zone: "UTC"
 
223
# time-stamp-end: "; # UTC"
199
224
# End: