Mercurial > hg > early-roguelike
annotate rogue4/mdport.c @ 215:1b73a8641b37
rogue4: fix most GCC5 warnings.
Converting all function definitions to ANSI style accounts for most of
the change. This has exposed other problems, such as daemons not
actually being their stated type, that will require more careful
solutions.
author | John "Elwin" Edwards |
---|---|
date | Wed, 27 Jan 2016 19:41:05 -0500 |
parents | d53b13637783 |
children | b24545357d2e |
rev | line source |
---|---|
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1 /* |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
2 mdport.c - Machine Dependent |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
3 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
4 Copyright (C) 2005-2008 Nicholas J. Kisseberth |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
5 All rights reserved. |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
6 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
7 Redistribution and use in source and binary forms, with or without |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
8 modification, are permitted provided that the following conditions |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
9 are met: |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
10 1. Redistributions of source code must retain the above copyright |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
11 notice, this list of conditions and the following disclaimer. |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
12 2. Redistributions in binary form must reproduce the above copyright |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
13 notice, this list of conditions and the following disclaimer in the |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
14 documentation and/or other materials provided with the distribution. |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
15 3. Neither the name(s) of the author(s) nor the names of other contributors |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
16 may be used to endorse or promote products derived from this software |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
17 without specific prior written permission. |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
18 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
19 THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
22 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
25 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
26 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
27 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
28 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
29 SUCH DAMAGE. |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
30 */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
31 |
122 | 32 #ifdef HAVE_CONFIG_H |
33 #include "config.h" | |
34 #endif | |
35 | |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
36 #if defined(_WIN32) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
37 #include <Windows.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
38 #include <Lmcons.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
39 #include <shlobj.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
40 #include <sys/types.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
41 #include <io.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
42 #include <conio.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
43 #undef MOUSE_MOVED |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
44 #elif defined(__DJGPP__) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
45 #include <process.h> |
122 | 46 #endif |
47 | |
48 #ifdef HAVE_PWD_H | |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
49 #include <pwd.h> |
122 | 50 #endif |
51 #ifdef HAVE_UNISTD_H | |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
52 #include <unistd.h> |
122 | 53 #endif |
54 #ifdef HAVE_UTMPX_H | |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
55 #include <utmpx.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
56 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
57 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
58 #ifdef __INTERIX |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
59 char *strdup(const char *s); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
60 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
61 |
215 | 62 #include <ctype.h> |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
63 #include <stdlib.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
64 #include <string.h> |
23 | 65 #include <errno.h> |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
66 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
67 #if defined(_WIN32) && !defined(__MINGW32__) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
68 #define PATH_MAX MAX_PATH |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
69 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
70 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
71 #include <curses.h> |
122 | 72 #ifdef HAVE_TERM_H |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
73 #include <term.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
74 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
75 |
181 | 76 #if defined(_WIN32) |
77 #include <process.h> | |
78 #endif | |
79 | |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
80 #include <stdio.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
81 #include <fcntl.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
82 #include <limits.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
83 #include <sys/stat.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
84 #include <signal.h> |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
85 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
86 #define MOD_MOVE(c) (toupper(c) ) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
87 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
88 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
89 md_init() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
90 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
91 #ifdef __INTERIX |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
92 char *term; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
93 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
94 term = getenv("TERM"); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
95 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
96 if (term == NULL) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
97 setenv("TERM","interix",1); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
98 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
99 #if defined(__DJGPP__) || defined(_WIN32) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
100 _fmode = _O_BINARY; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
101 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
102 #if defined(__CYGWIN__) || defined(__MSYS__) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
103 ESCDELAY=250; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
104 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
105 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
106 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
107 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
108 md_hasclreol() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
109 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
110 #ifdef CE |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
111 return((CE != NULL) && (*CE != 0)); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
112 #elif defined (clr_eol) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
113 return((clr_eol != NULL) && (*clr_eol != 0)); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
114 #elif !defined(__PDCURSES__) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
115 return(clr_eol != NULL); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
116 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
117 return(TRUE); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
118 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
119 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
120 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
121 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
122 md_putchar(int c) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
123 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
124 putchar(c); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
125 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
126 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
127 static int md_standout_mode = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
128 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
129 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
130 md_raw_standout() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
131 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
132 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
133 CONSOLE_SCREEN_BUFFER_INFO csbiInfo; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
134 HANDLE hStdout; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
135 int fgattr,bgattr; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
136 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
137 if (md_standout_mode == 0) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
138 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
139 hStdout = GetStdHandle(STD_OUTPUT_HANDLE); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
140 GetConsoleScreenBufferInfo(hStdout, &csbiInfo); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
141 fgattr = (csbiInfo.wAttributes & 0xF); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
142 bgattr = (csbiInfo.wAttributes & 0xF0); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
143 SetConsoleTextAttribute(hStdout,(fgattr << 4) | (bgattr >> 4)); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
144 md_standout_mode = 1; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
145 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
146 #elif defined(SO) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
147 tputs(SO,0,md_putchar); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
148 fflush(stdout); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
149 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
150 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
151 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
152 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
153 md_raw_standend() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
154 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
155 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
156 CONSOLE_SCREEN_BUFFER_INFO csbiInfo; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
157 HANDLE hStdout; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
158 int fgattr,bgattr; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
159 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
160 if (md_standout_mode == 1) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
161 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
162 hStdout = GetStdHandle(STD_OUTPUT_HANDLE); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
163 GetConsoleScreenBufferInfo(hStdout, &csbiInfo); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
164 fgattr = (csbiInfo.wAttributes & 0xF); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
165 bgattr = (csbiInfo.wAttributes & 0xF0); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
166 SetConsoleTextAttribute(hStdout,(fgattr << 4) | (bgattr >> 4)); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
167 md_standout_mode = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
168 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
169 #elif defined(SE) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
170 tputs(SE,0,md_putchar); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
171 fflush(stdout); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
172 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
173 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
174 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
175 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
176 md_unlink_open_file(char *file, int inf) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
177 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
178 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
179 _close(inf); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
180 _chmod(file, 0600); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
181 return( _unlink(file) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
182 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
183 return(unlink(file)); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
184 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
185 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
186 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
187 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
188 md_unlink(char *file) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
189 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
190 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
191 _chmod(file, 0600); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
192 return( _unlink(file) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
193 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
194 return(unlink(file)); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
195 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
196 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
197 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
198 FILE * |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
199 md_fdopen(int fd, char *mode) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
200 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
201 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
202 return( _fdopen(fd, mode) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
203 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
204 return( fdopen(fd, mode) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
205 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
206 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
207 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
208 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
209 md_fileno(FILE *fp) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
210 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
211 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
212 return( _fileno(fp) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
213 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
214 return( fileno(fp) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
215 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
216 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
217 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
218 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
219 md_creat(char *file, int mode) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
220 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
221 int fd; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
222 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
223 mode = _S_IREAD | _S_IWRITE; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
224 fd = _open(file,O_CREAT | O_EXCL | O_WRONLY, mode); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
225 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
226 fd = open(file,O_CREAT | O_EXCL | O_WRONLY, mode); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
227 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
228 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
229 return(fd); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
230 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
231 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
232 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
233 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
234 md_normaluser() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
235 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
236 #ifndef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
237 setuid(getuid()); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
238 setgid(getgid()); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
239 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
240 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
241 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
242 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
243 md_getuid() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
244 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
245 #ifndef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
246 return( getuid() ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
247 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
248 return(42); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
249 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
250 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
251 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
252 char * |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
253 md_getusername(int uid) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
254 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
255 static char login[80]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
256 char *l = NULL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
257 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
258 /* POSIX Shell has priority, then O/S specific methods */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
259 if ( (uid == md_getuid()) && ((l = getenv("LOGNAME")) != NULL) ) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
260 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
261 strncpy(login,l,80); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
262 login[79] = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
263 return(login); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
264 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
265 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
266 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
267 LPSTR mybuffer; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
268 DWORD size = UNLEN + 1; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
269 TCHAR buffer[UNLEN + 1]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
270 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
271 mybuffer = buffer; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
272 if (uid != md_getuid()) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
273 strcpy(mybuffer, "someone"); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
274 else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
275 GetUserName(mybuffer,&size); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
276 l = mybuffer; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
277 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
278 #if !defined(_WIN32) && !defined(DJGPP) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
279 struct passwd *pw; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
280 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
281 pw = getpwuid(getuid()); |
23 | 282 if (pw != NULL) |
283 l = pw->pw_name; | |
284 else | |
285 l = NULL; | |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
286 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
287 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
288 if ((l == NULL) || (*l == '\0')) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
289 if ( (l = getenv("USERNAME")) == NULL ) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
290 if ( (l = getenv("USER")) == NULL ) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
291 l = "nobody"; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
292 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
293 strncpy(login,l,80); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
294 login[79] = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
295 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
296 return(login); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
297 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
298 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
299 char * |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
300 md_gethomedir() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
301 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
302 static char homedir[PATH_MAX]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
303 char *h = NULL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
304 size_t len; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
305 #if defined(_WIN32) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
306 TCHAR szPath[PATH_MAX]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
307 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
308 #if defined(_WIN32) || defined(DJGPP) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
309 char slash = '\\'; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
310 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
311 char slash = '/'; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
312 struct passwd *pw; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
313 pw = getpwuid(getuid()); |
23 | 314 if (pw != NULL) |
315 h = pw->pw_dir; | |
316 else | |
317 h = ""; | |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
318 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
319 if (strcmp(h,"/") == 0) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
320 h = NULL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
321 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
322 homedir[0] = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
323 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
324 if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, szPath))) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
325 h = szPath; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
326 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
327 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
328 if ( (h == NULL) || (*h == '\0') ) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
329 if ( (h = getenv("HOME")) == NULL ) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
330 h = ""; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
331 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
332 strncpy(homedir,h,PATH_MAX-1); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
333 len = strlen(homedir); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
334 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
335 if ((len > 0) && (homedir[len-1] == slash)) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
336 homedir[len-1] = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
337 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
338 return(homedir); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
339 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
340 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
341 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
342 md_sleep(int s) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
343 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
344 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
345 Sleep(s); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
346 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
347 sleep(s); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
348 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
349 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
350 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
351 char * |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
352 md_getshell() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
353 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
354 static char shell[PATH_MAX]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
355 char *s = NULL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
356 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
357 char *def = "C:\\WINDOWS\\SYSTEM32\\CMD.EXE"; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
358 #elif defined(__DJGPP__) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
359 char *def = "C:\\COMMAND.COM"; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
360 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
361 char *def = "/bin/sh"; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
362 struct passwd *pw; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
363 pw = getpwuid(getuid()); |
23 | 364 if (pw != NULL) |
365 s = pw->pw_shell; | |
366 else | |
367 s = NULL; | |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
368 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
369 if ((s == NULL) || (*s == '\0')) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
370 if ( (s = getenv("COMSPEC")) == NULL) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
371 if ( (s = getenv("SHELL")) == NULL) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
372 if ( (s = getenv("SystemRoot")) == NULL) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
373 s = def; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
374 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
375 strncpy(shell,s,PATH_MAX); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
376 shell[PATH_MAX-1] = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
377 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
378 return(shell); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
379 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
380 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
381 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
382 md_ignore_signals() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
383 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
384 #ifndef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
385 int i; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
386 for (i = 0; i < NSIG; i++) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
387 signal(i, SIG_IGN); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
388 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
389 signal(SIGABRT, SIG_IGN); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
390 signal(SIGFPE, SIG_IGN); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
391 signal(SIGILL, SIG_IGN); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
392 signal(SIGINT, SIG_IGN); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
393 signal(SIGSEGV, SIG_IGN); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
394 signal(SIGTERM, SIG_IGN); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
395 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
396 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
397 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
398 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
399 md_shellescape() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
400 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
401 #if (!defined(_WIN32) && !defined(__DJGPP__)) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
402 int ret_status; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
403 int pid; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
404 void (*myquit)(int); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
405 void (*myend)(int); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
406 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
407 char *sh; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
408 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
409 sh = md_getshell(); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
410 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
411 #if defined(_WIN32) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
412 return((int)_spawnl(_P_WAIT,sh,"shell",NULL,0)); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
413 #elif defined(__DJGPP__) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
414 return ( spawnl(P_WAIT,sh,"shell",NULL,0) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
415 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
416 while((pid = fork()) < 0) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
417 sleep(1); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
418 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
419 if (pid == 0) /* Shell Process */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
420 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
421 /* |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
422 * Set back to original user, just in case |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
423 */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
424 setuid(getuid()); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
425 setgid(getgid()); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
426 execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", 0); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
427 perror("No shelly"); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
428 _exit(-1); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
429 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
430 else /* Application */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
431 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
432 myend = signal(SIGINT, SIG_IGN); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
433 #ifdef SIGQUIT |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
434 myquit = signal(SIGQUIT, SIG_IGN); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
435 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
436 while (wait(&ret_status) != pid) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
437 continue; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
438 |
162
600873555ec0
Don't swap signal handlers in md_shellescape().
John "Elwin" Edwards
parents:
122
diff
changeset
|
439 signal(SIGINT, myend); |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
440 #ifdef SIGQUIT |
162
600873555ec0
Don't swap signal handlers in md_shellescape().
John "Elwin" Edwards
parents:
122
diff
changeset
|
441 signal(SIGQUIT, myquit); |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
442 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
443 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
444 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
445 return(ret_status); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
446 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
447 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
448 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
449 char * |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
450 md_getrealname(int uid) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
451 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
452 static char uidstr[20]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
453 #if !defined(_WIN32) && !defined(DJGPP) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
454 struct passwd *pp; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
455 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
456 if ((pp = getpwuid(uid)) == NULL) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
457 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
458 sprintf(uidstr,"%d", uid); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
459 return(uidstr); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
460 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
461 else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
462 return(pp->pw_name); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
463 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
464 sprintf(uidstr,"%d", uid); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
465 return(uidstr); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
466 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
467 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
468 |
215 | 469 extern char *xcrypt(const char *key, const char *setting); |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
470 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
471 char * |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
472 md_crypt(char *key, char *salt) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
473 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
474 return( xcrypt(key,salt) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
475 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
476 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
477 char * |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
478 md_getpass(char *prompt) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
479 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
480 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
481 static char password_buffer[9]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
482 char *p = password_buffer; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
483 int c, count = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
484 int max_length = 9; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
485 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
486 fflush(stdout); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
487 /* If we can't prompt, abort */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
488 if (fputs(prompt, stderr) < 0) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
489 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
490 *p = '\0'; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
491 return NULL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
492 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
493 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
494 for(;;) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
495 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
496 /* Get a character with no echo */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
497 c = _getch(); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
498 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
499 /* Exit on interrupt (^c or ^break) */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
500 if (c == '\003' || c == 0x100) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
501 exit(1); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
502 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
503 /* Terminate on end of line or file (^j, ^m, ^d, ^z) */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
504 if (c == '\r' || c == '\n' || c == '\004' || c == '\032') |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
505 break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
506 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
507 /* Back up on backspace */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
508 if (c == '\b') |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
509 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
510 if (count) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
511 count--; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
512 else if (p > password_buffer) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
513 p--; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
514 continue; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
515 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
516 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
517 /* Ignore DOS extended characters */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
518 if ((c & 0xff) != c) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
519 continue; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
520 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
521 /* Add to password if it isn't full */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
522 if (p < password_buffer + max_length - 1) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
523 *p++ = c; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
524 else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
525 count++; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
526 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
527 *p = '\0'; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
528 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
529 fputc('\n', stderr); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
530 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
531 return password_buffer; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
532 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
533 return( (char *) getpass(prompt) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
534 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
535 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
536 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
537 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
538 int md_endian = 0x01020304; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
539 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
540 unsigned long int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
541 md_ntohl(unsigned long int x) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
542 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
543 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
544 if ( *((char *)&md_endian) == 0x01 ) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
545 return(x); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
546 else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
547 return( ((x & 0x000000ffU) << 24) | |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
548 ((x & 0x0000ff00U) << 8) | |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
549 ((x & 0x00ff0000U) >> 8) | |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
550 ((x & 0xff000000U) >> 24) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
551 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
552 return( ntohl(x) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
553 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
554 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
555 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
556 unsigned long int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
557 md_htonl(unsigned long int x) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
558 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
559 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
560 if ( *((char *)&md_endian) == 0x01 ) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
561 return(x); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
562 else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
563 return( ((x & 0x000000ffU) << 24) | |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
564 ((x & 0x0000ff00U) << 8) | |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
565 ((x & 0x00ff0000U) >> 8) | |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
566 ((x & 0xff000000U) >> 24) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
567 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
568 return( htonl(x) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
569 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
570 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
571 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
572 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
573 md_ucount() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
574 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
575 #ifdef __DJGPP__ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
576 return(1); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
577 #elif defined(_WIN32) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
578 return(1); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
579 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
580 struct utmpx *up=NULL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
581 int count=0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
582 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
583 setutxent(); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
584 do |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
585 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
586 up = getutxent(); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
587 if (up && up->ut_type == USER_PROCESS) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
588 count++; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
589 } while(up != NULL); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
590 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
591 endutxent(); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
592 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
593 return(count); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
594 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
595 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
596 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
597 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
598 md_getloadavg(double *avg) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
599 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
600 #if defined(__GLIBC__) || defined(_BSD) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
601 if (getloadavg(avg, 3) == -1) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
602 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
603 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
604 avg[0] = avg[1] = avg[2] = 0.0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
605 return -1; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
606 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
607 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
608 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
609 long |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
610 md_random() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
611 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
612 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
613 return(rand()); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
614 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
615 return( random() ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
616 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
617 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
618 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
619 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
620 md_srandom(unsigned x) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
621 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
622 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
623 srand(x); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
624 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
625 srandom(x); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
626 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
627 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
628 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
629 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
630 md_rand() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
631 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
632 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
633 return(rand()); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
634 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
635 return(lrand48() & 0x7fffffff); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
636 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
637 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
638 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
639 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
640 md_srand(int seed) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
641 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
642 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
643 srand(seed); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
644 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
645 srand48(seed); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
646 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
647 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
648 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
649 char * |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
650 md_strdup(const char *s) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
651 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
652 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
653 return( _strdup(s) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
654 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
655 return(strdup(s)); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
656 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
657 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
658 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
659 long |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
660 md_memused() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
661 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
662 #ifdef _WIN32 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
663 MEMORYSTATUS stat; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
664 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
665 GlobalMemoryStatus(&stat); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
666 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
667 return((long)stat.dwTotalPageFile); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
668 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
669 return( (long)sbrk(0) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
670 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
671 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
672 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
673 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
674 md_erasechar() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
675 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
676 #ifdef BSD |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
677 return(_tty.sg_erase); /* process erase character */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
678 #elif defined(USG5_0) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
679 return(_tty.c_cc[VERASE]); /* process erase character */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
680 #else /* USG5_2 .... curses */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
681 return( erasechar() ); /* process erase character */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
682 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
683 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
684 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
685 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
686 md_killchar() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
687 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
688 #ifdef BSD |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
689 return(_tty.sg_kill); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
690 #elif defined(USG5_0) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
691 return(_tty.c_cc[VKILL]); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
692 #else /* USG5_2 ..... curses */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
693 return( killchar() ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
694 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
695 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
696 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
697 /* |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
698 * unctrl: |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
699 * Print a readable version of a certain character |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
700 */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
701 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
702 char * |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
703 md_unctrl(char ch) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
704 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
705 #if USG5_0 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
706 extern char *_unctrl[]; /* Defined in curses library */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
707 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
708 return _unctrl[ch&0177]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
709 #else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
710 return( (char *) unctrl(ch) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
711 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
712 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
713 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
714 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
715 md_flushinp() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
716 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
717 #ifdef BSD |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
718 ioctl(0, TIOCFLUSH); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
719 #elif defined(USG5_0) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
720 ioctl(_tty_ch,TCFLSH,0) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
721 #else /* USG5_2.... curses */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
722 flushinp(); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
723 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
724 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
725 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
726 /* |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
727 Cursor/Keypad Support |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
728 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
729 Sadly Cursor/Keypad support is less straightforward than it should be. |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
730 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
731 The various terminal emulators/consoles choose to differentiate the |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
732 cursor and keypad keys (with modifiers) in different ways (if at all!). |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
733 Furthermore they use different code set sequences for each key only |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
734 a subset of which the various curses libraries recognize. Partly due |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
735 to incomplete termcap/terminfo entries and partly due to inherent |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
736 limitations of those terminal capability databases. |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
737 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
738 I give curses first crack at decoding the sequences. If it fails to decode |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
739 it we check for common ESC-prefixed sequences. |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
740 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
741 All cursor/keypad results are translated into standard rogue movement |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
742 commands. |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
743 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
744 Unmodified keys are translated to walk commands: hjklyubn |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
745 Modified (shift,control,alt) are translated to run commands: HJKLYUBN |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
746 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
747 Console and supported (differentiated) keys |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
748 Interix: Cursor Keys, Keypad, Ctl-Keypad |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
749 Cygwin: Cursor Keys, Keypad, Alt-Cursor Keys |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
750 MSYS: Cursor Keys, Keypad, Ctl-Cursor Keys, Ctl-Keypad |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
751 Win32: Cursor Keys, Keypad, Ctl/Shift/Alt-Cursor Keys, Ctl/Alt-Keypad |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
752 DJGPP: Cursor Keys, Keypad, Ctl/Shift/Alt-Cursor Keys, Ctl/Alt-Keypad |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
753 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
754 Interix Console (raw, ncurses) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
755 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
756 normal shift ctrl alt |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
757 ESC [D, ESC F^, ESC [D, ESC [D /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
758 ESC [C, ESC F$, ESC [C, ESC [C /# Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
759 ESC [A, ESC F-, local win, ESC [A /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
760 ESC [B, ESC F+, local win, ESC [B /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
761 ESC [H, ESC [H, ESC [H, ESC [H /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
762 ESC [S, local win, ESC [S, ESC [S /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
763 ESC [T, local win, ESC [T, ESC [T /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
764 ESC [U, ESC [U, ESC [U, ESC [U /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
765 ESC [D, ESC F^, ESC [D, O /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
766 ESC [C, ESC F$, ESC [C, O /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
767 ESC [A, ESC [A, ESC [-1, O /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
768 ESC [B, ESC [B, ESC [-2, O /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
769 ESC [H, ESC [H, ESC [-263, O /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
770 ESC [S, ESC [S, ESC [-19, O /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
771 ESC [T, ESC [T, ESC [-20, O /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
772 ESC [U, ESC [U, ESC [-21, O /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
773 nothing, nothing, nothing, O /# Kaypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
774 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
775 Interix Console (term=interix, ncurses) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
776 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
777 KEY_LEFT, ESC F^, KEY_LEFT, KEY_LEFT /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
778 KEY_RIGHT, ESC F$, KEY_RIGHT, KEY_RIGHT /# Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
779 KEY_UP, 0x146, local win, KEY_UP /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
780 KEY_DOWN, 0x145, local win, KEY_DOWN /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
781 ESC [H, ESC [H, ESC [H, ESC [H /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
782 KEY_PPAGE, local win, KEY_PPAGE, KEY_PPAGE /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
783 KEY_NPAGE, local win, KEY_NPAGE, KEY_NPAGE /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
784 KEY_LL, KEY_LL, KEY_LL, KEY_LL /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
785 KEY_LEFT, ESC F^, ESC [-4, O /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
786 KEY_RIGHT, ESC F$, ESC [-3, O /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
787 KEY_UP, KEY_UP, ESC [-1, O /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
788 KEY_DOWN, KEY_DOWN, ESC [-2, O /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
789 ESC [H, ESC [H, ESC [-263, O /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
790 KEY_PPAGE, KEY_PPAGE, ESC [-19, O /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
791 KEY_NPAGE, KEY_NPAGE, ESC [-20, O /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
792 KEY_LL, KEY_LL, ESC [-21, O /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
793 nothing, nothing, nothing, O /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
794 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
795 Cygwin Console (raw, ncurses) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
796 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
797 normal shift ctrl alt |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
798 ESC [D, ESC [D, ESC [D, ESC ESC [D /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
799 ESC [C, ESC [C, ESC [C, ESC ESC [C /# Rght #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
800 ESC [A, ESC [A, ESC [A, ESC ESC [A /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
801 ESC [B, ESC [B, ESC [B, ESC ESC [B /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
802 ESC [1~, ESC [1~, ESC [1~, ESC ESC [1~ /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
803 ESC [5~, ESC [5~, ESC [5~, ESC ESC [5~ /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
804 ESC [6~, ESC [6~, ESC [6~, ESC ESC [6~ /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
805 ESC [4~, ESC [4~, ESC [4~, ESC ESC [4~ /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
806 ESC [D, ESC [D, ESC [D, ESC ESC [D,O /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
807 ESC [C, ESC [C, ESC [C, ESC ESC [C,O /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
808 ESC [A, ESC [A, ESC [A, ESC ESC [A,O /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
809 ESC [B, ESC [B, ESC [B, ESC ESC [B,O /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
810 ESC [1~, ESC [1~, ESC [1~, ESC ESC [1~,O /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
811 ESC [5~, ESC [5~, ESC [5~, ESC ESC [5~,O /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
812 ESC [6~, ESC [6~, ESC [6~, ESC ESC [6~,O /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
813 ESC [4~, ESC [4~, ESC [4~, ESC ESC [4~,O /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
814 ESC [-71, nothing, nothing, O /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
815 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
816 Cygwin Console (term=cygwin, ncurses) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
817 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
818 KEY_LEFT, KEY_LEFT, KEY_LEFT, ESC-260 /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
819 KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, ESC-261 /# Rght #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
820 KEY_UP, KEY_UP, KEY_UP, ESC-259 /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
821 KEY_DOWN, KEY_DOWN, KEY_DOWN, ESC-258 /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
822 KEY_HOME, KEY_HOME, KEY_HOME, ESC-262 /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
823 KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, ESC-339 /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
824 KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, ESC-338 /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
825 KEY_END, KEY_END, KEY_END, ESC-360 /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
826 KEY_LEFT, KEY_LEFT, KEY_LEFT, ESC-260,O /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
827 KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, ESC-261,O /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
828 KEY_UP, KEY_UP, KEY_UP, ESC-259,O /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
829 KEY_DOWN, KEY_DOWN, KEY_DOWN, ESC-258,O /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
830 KEY_HOME, KEY_HOME, KEY_HOME, ESC-262,O /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
831 KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, ESC-339,O /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
832 KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, ESC-338,O /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
833 KEY_END, KEY_END, KEY_END, ESC-360,O /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
834 ESC [G, nothing, nothing, O /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
835 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
836 MSYS Console (raw, ncurses) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
837 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
838 normal shift ctrl alt |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
839 ESC OD, ESC [d, ESC Od nothing /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
840 ESC OE, ESC [e, ESC Oe, nothing /# Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
841 ESC OA, ESC [a, ESC Oa, nothing /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
842 ESC OB, ESC [b, ESC Ob, nothing /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
843 ESC [7~, ESC [7$, ESC [7^, nothing /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
844 ESC [5~, local window, ESC [5^, nothing /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
845 ESC [6~, local window, ESC [6^, nothing /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
846 ESC [8~, ESC [8$, ESC [8^, nothing /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
847 ESC OD, ESC [d, ESC Od O /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
848 ESC OE, ESC [c, ESC Oc, O /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
849 ESC OA, ESC [a, ESC Oa, O /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
850 ESC OB, ESC [b, ESC Ob, O /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
851 ESC [7~, ESC [7$, ESC [7^, O /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
852 ESC [5~, local window, ESC [5^, O /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
853 ESC [6~, local window, ESC [6^, O /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
854 ESC [8~, ESC [8$, ESC [8^, O /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
855 11, 11, 11, O /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
856 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
857 MSYS Console (term=rxvt, ncurses) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
858 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
859 normal shift ctrl alt |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
860 KEY_LEFT, KEY_SLEFT, 514 nothing /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
861 KEY_RIGHT, KEY_SRIGHT, 516, nothing /# Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
862 KEY_UP, 518, 519, nothing /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
863 KEY_DOWN, 511, 512, nothing /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
864 KEY_HOME, KEY_SHOME, ESC [7^, nothing /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
865 KEY_PPAGE, local window, ESC [5^, nothing /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
866 KEY_NPAGE, local window, ESC [6^, nothing /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
867 KEY_END, KEY_SEND, KEY_EOL, nothing /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
868 KEY_LEFT, KEY_SLEFT, 514 O /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
869 KEY_RIGHT, KEY_SRIGHT, 516, O /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
870 KEY_UP, 518, 519, O /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
871 KEY_DOWN, 511, 512, O /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
872 KEY_HOME, KEY_SHOME, ESC [7^, O /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
873 KEY_PPAGE, local window, ESC [5^, O /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
874 KEY_NPAGE, local window, ESC [6^, O /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
875 KEY_END, KEY_SEND, KEY_EOL, O /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
876 11, 11, 11, O /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
877 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
878 Win32 Console (raw, pdcurses) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
879 DJGPP Console (raw, pdcurses) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
880 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
881 normal shift ctrl alt |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
882 260, 391, 443, 493 /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
883 261, 400, 444, 492 /# Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
884 259, 547, 480, 490 /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
885 258, 548, 481, 491 /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
886 262, 388, 447, 524 /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
887 339, 396, 445, 526 /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
888 338, 394, 446, 520 /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
889 358, 384, 448, 518 /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
890 452, 52('4'), 511, 521 /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
891 454, 54('6'), 513, 523 /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
892 450, 56('8'), 515, 525 /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
893 456, 50('2'), 509, 519 /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
894 449, 55('7'), 514, 524 /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
895 451, 57('9'), 516, 526 /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
896 457, 51('3'), 510, 520 /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
897 455, 49('1'), 508, 518 /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
898 453, 53('5'), 512, 522 /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
899 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
900 Win32 Console (pdcurses, MSVC/MingW32) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
901 DJGPP Console (pdcurses) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
902 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
903 normal shift ctrl alt |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
904 KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
905 KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT /# Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
906 KEY_UP, KEY_SUP, CTL_UP, ALT_UP /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
907 KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
908 KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
909 KEY_PPAGE, KEY_SPREVIOUS, CTL_PGUP, ALT_PGUP /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
910 KEY_NPAGE, KEY_SNEXTE, CTL_PGDN, ALT_PGDN /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
911 KEY_END, KEY_SEND, CTL_END, ALT_END /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
912 KEY_B1, 52('4'), CTL_PAD4, ALT_PAD4 /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
913 KEY_B3, 54('6'), CTL_PAD6, ALT_PAD6 /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
914 KEY_A2, 56('8'), CTL_PAD8, ALT_PAD8 /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
915 KEY_C2, 50('2'), CTL_PAD2, ALT_PAD2 /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
916 KEY_A1, 55('7'), CTL_PAD7, ALT_PAD7 /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
917 KEY_A3, 57('9'), CTL_PAD9, ALT_PAD9 /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
918 KEY_C3, 51('3'), CTL_PAD3, ALT_PAD3 /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
919 KEY_C1, 49('1'), CTL_PAD1, ALT_PAD1 /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
920 KEY_B2, 53('5'), CTL_PAD5, ALT_PAD5 /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
921 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
922 Windows Telnet (raw) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
923 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
924 normal shift ctrl alt |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
925 ESC [D, ESC [D, ESC [D, ESC [D /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
926 ESC [C, ESC [C, ESC [C, ESC [C /# Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
927 ESC [A, ESC [A, ESC [A, ESC [A /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
928 ESC [B, ESC [B, ESC [B, ESC [B /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
929 ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
930 ESC [5~, ESC [5~, ESC [5~, ESC [5~ /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
931 ESC [6~, ESC [6~, ESC [6~, ESC [6~ /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
932 ESC [4~, ESC [4~, ESC [4~, ESC [4~ /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
933 ESC [D, ESC [D, ESC [D, ESC [D /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
934 ESC [C, ESC [C, ESC [C, ESC [C /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
935 ESC [A, ESC [A, ESC [A, ESC [A /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
936 ESC [B, ESC [B, ESC [B, ESC [B /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
937 ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
938 ESC [5~, ESC [5~, ESC [5~, ESC [5~ /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
939 ESC [6~, ESC [6~, ESC [6~, ESC [6~ /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
940 ESC [4~, ESC [4~, ESC [4~, ESC [4~ /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
941 nothing, nothing, nothing, nothing /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
942 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
943 Windows Telnet (term=xterm) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
944 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
945 normal shift ctrl alt |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
946 KEY_LEFT, KEY_LEFT, KEY_LEFT, KEY_LEFT /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
947 KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT /# Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
948 KEY_UP, KEY_UP, KEY_UP, KEY_UP /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
949 KEY_DOWN, KEY_DOWN, KEY_DOWN, KEY_DOWN /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
950 ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
951 KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, KEY_PPAGE /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
952 KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, KEY_NPAGE /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
953 ESC [4~, ESC [4~, ESC [4~, ESC [4~ /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
954 KEY_LEFT, KEY_LEFT, KEY_LEFT, O /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
955 KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, O /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
956 KEY_UP, KEY_UP, KEY_UP, O /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
957 KEY_DOWN, KEY_DOWN, KEY_DOWN, O /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
958 ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
959 KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, KEY_PPAGE /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
960 KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, KEY_NPAGE /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
961 ESC [4~, ESC [4~, ESC [4~, O /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
962 ESC [-71, nothing, nothing, O /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
963 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
964 PuTTY |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
965 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
966 normal shift ctrl alt |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
967 ESC [D, ESC [D, ESC OD, ESC [D /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
968 ESC [C, ESC [C, ESC OC, ESC [C /# Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
969 ESC [A, ESC [A, ESC OA, ESC [A /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
970 ESC [B, ESC [B, ESC OB, ESC [B /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
971 ESC [1~, ESC [1~, local win, ESC [1~ /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
972 ESC [5~, local win, local win, ESC [5~ /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
973 ESC [6~, local win, local win, ESC [6~ /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
974 ESC [4~, ESC [4~, local win, ESC [4~ /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
975 ESC [D, ESC [D, ESC [D, O /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
976 ESC [C, ESC [C, ESC [C, O /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
977 ESC [A, ESC [A, ESC [A, O /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
978 ESC [B, ESC [B, ESC [B, O /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
979 ESC [1~, ESC [1~, ESC [1~, O /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
980 ESC [5~, ESC [5~, ESC [5~, O /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
981 ESC [6~, ESC [6~, ESC [6~, O /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
982 ESC [4~, ESC [4~, ESC [4~, O /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
983 nothing, nothing, nothing, O /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
984 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
985 PuTTY |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
986 ============================== |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
987 normal shift ctrl alt |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
988 KEY_LEFT, KEY_LEFT, ESC OD, ESC KEY_LEFT /# Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
989 KEY_RIGHT KEY_RIGHT, ESC OC, ESC KEY_RIGHT /# Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
990 KEY_UP, KEY_UP, ESC OA, ESC KEY_UP /# Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
991 KEY_DOWN, KEY_DOWN, ESC OB, ESC KEY_DOWN /# Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
992 ESC [1~, ESC [1~, local win, ESC ESC [1~ /# Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
993 KEY_PPAGE local win, local win, ESC KEY_PPAGE /# Page Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
994 KEY_NPAGE local win, local win, ESC KEY_NPAGE /# Page Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
995 ESC [4~, ESC [4~, local win, ESC ESC [4~ /# End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
996 ESC Ot, ESC Ot, ESC Ot, O /# Keypad Left #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
997 ESC Ov, ESC Ov, ESC Ov, O /# Keypad Right #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
998 ESC Ox, ESC Ox, ESC Ox, O /# Keypad Up #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
999 ESC Or, ESC Or, ESC Or, O /# Keypad Down #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1000 ESC Ow, ESC Ow, ESC Ow, O /# Keypad Home #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1001 ESC Oy, ESC Oy, ESC Oy, O /# Keypad PgUp #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1002 ESC Os, ESC Os, ESC Os, O /# Keypad PgDn #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1003 ESC Oq, ESC Oq, ESC Oq, O /# Keypad End #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1004 ESC Ou, ESC Ou, ESC Ou, O /# Keypad 5 #/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1005 */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1006 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1007 #define M_NORMAL 0 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1008 #define M_ESC 1 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1009 #define M_KEYPAD 2 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1010 #define M_TRAIL 3 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1011 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1012 int undo[5]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1013 int uindex = -1; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1014 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1015 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1016 reread() |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1017 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1018 int redo; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1019 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1020 if (uindex < 0) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1021 return 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1022 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1023 redo = undo[0]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1024 undo[0] = undo[1]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1025 undo[1] = undo[2]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1026 undo[2] = undo[3]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1027 undo[3] = undo[4]; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1028 uindex--; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1029 return redo; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1030 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1031 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1032 void |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1033 unread(int c) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1034 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1035 if (uindex >= 4) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1036 abort(); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1037 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1038 undo[++uindex] = c; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1039 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1040 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1041 int |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1042 md_readchar(WINDOW *win) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1043 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1044 int ch = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1045 int lastch = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1046 int mode = M_NORMAL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1047 int mode2 = M_NORMAL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1048 int nodelayf = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1049 int count = 0; |
215 | 1050 extern void auto_save(int sig); |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1051 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1052 for(;;) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1053 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1054 if (mode == M_NORMAL && uindex >= 0) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1055 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1056 ch = reread(); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1057 break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1058 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1059 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1060 ch = wgetch(win); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1061 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1062 if (ch == ERR) /* timed out or error */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1063 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1064 if (nodelayf) /* likely timed out, switch to */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1065 { /* normal mode and block on */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1066 mode = M_NORMAL; /* next read */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1067 nodelayf = 0; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1068 nodelay(win,0); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1069 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1070 else if (count > 10) /* after 10 errors assume */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1071 auto_save(0); /* input stream is broken and */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1072 else /* auto save and exit */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1073 count++; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1074 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1075 continue; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1076 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1077 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1078 count = 0; /* reset input error count */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1079 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1080 if (mode == M_TRAIL) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1081 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1082 if (ch == '^') /* msys console : 7,5,6,8: modified*/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1083 ch = MOD_MOVE( toupper(lastch) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1084 else if (ch == '~') /* cygwin console: 1,5,6,4: normal */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1085 ch = tolower(lastch); /* windows telnet: 1,5,6,4: normal */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1086 /* msys console : 7,5,6,8: normal */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1087 else if (mode2 == M_ESC) /* cygwin console: 1,5,6,4: modified*/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1088 ch = MOD_MOVE( toupper(ch) ); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1089 else |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1090 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1091 mode = M_NORMAL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1092 unread(ch); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1093 continue; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1094 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1095 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1096 break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1097 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1098 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1099 if (mode == M_ESC) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1100 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1101 if (ch == 27) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1102 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1103 mode2 = M_ESC; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1104 unread(ch); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1105 continue; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1106 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1107 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1108 if ((ch == 'F') || (ch == 'O') || (ch == '[')) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1109 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1110 mode = M_KEYPAD; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1111 unread(ch); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1112 continue; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1113 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1114 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1115 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1116 switch(ch) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1117 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1118 /* Cygwin Console */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1119 /* PuTTY */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1120 case KEY_LEFT : ch = MOD_MOVE('H'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1121 case KEY_RIGHT: ch = MOD_MOVE('L'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1122 case KEY_UP : ch = MOD_MOVE('K'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1123 case KEY_DOWN : ch = MOD_MOVE('J'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1124 case KEY_HOME : ch = MOD_MOVE('Y'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1125 case KEY_PPAGE: ch = MOD_MOVE('U'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1126 case KEY_NPAGE: ch = MOD_MOVE('N'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1127 case KEY_END : ch = MOD_MOVE('B'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1128 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1129 default: mode = M_NORMAL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1130 mode2 = M_NORMAL; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1131 unread(ch); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1132 continue; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1133 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1134 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1135 break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1136 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1137 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1138 if (mode == M_KEYPAD) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1139 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1140 switch(ch) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1141 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1142 /* ESC F - Interix Console codes */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1143 case '^': ch = MOD_MOVE('H'); break; /* Shift-Left */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1144 case '$': ch = MOD_MOVE('L'); break; /* Shift-Right */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1145 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1146 /* ESC [ - Interix Console codes */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1147 case 'H': ch = 'y'; break; /* Home */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1148 case 1: ch = MOD_MOVE('K'); break; /* Ctl-Keypad Up */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1149 case 2: ch = MOD_MOVE('J'); break; /* Ctl-Keypad Down */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1150 case 3: ch = MOD_MOVE('L'); break; /* Ctl-Keypad Right */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1151 case 4: ch = MOD_MOVE('H'); break; /* Ctl-Keypad Left */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1152 case 263: ch = MOD_MOVE('Y'); break; /* Ctl-Keypad Home */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1153 case 19: ch = MOD_MOVE('U'); break; /* Ctl-Keypad PgUp */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1154 case 20: ch = MOD_MOVE('N'); break; /* Ctl-Keypad PgDn */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1155 case 21: ch = MOD_MOVE('B'); break; /* Ctl-Keypad End */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1156 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1157 /* ESC [ - Cygwin Console codes */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1158 case 'G': ch = '.'; break; /* Keypad 5 */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1159 case '7': lastch = 'Y'; mode=M_TRAIL; break; /* Ctl-Home */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1160 case '5': lastch = 'U'; mode=M_TRAIL; break; /* Ctl-PgUp */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1161 case '6': lastch = 'N'; mode=M_TRAIL; break; /* Ctl-PgDn */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1162 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1163 /* ESC [ - Win32 Telnet, PuTTY */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1164 case '1': lastch = 'y'; mode=M_TRAIL; break; /* Home */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1165 case '4': lastch = 'b'; mode=M_TRAIL; break; /* End */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1166 |
56 | 1167 /* ESC [ - not understood by screen/tmux */ |
1168 case 'E': ch = '.'; break; /* Keypad 5 */ | |
1169 | |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1170 /* ESC O - PuTTY */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1171 case 'D': ch = MOD_MOVE('H'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1172 case 'C': ch = MOD_MOVE('L'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1173 case 'A': ch = MOD_MOVE('K'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1174 case 'B': ch = MOD_MOVE('J'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1175 case 't': ch = 'h'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1176 case 'v': ch = 'l'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1177 case 'x': ch = 'k'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1178 case 'r': ch = 'j'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1179 case 'w': ch = 'y'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1180 case 'y': ch = 'u'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1181 case 's': ch = 'n'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1182 case 'q': ch = 'b'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1183 case 'u': ch = '.'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1184 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1185 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1186 if (mode != M_KEYPAD) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1187 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1188 unread(ch); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1189 continue; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1190 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1191 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1192 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1193 if (ch == 27) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1194 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1195 nodelay(win,1); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1196 mode = M_ESC; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1197 nodelayf = 1; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1198 unread(ch); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1199 continue; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1200 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1201 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1202 switch(ch) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1203 { |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1204 case KEY_LEFT : ch = 'h'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1205 case KEY_DOWN : ch = 'j'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1206 case KEY_UP : ch = 'k'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1207 case KEY_RIGHT : ch = 'l'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1208 case KEY_HOME : ch = 'y'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1209 case KEY_PPAGE : ch = 'u'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1210 case KEY_END : ch = 'b'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1211 #ifdef KEY_LL |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1212 case KEY_LL : ch = 'b'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1213 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1214 case KEY_NPAGE : ch = 'n'; break; |
56 | 1215 case KEY_BEG : ch = '.'; break; |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1216 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1217 #ifdef KEY_B1 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1218 case KEY_B1 : ch = 'h'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1219 case KEY_C2 : ch = 'j'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1220 case KEY_A2 : ch = 'k'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1221 case KEY_B3 : ch = 'l'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1222 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1223 case KEY_A1 : ch = 'y'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1224 case KEY_A3 : ch = 'u'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1225 case KEY_C1 : ch = 'b'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1226 case KEY_C3 : ch = 'n'; break; |
56 | 1227 case KEY_B2 : ch = '.'; break; |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1228 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1229 #ifdef KEY_SLEFT |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1230 case KEY_SRIGHT : ch = MOD_MOVE('L'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1231 case KEY_SLEFT : ch = MOD_MOVE('H'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1232 #ifdef KEY_SUP |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1233 case KEY_SUP : ch = MOD_MOVE('K'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1234 case KEY_SDOWN : ch = MOD_MOVE('J'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1235 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1236 case KEY_SHOME : ch = MOD_MOVE('Y'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1237 case KEY_SPREVIOUS:ch = MOD_MOVE('U'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1238 case KEY_SEND : ch = MOD_MOVE('B'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1239 case KEY_SNEXT : ch = MOD_MOVE('N'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1240 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1241 case 0x146 : ch = MOD_MOVE('K'); break; /* Shift-Up */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1242 case 0x145 : ch = MOD_MOVE('J'); break; /* Shift-Down */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1243 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1244 #ifdef CTL_RIGHT |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1245 case CTL_RIGHT : ch = MOD_MOVE('L'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1246 case CTL_LEFT : ch = MOD_MOVE('H'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1247 case CTL_UP : ch = MOD_MOVE('K'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1248 case CTL_DOWN : ch = MOD_MOVE('J'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1249 case CTL_HOME : ch = MOD_MOVE('Y'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1250 case CTL_PGUP : ch = MOD_MOVE('U'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1251 case CTL_END : ch = MOD_MOVE('B'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1252 case CTL_PGDN : ch = MOD_MOVE('N'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1253 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1254 #ifdef KEY_EOL |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1255 case KEY_EOL : ch = MOD_MOVE('B'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1256 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1257 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1258 #ifndef CTL_PAD1 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1259 /* MSYS rxvt console */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1260 case 511 : ch = MOD_MOVE('J'); break; /* Shift Dn */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1261 case 512 : ch = MOD_MOVE('J'); break; /* Ctl Down */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1262 case 514 : ch = MOD_MOVE('H'); break; /* Ctl Left */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1263 case 516 : ch = MOD_MOVE('L'); break; /* Ctl Right*/ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1264 case 518 : ch = MOD_MOVE('K'); break; /* Shift Up */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1265 case 519 : ch = MOD_MOVE('K'); break; /* Ctl Up */ |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1266 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1267 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1268 #ifdef CTL_PAD1 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1269 case CTL_PAD1 : ch = MOD_MOVE('B'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1270 case CTL_PAD2 : ch = MOD_MOVE('J'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1271 case CTL_PAD3 : ch = MOD_MOVE('N'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1272 case CTL_PAD4 : ch = MOD_MOVE('H'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1273 case CTL_PAD5 : ch = '.'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1274 case CTL_PAD6 : ch = MOD_MOVE('L'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1275 case CTL_PAD7 : ch = MOD_MOVE('Y'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1276 case CTL_PAD8 : ch = MOD_MOVE('K'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1277 case CTL_PAD9 : ch = MOD_MOVE('U'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1278 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1279 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1280 #ifdef ALT_RIGHT |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1281 case ALT_RIGHT : ch = MOD_MOVE('L'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1282 case ALT_LEFT : ch = MOD_MOVE('H'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1283 case ALT_DOWN : ch = MOD_MOVE('J'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1284 case ALT_HOME : ch = MOD_MOVE('Y'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1285 case ALT_PGUP : ch = MOD_MOVE('U'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1286 case ALT_END : ch = MOD_MOVE('B'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1287 case ALT_PGDN : ch = MOD_MOVE('N'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1288 #endif |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1289 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1290 #ifdef ALT_PAD1 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1291 case ALT_PAD1 : ch = MOD_MOVE('B'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1292 case ALT_PAD2 : ch = MOD_MOVE('J'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1293 case ALT_PAD3 : ch = MOD_MOVE('N'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1294 case ALT_PAD4 : ch = MOD_MOVE('H'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1295 case ALT_PAD5 : ch = '.'; break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1296 case ALT_PAD6 : ch = MOD_MOVE('L'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1297 case ALT_PAD7 : ch = MOD_MOVE('Y'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1298 case ALT_PAD8 : ch = MOD_MOVE('K'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1299 case ALT_PAD9 : ch = MOD_MOVE('U'); break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1300 #endif |
94
ba9930a7f99d
rogue[345]: fix backspace key in prompts.
John "Elwin" Edwards
parents:
56
diff
changeset
|
1301 #ifdef KEY_BACKSPACE |
ba9930a7f99d
rogue[345]: fix backspace key in prompts.
John "Elwin" Edwards
parents:
56
diff
changeset
|
1302 case KEY_BACKSPACE: ch = md_erasechar(); break; |
ba9930a7f99d
rogue[345]: fix backspace key in prompts.
John "Elwin" Edwards
parents:
56
diff
changeset
|
1303 #endif |
12
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1304 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1305 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1306 break; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1307 } |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1308 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1309 if (nodelayf) |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1310 nodelay(win,0); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1311 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1312 uindex = -1; |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1313 |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1314 return(ch & 0x7F); |
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
edwarj4
parents:
diff
changeset
|
1315 } |