1 /* 2 Copyright (c) 1990-2001 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(VM_CMS) || defined(MVS)) 62 # ifndef CMS_MVS 63 # define CMS_MVS 64 # endif 65 #endif 66 67 68 /* Function prototypes */ 69 70 /* The following systems supply a `non-echo' character input function "getch()" 71 * (or an alias) and do not need the echoff() / echon() function pair. 72 */ 73 #ifdef AMIGA 74 # define echoff(f) 75 # define echon() 76 # define getch() Agetch() 77 # define HAVE_WORKING_GETCH 78 #endif /* AMIGA */ 79 80 #ifdef ATARI 81 # define echoff(f) 82 # define echon() 83 # include <osbind.h> 84 # define getch() (Cnecin() & 0x000000ff) 85 # define HAVE_WORKING_GETCH 86 #endif 87 88 #ifdef MACOS 89 # define echoff(f) 90 # define echon() 91 # define getch() macgetch() 92 # define HAVE_WORKING_GETCH 93 #endif 94 95 #ifdef NLM 96 # define echoff(f) 97 # define echon() 98 # define HAVE_WORKING_GETCH 99 #endif 100 101 #ifdef QDOS 102 # define echoff(f) 103 # define echon() 104 # define HAVE_WORKING_GETCH 105 #endif 106 107 #ifdef RISCOS 108 # define echoff(f) 109 # define echon() 110 # define getch() SWI_OS_ReadC() 111 # define HAVE_WORKING_GETCH 112 #endif 113 114 #ifdef DOS_H68_OS2_W32 115 # define echoff(f) 116 # define echon() 117 # ifdef WIN32 118 # ifndef getch 119 # define getch() getch_win32() 120 # endif 121 # else /* !WIN32 */ 122 # ifdef __EMX__ 123 # ifndef getch 124 # define getch() _read_kbd(0, 1, 0) 125 # endif 126 # else /* !__EMX__ */ 127 # ifdef __GO32__ 128 # include <pc.h> 129 # define getch() getkey() 130 # else /* !__GO32__ */ 131 # include <conio.h> 132 # endif /* ?__GO32__ */ 133 # endif /* ?__EMX__ */ 134 # endif /* ?WIN32 */ 135 # define HAVE_WORKING_GETCH 136 #endif /* DOS_H68_OS2_W32 */ 137 138 #ifdef FLEXOS 139 # define echoff(f) 140 # define echon() 141 # define getch() getchar() /* not correct, but may not be on a console */ 142 # define HAVE_WORKING_GETCH 143 #endif 144 145 /* For VM/CMS and MVS, we do not (yet) have any support to switch terminal 146 * input echo on and off. The following "fake" definitions allow inclusion 147 * of crypt support and UnZip's "pause prompting" features, but without 148 * any echo suppression. 149 */ 150 #ifdef CMS_MVS 151 # define echoff(f) 152 # define echon() 153 #endif 154 155 #ifdef TANDEM 156 # define echoff(f) 157 # define echon() 158 # define getch() zgetch() /* defined in TANDEMC */ 159 # define HAVE_WORKING_GETCH 160 #endif 161 162 /* The THEOS C runtime library supplies the function conmask() to toggle 163 * terminal input echo on (conmask("e")) and off (conmask("n")). But, 164 * since THEOS C RTL also contains a working non-echo getch() function, 165 * the echo toggles are not needed. 166 */ 167 #ifdef THEOS 168 # define echoff(f) 169 # define echon() 170 # define HAVE_WORKING_GETCH 171 #endif 172 173 /* VMS has a single echo() function in ttyio.c to toggle terminal 174 * input echo on and off. 175 */ 176 #ifdef VMS 177 # define echoff(f) echo(0) 178 # define echon() echo(1) 179 # define getch() tt_getch() 180 # define FGETCH(f) tt_getch() 181 int echo OF((int)); 182 int tt_getch OF((void)); 183 #endif 184 185 /* For all other systems, ttyio.c supplies the two functions Echoff() and 186 * Echon() for suppressing and (re)enabling console input echo. 187 */ 188 #ifndef echoff 189 # define echoff(f) Echoff(__G__ f) 190 # define echon() Echon(__G) 191 void Echoff OF((__GPRO__ int f)); 192 void Echon OF((__GPRO)); 193 #endif 194 195 /* this stuff is used by MORE and also now by the ctrl-S code; fileio.c only */ 196 #if (defined(UNZIP) && !defined(FUNZIP)) 197 # ifdef HAVE_WORKING_GETCH 198 # define FGETCH(f) getch() 199 # endif 200 # ifndef FGETCH 201 /* default for all systems where no getch()-like function is available */ 202 int zgetch OF((__GPRO__ int f)); 203 # define FGETCH(f) zgetch(__G__ f) 204 # endif 205 #endif /* UNZIP && !FUNZIP */ 206 207 #if (CRYPT && !defined(WINDLL)) 208 char *getp OF((__GPRO__ ZCONST char *m, char *p, int n)); 209 #endif 210 211 #else /* !(CRYPT || (UNZIP && !FUNZIP)) */ 212 213 /* 214 * No need for non-echo keyboard/console input; provide dummy definitions. 215 */ 216 #define echoff(f) 217 #define echon() 218 219 #endif /* ?(CRYPT || (UNZIP && !FUNZIP)) */ 220 221 #endif /* !__ttyio_h */ 222