annotate xrogue/init.c @ 310:827441d05b3e

Advanced Rogue family: fix some potential buffer overflows. Some code for determining the score file location assumed that PATH_MAX would be less than 1024, which cannot be guaranteed. Advanced Rogue 5 and 7, and XRogue, have had the buffers for the file name enlarged. UltraRogue never called the functions, so the code has been deleted instead.
author John "Elwin" Edwards
date Mon, 03 May 2021 19:05:37 -0400
parents 32bc72dcbf4f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
2 init.c - global variable initializaton
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
3
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
4 XRogue: Expeditions into the Dungeons of Doom
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
5 Copyright (C) 1991 Robert Pietkivitch
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
6 All rights reserved.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
7
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
8 Based on "Advanced Rogue"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
9 Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
10 All rights reserved.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
11
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
12 Based on "Rogue: Exploring the Dungeons of Doom"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
13 Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
14 All rights reserved.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
15
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
16 See the file LICENSE.TXT for full copyright and licensing information.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
17 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
18
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
19 #include <curses.h>
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
20 #include <ctype.h>
135
ce0cf824c192 xrogue: add missing includes.
John "Elwin" Edwards
parents: 133
diff changeset
21 #include <string.h>
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
22 #include "rogue.h"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
23 #include "mach_dep.h"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
24
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
25 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
26 * If there is any news, put it in a character string and assign it to
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
27 * rogue_news. Otherwise, assign NULL to rogue_news.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
28 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
29
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
30 static char *rogue_news = "Enter a number within the minimum and maximum \
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
31 range. When satisfied with your choices, enter a 'y'. For help at any \
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
32 other time enter a '?' or a '='.";
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
33
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
34 /* replace the above line with this when descriptions are done */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
35 /* other time enter a '?' or a '='. For character and item descriptions \
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
36 enter a '\\' on any other screen.";
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
37 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
38
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
39 struct words rainbow[NCOLORS] = {
300
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
40 { "Amber" }, { "Aquamarine" }, { "Beige" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
41 { "Black" }, { "Blue" }, { "Brown" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
42 { "Clear" }, { "Crimson" }, { "Ecru" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
43 { "Gold" }, { "Green" }, { "Grey" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
44 { "Indigo" }, { "Khaki" }, { "Lavender" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
45 { "Magenta" }, { "Orange" }, { "Pink" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
46 { "Plaid" }, { "Purple" }, { "Red" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
47 { "Silver" }, { "Saffron" }, { "Scarlet" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
48 { "Tan" }, { "Tangerine" }, { "Topaz" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
49 { "Turquoise" }, { "Vermilion" }, { "Violet" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
50 { "White" }, { "Yellow" }
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
51 };
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
52
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
53 struct words sylls[NSYLLS] = {
300
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
54 {"a"}, {"ae"}, {"ak"}, {"an"}, {"ax"}, {"ach"}, {"ano"}, {"ars"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
55 {"bha"}, {"bar"}, {"bre"}, {"cha"}, {"cre"}, {"cum"}, {"cow"}, {"duh"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
56 {"dha"}, {"e"}, {"ea"}, {"em"}, {"et"}, {"ey"}, {"eck"}, {"etk"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
57 {"egg"}, {"exl"}, {"fu"}, {"fen"}, {"fid"}, {"gan"}, {"gle"}, {"h"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
58 {"ha"}, {"hr"}, {"ht"}, {"how"}, {"hex"}, {"hip"}, {"hoc"}, {"i"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
59 {"ia"}, {"ig"}, {"it"}, {"iz"}, {"ion"}, {"ink"}, {"ivi"}, {"iss"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
60 {"je"}, {"jin"}, {"jha"}, {"jyr"}, {"ka"}, {"kho"}, {"kal"}, {"kli"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
61 {"lu"}, {"lre"}, {"lta"}, {"lri"}, {"m"}, {"ma"}, {"mh"}, {"mi"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
62 {"mr"}, {"mar"}, {"myr"}, {"moh"}, {"mul"}, {"nep"}, {"nes"}, {"o"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
63 {"oc"}, {"om"}, {"oq"}, {"ox"}, {"orn"}, {"oxy"}, {"olm"}, {"ode"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
64 {"po"}, {"pie"}, {"pod"}, {"pot"}, {"qar"}, {"que"}, {"ran"}, {"rah"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
65 {"rok"}, {"sa"}, {"sat"}, {"sha"}, {"sol"}, {"sri"}, {"ti"}, {"tem"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
66 {"tar"}, {"tki"}, {"tch"}, {"tox"}, {"u"}, {"ub"}, {"uh"}, {"ur"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
67 {"uv"}, {"unk"}, {"uwh"}, {"ugh"}, {"uyr"}, {"va"}, {"vil"}, {"vit"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
68 {"vom"}, {"vux"}, {"wah"}, {"wex"}, {"xu"}, {"xed"}, {"xen"}, {"ya"},
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
69 {"yep"}, {"yih"}, {"zef"}, {"zen"}, {"zil"}, {"zym"}, {"-"}
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
70 };
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
71
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
72 struct words stones[NSTONES] = {
300
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
73 { "Agate" }, { "Alexandrite" }, { "Amethyst" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
74 { "Azurite" }, { "Bloodstone" }, { "Cairngorm" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
75 { "Carnelian" }, { "Chalcedony" }, { "Chrysoberyl" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
76 { "Chrysolite" }, { "Chrysoprase" }, { "Citrine" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
77 { "Coral" }, { "Diamond" }, { "Emerald" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
78 { "Garnet" }, { "Heliotrope" }, { "Hematite" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
79 { "Hyacinth" }, { "Jacinth" }, { "Jade" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
80 { "Jargoon" }, { "Jasper" }, { "Kryptonite" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
81 { "Lapis lazuli" }, { "Malachite" }, { "Mocca stone" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
82 { "Moonstone" }, { "Obsidian" }, { "Olivine" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
83 { "Onyx" }, { "Opal" }, { "Pearl" },
0250220d8cdd Fix an assortment of compiler warnings.
John "Elwin" Edwards
parents: 220
diff changeset
84 { "Peridot" }, { "Quartz" }, { "Rhodochrosite" },