Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6725 | siemargl | 1 | /* |
2 | Copyright (c) 1990-2004 Info-ZIP. All rights reserved. |
||
3 | |||
4 | See the accompanying file LICENSE, version 2000-Apr-09 or later |
||
5 | (the contents of which are also included in zip.h) for terms of use. |
||
6 | If, for some reason, all these files are missing, the Info-ZIP license |
||
7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html |
||
8 | */ |
||
9 | /* |
||
10 | ttyio.h |
||
11 | */ |
||
12 | |||
13 | #ifndef __ttyio_h /* don't include more than once */ |
||
14 | #define __ttyio_h |
||
15 | |||
16 | #ifndef __crypt_h |
||
17 | # include "crypt.h" /* ensure that encryption header file has been seen */ |
||
18 | #endif |
||
19 | |||
20 | #if (CRYPT || (defined(UNZIP) && !defined(FUNZIP))) |
||
21 | /* |
||
22 | * Non-echo keyboard/console input support is needed and enabled. |
||
23 | */ |
||
24 | |||
25 | #ifndef __G /* UnZip only, for now (DLL stuff) */ |
||
26 | # define __G |
||
27 | # define __G__ |
||
28 | # define __GDEF |
||
29 | # define __GPRO void |
||
30 | # define __GPRO__ |
||
31 | #endif |
||
32 | |||
33 | #ifndef ZCONST /* UnZip only (until have configure script like Zip) */ |
||
34 | # define ZCONST const |
||
35 | #endif |
||
36 | |||
37 | #if (defined(MSDOS) || defined(OS2) || defined(WIN32)) |
||
38 | # ifndef DOS_OS2_W32 |
||
39 | # define DOS_OS2_W32 |
||
40 | # endif |
||
41 | #endif |
||
42 | |||
43 | #if (defined(DOS_OS2_W32) || defined(__human68k__)) |
||
44 | # ifndef DOS_H68_OS2_W32 |
||
45 | # define DOS_H68_OS2_W32 |
||
46 | # endif |
||
47 | #endif |
||
48 | |||
49 | #if (defined(DOS_OS2_W32) || defined(FLEXOS)) |
||
50 | # ifndef DOS_FLX_OS2_W32 |
||
51 | # define DOS_FLX_OS2_W32 |
||
52 | # endif |
||
53 | #endif |
||
54 | |||
55 | #if (defined(DOS_H68_OS2_W32) || defined(FLEXOS)) |
||
56 | # ifndef DOS_FLX_H68_OS2_W32 |
||
57 | # define DOS_FLX_H68_OS2_W32 |
||
58 | # endif |
||
59 | #endif |
||
60 | |||
61 | #if (defined(__ATHEOS__) || defined(__BEOS__) || defined(UNIX)) |
||
62 | # ifndef ATH_BEO_UNX |
||
63 | # define ATH_BEO_UNX |
||
64 | # endif |
||
65 | #endif |
||
66 | |||
67 | #if (defined(VM_CMS) || defined(MVS)) |
||
68 | # ifndef CMS_MVS |
||
69 | # define CMS_MVS |
||
70 | # endif |
||
71 | #endif |
||
72 | |||
73 | |||
74 | /* Function prototypes */ |
||
75 | |||
76 | /* The following systems supply a `non-echo' character input function "getch()" |
||
77 | * (or an alias) and do not need the echoff() / echon() function pair. |
||
78 | */ |
||
79 | #ifdef AMIGA |
||
80 | # define echoff(f) |
||
81 | # define echon() |
||
82 | # define getch() Agetch() |
||
83 | # define HAVE_WORKING_GETCH |
||
84 | #endif /* AMIGA */ |
||
85 | |||
86 | #ifdef ATARI |
||
87 | # define echoff(f) |
||
88 | # define echon() |
||
89 | # include |
||
90 | # define getch() (Cnecin() & 0x000000ff) |
||
91 | # define HAVE_WORKING_GETCH |
||
92 | #endif |
||
93 | |||
94 | #ifdef MACOS |
||
95 | # define echoff(f) |
||
96 | # define echon() |
||
97 | # define getch() macgetch() |
||
98 | # define HAVE_WORKING_GETCH |
||
99 | #endif |
||
100 | |||
101 | #ifdef NLM |
||
102 | # define echoff(f) |
||
103 | # define echon() |
||
104 | # define HAVE_WORKING_GETCH |
||
105 | #endif |
||
106 | |||
107 | #ifdef QDOS |
||
108 | # define echoff(f) |
||
109 | # define echon() |
||
110 | # define HAVE_WORKING_GETCH |
||
111 | #endif |
||
112 | |||
113 | #ifdef RISCOS |
||
114 | # define echoff(f) |
||
115 | # define echon() |
||
116 | # define getch() SWI_OS_ReadC() |
||
117 | # define HAVE_WORKING_GETCH |
||
118 | #endif |
||
119 | |||
120 | #ifdef DOS_H68_OS2_W32 |
||
121 | # define echoff(f) |
||
122 | # define echon() |
||
123 | # ifdef WIN32 |
||
124 | # ifndef getch |
||
125 | # define getch() getch_win32() |
||
126 | # endif |
||
127 | # else /* !WIN32 */ |
||
128 | # ifdef __EMX__ |
||
129 | # ifndef getch |
||
130 | # define getch() _read_kbd(0, 1, 0) |
||
131 | # endif |
||
132 | # else /* !__EMX__ */ |
||
133 | # ifdef __GO32__ |
||
134 | # include |
||
135 | # define getch() getkey() |
||
136 | # else /* !__GO32__ */ |
||
137 | # include |
||
138 | # endif /* ?__GO32__ */ |
||
139 | # endif /* ?__EMX__ */ |
||
140 | # endif /* ?WIN32 */ |
||
141 | # define HAVE_WORKING_GETCH |
||
142 | #endif /* DOS_H68_OS2_W32 */ |
||
143 | |||
144 | #ifdef FLEXOS |
||
145 | # define echoff(f) |
||
146 | # define echon() |
||
147 | # define getch() getchar() /* not correct, but may not be on a console */ |
||
148 | # define HAVE_WORKING_GETCH |
||
149 | #endif |
||
150 | |||
151 | /* For VM/CMS and MVS, we do not (yet) have any support to switch terminal |
||
152 | * input echo on and off. The following "fake" definitions allow inclusion |
||
153 | * of crypt support and UnZip's "pause prompting" features, but without |
||
154 | * any echo suppression. |
||
155 | */ |
||
156 | #ifdef CMS_MVS |
||
157 | # define echoff(f) |
||
158 | # define echon() |
||
159 | #endif |
||
160 | |||
161 | #ifdef TANDEM |
||
162 | # define echoff(f) |
||
163 | # define echon() |
||
164 | # define getch() zgetch() /* defined in TANDEMC */ |
||
165 | # define HAVE_WORKING_GETCH |
||
166 | #endif |
||
167 | |||
168 | /* The THEOS C runtime library supplies the function conmask() to toggle |
||
169 | * terminal input echo on (conmask("e")) and off (conmask("n")). But, |
||
170 | * since THEOS C RTL also contains a working non-echo getch() function, |
||
171 | * the echo toggles are not needed. |
||
172 | */ |
||
173 | #ifdef THEOS |
||
174 | # define echoff(f) |
||
175 | # define echon() |
||
176 | # define HAVE_WORKING_GETCH |
||
177 | #endif |
||
178 | |||
179 | /* VMS has a single echo() function in ttyio.c to toggle terminal |
||
180 | * input echo on and off. |
||
181 | */ |
||
182 | #ifdef VMS |
||
183 | # define echoff(f) echo(0) |
||
184 | # define echon() echo(1) |
||
185 | # define getch() tt_getch() |
||
186 | # define FGETCH(f) tt_getch() |
||
187 | int echo OF((int)); |
||
188 | int tt_getch OF((void)); |
||
189 | #endif |
||
190 | |||
191 | /* For all other systems, ttyio.c supplies the two functions Echoff() and |
||
192 | * Echon() for suppressing and (re)enabling console input echo. |
||
193 | */ |
||
194 | #ifndef echoff |
||
195 | # define echoff(f) Echoff(__G__ f) |
||
196 | # define echon() Echon(__G) |
||
197 | void Echoff OF((__GPRO__ int f)); |
||
198 | void Echon OF((__GPRO)); |
||
199 | #endif |
||
200 | |||
201 | /* this stuff is used by MORE and also now by the ctrl-S code; fileio.c only */ |
||
202 | #if (defined(UNZIP) && !defined(FUNZIP)) |
||
203 | # ifdef HAVE_WORKING_GETCH |
||
204 | # define FGETCH(f) getch() |
||
205 | # endif |
||
206 | # ifndef FGETCH |
||
207 | /* default for all systems where no getch()-like function is available */ |
||
208 | int zgetch OF((__GPRO__ int f)); |
||
209 | # define FGETCH(f) zgetch(__G__ f) |
||
210 | # endif |
||
211 | #endif /* UNZIP && !FUNZIP */ |
||
212 | |||
213 | #if (CRYPT && !defined(WINDLL)) |
||
214 | char *getp OF((__GPRO__ ZCONST char *m, char *p, int n)); |
||
215 | #endif |
||
216 | |||
217 | #else /* !(CRYPT || (UNZIP && !FUNZIP)) */ |
||
218 | |||
219 | /* |
||
220 | * No need for non-echo keyboard/console input; provide dummy definitions. |
||
221 | */ |
||
222 | #define echoff(f) |
||
223 | #define echon() |
||
224 | |||
225 | #endif /* ?(CRYPT || (UNZIP && !FUNZIP)) */ |
||
226 | |||
227 | #endif /* !__ttyio_h */ |