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