annotate rogue4/install-sh @ 110:5f51f7d9805f

arogue5: fix some save/restore-related crashes. The save/restore code took the pointer intended as an argument for the doctor() daemon and wrote it to the savefile as an int. I don't know why it took so long to fail horribly. The problem has been avoided by replacing the value with &player when restoring. That seems to be the only argument ever actually used. The code also writes only four bytes for an unsigned long; if sizeof(long) == 8, it casts to unsigned int first. It failed to do the cast when reading back, with the result that four bytes were read and the other half of the number was effectively uninitialized. It apparently works now, but the save/restore code ought still to be regarded as decidedly unfortunate.
author John "Elwin" Edwards
date Mon, 06 Jan 2014 15:57:17 -0500
parents a1dc75e38e73
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
1 #!/bin/sh
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
2 # install - install a program, script, or datafile
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
3
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
4 scriptversion=2009-04-28.21; # UTC
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
5
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
6 # This originates from X11R5 (mit/util/scripts/install.sh), which was
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
7 # later released in X11R6 (xc/config/util/install.sh) with the
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
8 # following copyright and license.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
9 #
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
10 # Copyright (C) 1994 X Consortium
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
11 #
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
12 # Permission is hereby granted, free of charge, to any person obtaining a copy
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
13 # of this software and associated documentation files (the "Software"), to
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
14 # deal in the Software without restriction, including without limitation the
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
15 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
16 # sell copies of the Software, and to permit persons to whom the Software is
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
17 # furnished to do so, subject to the following conditions:
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
18 #
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
19 # The above copyright notice and this permission notice shall be included in
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
20 # all copies or substantial portions of the Software.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
21 #
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
23 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
24 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
25 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
26 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
27 # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
28 #
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
29 # Except as contained in this notice, the name of the X Consortium shall not
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
30 # be used in advertising or otherwise to promote the sale, use or other deal-
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
31 # ings in this Software without prior written authorization from the X Consor-
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
32 # tium.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
33 #
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
34 #
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
35 # FSF changes to this file are in the public domain.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
36 #
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
37 # Calling this script install-sh is preferred over install.sh, to prevent
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
38 # `make' implicit rules from creating a file called install from it
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
39 # when there is no Makefile.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
40 #
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
41 # This script is compatible with the BSD install script, but was written
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
42 # from scratch.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
43
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
44 nl='
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
45 '
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
46 IFS=" "" $nl"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
47
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
48 # set DOITPROG to echo to test this script
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
49
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
50 # Don't use :- since 4.3BSD and earlier shells don't like it.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
51 doit=${DOITPROG-}
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
52 if test -z "$doit"; then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
53 doit_exec=exec
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
54 else
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
55 doit_exec=$doit
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
56 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
57
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
58 # Put in absolute file names if you don't have them in your path;
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
59 # or use environment vars.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
60
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
61 chgrpprog=${CHGRPPROG-chgrp}
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
62 chmodprog=${CHMODPROG-chmod}
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
63 chownprog=${CHOWNPROG-chown}
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
64 cmpprog=${CMPPROG-cmp}
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
65 cpprog=${CPPROG-cp}
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
66 mkdirprog=${MKDIRPROG-mkdir}
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
67 mvprog=${MVPROG-mv}
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
68 rmprog=${RMPROG-rm}
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
69 stripprog=${STRIPPROG-strip}
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
70
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
71 posix_glob='?'
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
72 initialize_posix_glob='
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
73 test "$posix_glob" != "?" || {
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
74 if (set -f) 2>/dev/null; then
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
75 posix_glob=
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
76 else
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
77 posix_glob=:
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
78 fi
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
79 }
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
80 '
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
81
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
82 posix_mkdir=
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
83
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
84 # Desired mode of installed file.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
85 mode=0755
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
86
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
87 chgrpcmd=
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
88 chmodcmd=$chmodprog
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
89 chowncmd=
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
90 mvcmd=$mvprog
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
91 rmcmd="$rmprog -f"
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
92 stripcmd=
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
93
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
94 src=
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
95 dst=
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
96 dir_arg=
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
97 dst_arg=
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
98
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
99 copy_on_change=false
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
100 no_target_directory=
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
101
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
102 usage="\
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
103 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
104 or: $0 [OPTION]... SRCFILES... DIRECTORY
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
105 or: $0 [OPTION]... -t DIRECTORY SRCFILES...
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
106 or: $0 [OPTION]... -d DIRECTORIES...
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
107
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
108 In the 1st form, copy SRCFILE to DSTFILE.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
109 In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
110 In the 4th, create DIRECTORIES.
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
111
a1dc75e38e73 rogue4: ported to autoconf.
elwin
parents:
diff changeset
112 Options: