annotate arogue5/install-sh @ 111:7f8f43943b1f

Fix some terribly depressing corruption during restore. In rogue5/state.c, rs_read_daemons() zeroes out the argument and delay if the daemon slot is empty. Unfortunately that code ended up on the wrong side of the brace that closes the for loop, so instead of running after each daemon, it got run once after the loop exited, when the index was of course out of bounds. This tended to manifest, when compiled with -O2, by overwriting hw and setting it to NULL. When inventory() next ran, hw would be passed to wgetch(), which returns ERR when it gets a NULL argument. This made md_readchar() think something was wrong and autosave the game. Upon investigation, rogue3 was found to commit the same mistake. rogue4 and srogue don't zero the data. arogue5 already does it properly. Someday I am going to run all this through Valgrind. Someday when I am a kinder person who will not be driven to invoke hordes of trolls and centaurs upon the original authors.
author John "Elwin" Edwards
date Wed, 08 Jan 2014 16:44:16 -0500
parents dfeed24bb616
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
99
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
1 #!/bin/sh
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
2 # install - install a program, script, or datafile
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
3
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
4 scriptversion=2011-11-20.07; # UTC
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
5
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
6 # This originates from X11R5 (mit/util/scripts/install.sh), which was
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
7 # later released in X11R6 (xc/config/util/install.sh) with the
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
8 # following copyright and license.
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
9 #
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
10 # Copyright (C) 1994 X Consortium
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
11 #
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
12 # Permission is hereby granted, free of charge, to any person obtaining a copy
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
13 # of this software and associated documentation files (the "Software"), to
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
14 # deal in the Software without restriction, including without limitation the
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
15 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
16 # sell copies of the Software, and to permit persons to whom the Software is
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
17 # furnished to do so, subject to the following conditions:
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
18 #
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
19 # The above copyright notice and this permission notice shall be included in
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
20 # all copies or substantial portions of the Software.
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
21 #
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
23 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
24 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
25 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
26 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
27 # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
28 #
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
29 # Except as contained in this notice, the name of the X Consortium shall not
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
30 # be used in advertising or otherwise to promote the sale, use or other deal-
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
31 # ings in this Software without prior written authorization from the X Consor-
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
32 # tium.
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
33 #
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
34 #
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
35 # FSF changes to this file are in the public domain.
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
36 #
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
37 # Calling this script install-sh is preferred over install.sh, to prevent
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
38 # 'make' implicit rules from creating a file called install from it
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
39 # when there is no Makefile.
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
40 #
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
41 # This script is compatible with the BSD install script, but was written
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
42 # from scratch.
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
43
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
44 nl='
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
45 '
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
46 IFS=" "" $nl"
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
47
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
48 # set DOITPROG to echo to test this script
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
49
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
50 # Don't use :- since 4.3BSD and earlier shells don't like it.
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
51 doit=${DOITPROG-}
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
52 if test -z "$doit"; then
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
53 doit_exec=exec
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
54 else
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
55 doit_exec=$doit
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
56 fi
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
57
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
58 # Put in absolute file names if you don't have them in your path;
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
59 # or use environment vars.
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
60
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
61 chgrpprog=${CHGRPPROG-chgrp}
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
62 chmodprog=${CHMODPROG-chmod}
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
63 chownprog=${CHOWNPROG-chown}
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
64 cmpprog=${CMPPROG-cmp}
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
65 cpprog=${CPPROG-cp}
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
66 mkdirprog=${MKDIRPROG-mkdir}
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
67 mvprog=${MVPROG-mv}
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
68 rmprog=${RMPROG-rm}
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
69 stripprog=${STRIPPROG-strip}
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
70
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
71 posix_glob='?'
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
72 initialize_posix_glob='
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
73 test "$posix_glob" != "?" || {
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
74 if (set -f) 2>/dev/null; then
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
75 posix_glob=
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
76 else
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
77 posix_glob=:
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
78 fi
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
79 }
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
80 '
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
81
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
82 posix_mkdir=
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
83
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
84 # Desired mode of installed file.
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
85 mode=0755
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
86
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
87 chgrpcmd=
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
88 chmodcmd=$chmodprog
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
89 chowncmd=
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
90 mvcmd=$mvprog
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
91 rmcmd="$rmprog -f"
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
92 stripcmd=
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
93
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
94 src=
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
95 dst=
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
96 dir_arg=
dfeed24bb616 arogue5: port to autoconf.
John "Elwin" Edwards
parents:
diff changeset
97 dst_arg=