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