annotate src/fftw-3.3.8/doc/mdate-sh @ 82:d0c2a83c1364

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