annotate src/fftw-3.3.5/doc/mdate-sh @ 169:223a55898ab9 tip default

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