annotate src/fftw-3.3.3/doc/mdate-sh @ 10:37bf6b4a2645

Add FFTW3
author Chris Cannam
date Wed, 20 Mar 2013 15:35:50 +0000
parents
children
rev   line source
Chris@10 1 #!/bin/sh
Chris@10 2 # Get modification time of a file or directory and pretty-print it.
Chris@10 3
Chris@10 4 scriptversion=2010-08-21.06; # UTC
Chris@10 5
Chris@10 6 # Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009, 2010
Chris@10 7 # Free Software Foundation, Inc.
Chris@10 8 # written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
Chris@10 9 #
Chris@10 10 # This program is free software; you can redistribute it and/or modify
Chris@10 11 # it under the terms of the GNU General Public License as published by
Chris@10 12 # the Free Software Foundation; either version 2, or (at your option)
Chris@10 13 # any later version.
Chris@10 14 #
Chris@10 15 # This program is distributed in the hope that it will be useful,
Chris@10 16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@10 17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@10 18 # GNU General Public License for more details.
Chris@10 19 #
Chris@10 20 # You should have received a copy of the GNU General Public License
Chris@10 21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
Chris@10 22
Chris@10 23 # As a special exception to the GNU General Public License, if you
Chris@10 24 # distribute this file as part of a program that contains a
Chris@10 25 # configuration script generated by Autoconf, you may include it under
Chris@10 26 # the same distribution terms that you use for the rest of that program.
Chris@10 27
Chris@10 28 # This file is maintained in Automake, please report
Chris@10 29 # bugs to <bug-automake@gnu.org> or send patches to
Chris@10 30 # <automake-patches@gnu.org>.
Chris@10 31
Chris@10 32 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
Chris@10 33 emulate sh
Chris@10 34 NULLCMD=:
Chris@10 35 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
Chris@10 36 # is contrary to our usage. Disable this feature.
Chris@10 37 alias -g '${1+"$@"}'='"$@"'
Chris@10 38 setopt NO_GLOB_SUBST
Chris@10 39 fi
Chris@10 40
Chris@10 41 case $1 in
Chris@10 42 '')
Chris@10 43 echo "$0: No file. Try \`$0 --help' for more information." 1>&2
Chris@10 44 exit 1;
Chris@10 45 ;;
Chris@10 46 -h | --h*)
Chris@10 47 cat <<\EOF
Chris@10 48 Usage: mdate-sh [--help] [--version] FILE
Chris@10 49
Chris@10 50 Pretty-print the modification day of FILE, in the format:
Chris@10 51 1 January 1970
Chris@10 52
Chris@10 53 Report bugs to <bug-automake@gnu.org>.
Chris@10 54 EOF
Chris@10 55 exit $?
Chris@10 56 ;;
Chris@10 57 -v | --v*)
Chris@10 58 echo "mdate-sh $scriptversion"
Chris@10 59 exit $?
Chris@10 60 ;;
Chris@10 61 esac
Chris@10 62
Chris@10 63 error ()
Chris@10 64 {
Chris@10 65 echo "$0: $1" >&2
Chris@10 66 exit 1
Chris@10 67 }
Chris@10 68
Chris@10 69
Chris@10 70 # Prevent date giving response in another language.
Chris@10 71 LANG=C
Chris@10 72 export LANG
Chris@10 73 LC_ALL=C
Chris@10 74 export LC_ALL
Chris@10 75 LC_TIME=C
Chris@10 76 export LC_TIME
Chris@10 77
Chris@10 78 # GNU ls changes its time format in response to the TIME_STYLE
Chris@10 79 # variable. Since we cannot assume `unset' works, revert this
Chris@10 80 # variable to its documented default.
Chris@10 81 if test "${TIME_STYLE+set}" = set; then
Chris@10 82 TIME_STYLE=posix-long-iso
Chris@10 83 export TIME_STYLE
Chris@10 84 fi
Chris@10 85
Chris@10 86 save_arg1=$1
Chris@10 87
Chris@10 88 # Find out how to get the extended ls output of a file or directory.
Chris@10 89 if ls -L /dev/null 1>/dev/null 2>&1; then
Chris@10 90 ls_command='ls -L -l -d'
Chris@10 91 else
Chris@10 92 ls_command='ls -l -d'
Chris@10 93 fi
Chris@10 94 # Avoid user/group names that might have spaces, when possible.
Chris@10 95 if ls -n /dev/null 1>/dev/null 2>&1; then
Chris@10 96 ls_command="$ls_command -n"
Chris@10 97 fi
Chris@10 98
Chris@10 99 # A `ls -l' line looks as follows on OS/2.
Chris@10 100 # drwxrwx--- 0 Aug 11 2001 foo
Chris@10 101 # This differs from Unix, which adds ownership information.
Chris@10 102 # drwxrwx--- 2 root root 4096 Aug 11 2001 foo
Chris@10 103 #
Chris@10 104 # To find the date, we split the line on spaces and iterate on words
Chris@10 105 # until we find a month. This cannot work with files whose owner is a
Chris@10 106 # user named `Jan', or `Feb', etc. However, it's unlikely that `/'
Chris@10 107 # will be owned by a user whose name is a month. So we first look at
Chris@10 108 # the extended ls output of the root directory to decide how many
Chris@10 109 # words should be skipped to get the date.
Chris@10 110
Chris@10 111 # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
Chris@10 112 set x`$ls_command /`
Chris@10 113
Chris@10 114 # Find which argument is the month.
Chris@10 115 month=
Chris@10 116 command=
Chris@10 117 until test $month
Chris@10 118 do
Chris@10 119 test $# -gt 0 || error "failed parsing \`$ls_command /' output"
Chris@10 120 shift
Chris@10 121 # Add another shift to the command.
Chris@10 122 command="$command shift;"
Chris@10 123 case $1 in
Chris@10 124 Jan) month=January; nummonth=1;;
Chris@10 125 Feb) month=February; nummonth=2;;
Chris@10 126 Mar) month=March; nummonth=3;;
Chris@10 127 Apr) month=April; nummonth=4;;
Chris@10 128 May) month=May; nummonth=5;;
Chris@10 129 Jun) month=June; nummonth=6;;
Chris@10 130 Jul) month=July; nummonth=7;;
Chris@10 131 Aug) month=August; nummonth=8;;
Chris@10 132 Sep) month=September; nummonth=9;;
Chris@10 133 Oct) month=October; nummonth=10;;
Chris@10 134 Nov) month=November; nummonth=11;;
Chris@10 135 Dec) month=December; nummonth=12;;
Chris@10 136 esac
Chris@10 137 done
Chris@10 138
Chris@10 139 test -n "$month" || error "failed parsing \`$ls_command /' output"
Chris@10 140
Chris@10 141 # Get the extended ls output of the file or directory.
Chris@10 142 set dummy x`eval "$ls_command \"\\\$save_arg1\""`
Chris@10 143
Chris@10 144 # Remove all preceding arguments
Chris@10 145 eval $command
Chris@10 146
Chris@10 147 # Because of the dummy argument above, month is in $2.
Chris@10 148 #
Chris@10 149 # On a POSIX system, we should have
Chris@10 150 #
Chris@10 151 # $# = 5
Chris@10 152 # $1 = file size
Chris@10 153 # $2 = month
Chris@10 154 # $3 = day
Chris@10 155 # $4 = year or time
Chris@10 156 # $5 = filename
Chris@10 157 #
Chris@10 158 # On Darwin 7.7.0 and 7.6.0, we have
Chris@10 159 #
Chris@10 160 # $# = 4
Chris@10 161 # $1 = day
Chris@10 162 # $2 = month
Chris@10 163 # $3 = year or time
Chris@10 164 # $4 = filename
Chris@10 165
Chris@10 166 # Get the month.
Chris@10 167 case $2 in
Chris@10 168 Jan) month=January; nummonth=1;;
Chris@10 169 Feb) month=February; nummonth=2;;
Chris@10 170 Mar) month=March; nummonth=3;;
Chris@10 171 Apr) month=April; nummonth=4;;
Chris@10 172 May) month=May; nummonth=5;;
Chris@10 173 Jun) month=June; nummonth=6;;
Chris@10 174 Jul) month=July; nummonth=7;;
Chris@10 175 Aug) month=August; nummonth=8;;
Chris@10 176 Sep) month=September; nummonth=9;;
Chris@10 177 Oct) month=October; nummonth=10;;
Chris@10 178 Nov) month=November; nummonth=11;;
Chris@10 179 Dec) month=December; nummonth=12;;
Chris@10 180 esac
Chris@10 181
Chris@10 182 case $3 in
Chris@10 183 ???*) day=$1;;
Chris@10 184 *) day=$3; shift;;
Chris@10 185 esac
Chris@10 186
Chris@10 187 # Here we have to deal with the problem that the ls output gives either
Chris@10 188 # the time of day or the year.
Chris@10 189 case $3 in
Chris@10 190 *:*) set `date`; eval year=\$$#
Chris@10 191 case $2 in
Chris@10 192 Jan) nummonthtod=1;;
Chris@10 193 Feb) nummonthtod=2;;
Chris@10 194 Mar) nummonthtod=3;;
Chris@10 195 Apr) nummonthtod=4;;
Chris@10 196 May) nummonthtod=5;;
Chris@10 197 Jun) nummonthtod=6;;
Chris@10 198 Jul) nummonthtod=7;;
Chris@10 199 Aug) nummonthtod=8;;
Chris@10 200 Sep) nummonthtod=9;;
Chris@10 201 Oct) nummonthtod=10;;
Chris@10 202 Nov) nummonthtod=11;;
Chris@10 203 Dec) nummonthtod=12;;
Chris@10 204 esac
Chris@10 205 # For the first six month of the year the time notation can also
Chris@10 206 # be used for files modified in the last year.
Chris@10 207 if (expr $nummonth \> $nummonthtod) > /dev/null;
Chris@10 208 then
Chris@10 209 year=`expr $year - 1`
Chris@10 210 fi;;
Chris@10 211 *) year=$3;;
Chris@10 212 esac
Chris@10 213
Chris@10 214 # The result.
Chris@10 215 echo $day $month $year
Chris@10 216
Chris@10 217 # Local Variables:
Chris@10 218 # mode: shell-script
Chris@10 219 # sh-indentation: 2
Chris@10 220 # eval: (add-hook 'write-file-hooks 'time-stamp)
Chris@10 221 # time-stamp-start: "scriptversion="
Chris@10 222 # time-stamp-format: "%:y-%02m-%02d.%02H"
Chris@10 223 # time-stamp-time-zone: "UTC"
Chris@10 224 # time-stamp-end: "; # UTC"
Chris@10 225 # End: