annotate install-sh @ 296:000b1c5b8d63

UltraRogue: fix inventory collision after save and restore. Inventory letters are based on "identifiers" stored in objects' o_ident field. Identifiers are allocated by get_ident(), which keeps a list of objects that have them, to avoid giving the same identifier to multiple objects. The list is not stored in the savefile, so after restore, get_ident() was not aware of existing identifiers. This resulted in picked-up objects having the same inventory letters as objects restored from the file. The restore code now adds all objects with identifiers to the list.
author John "Elwin" Edwards
date Mon, 15 Jan 2018 20:20:35 -0500
parents d9badb9c0179
children 029c1f5c5588
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
1 #!/bin/sh
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
2 # install - install a program, script, or datafile
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
3
253
d9badb9c0179 Update the fallback install script.
John "Elwin" Edwards
parents: 161
diff changeset
4 scriptversion=2013-12-25.23; # UTC
88
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
5
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
6 # This originates from X11R5 (mit/util/scripts/install.sh), which was
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
7 # later released in X11R6 (xc/config/util/install.sh) with the
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
8 # following copyright and license.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
9 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
10 # Copyright (C) 1994 X Consortium
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
11 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
12 # Permission is hereby granted, free of charge, to any person obtaining a copy
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
13 # of this software and associated documentation files (the "Software"), to
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
14 # deal in the Software without restriction, including without limitation the
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
15 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
16 # sell copies of the Software, and to permit persons to whom the Software is
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
17 # furnished to do so, subject to the following conditions:
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
18 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
19 # The above copyright notice and this permission notice shall be included in
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
20 # all copies or substantial portions of the Software.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
21 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
23 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
24 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
25 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
26 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
27 # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
28 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
29 # Except as contained in this notice, the name of the X Consortium shall not
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
30 # be used in advertising or otherwise to promote the sale, use or other deal-
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
31 # ings in this Software without prior written authorization from the X Consor-
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
32 # tium.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
33 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
34 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
35 # FSF changes to this file are in the public domain.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
36 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
37 # Calling this script install-sh is preferred over install.sh, to prevent
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
38 # 'make' implicit rules from creating a file called install from it
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
39 # when there is no Makefile.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
40 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
41 # This script is compatible with the BSD install script, but was written
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
42 # from scratch.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
43
253
d9badb9c0179 Update the fallback install script.
John "Elwin" Edwards
parents: 161
diff changeset
44 tab=' '
88
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
45 nl='
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
46 '
253
d9badb9c0179 Update the fallback install script.
John "Elwin" Edwards
parents: 161
diff changeset
47 IFS=" $tab$nl"
88
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
48
253
d9badb9c0179 Update the fallback install script.
John "Elwin" Edwards
parents: 161
diff changeset
49 # Set DOITPROG to "echo" to test this script.
88
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
50
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
51 doit=${DOITPROG-}
253
d9badb9c0179 Update the fallback install script.
John "Elwin" Edwards
parents: 161
diff changeset
52 doit_exec=${doit:-exec}
88
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
53
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
54 # Put in absolute file names if you don't have them in your path;
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
55 # or use environment vars.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
56
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
57 chgrpprog=${CHGRPPROG-chgrp}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
58 chmodprog=${CHMODPROG-chmod}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
59 chownprog=${CHOWNPROG-chown}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
60 cmpprog=${CMPPROG-cmp}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
61 cpprog=${CPPROG-cp}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
62 mkdirprog=${MKDIRPROG-mkdir}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
63 mvprog=${MVPROG-mv}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
64 rmprog=${RMPROG-rm}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
65 stripprog=${STRIPPROG-strip}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
66
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
67 posix_mkdir=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
68
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
69 # Desired mode of installed file.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
70 mode=0755
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
71
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
72 chgrpcmd=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
73 chmodcmd=$chmodprog
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
74 chowncmd=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
75 mvcmd=$mvprog
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
76 rmcmd="$rmprog -f"
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
77 stripcmd=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
78
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
79 src=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
80 dst=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
81 dir_arg=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
82 dst_arg=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
83
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
84 copy_on_change=false
253
d9badb9c0179 Update the fallback install script.
John "Elwin" Edwards
parents: 161
diff changeset
85 is_target_a_directory=possibly
88
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
86
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
87 usage="\
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
88 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
89 or: $0 [OPTION]... SRCFILES... DIRECTORY
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
90 or: $0 [OPTION]... -t DIRECTORY SRCFILES...
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
91 or: $0 [OPTION]... -d DIRECTORIES...
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
92
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
93 In the 1st form, copy SRCFILE to DSTFILE.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff