1 1.1 simonb !lesstest! 2 1.1 simonb !version 1 3 1.1 simonb !created 2023-05-31 23:18:59 4 1.1 simonb E "LESS_TERMCAP_am" "1" 5 1.1 simonb E "LESS_TERMCAP_cd" "S" 6 1.1 simonb E "LESS_TERMCAP_ce" "L" 7 1.1 simonb E "LESS_TERMCAP_cl" "A" 8 1.1 simonb E "LESS_TERMCAP_cr" "<" 9 1.1 simonb E "LESS_TERMCAP_cm" "%p2%d;%p1%dj" 10 1.1 simonb E "LESS_TERMCAP_ho" "h" 11 1.1 simonb E "LESS_TERMCAP_ll" "l" 12 1.1 simonb E "LESS_TERMCAP_mb" "b" 13 1.1 simonb E "LESS_TERMCAP_md" "[1m" 14 1.1 simonb E "LESS_TERMCAP_me" "[m" 15 1.1 simonb E "LESS_TERMCAP_se" "[m" 16 1.1 simonb E "LESS_TERMCAP_so" "[7m" 17 1.1 simonb E "LESS_TERMCAP_sr" "r" 18 1.1 simonb E "LESS_TERMCAP_ue" "[24m" 19 1.1 simonb E "LESS_TERMCAP_us" "[4m" 20 1.1 simonb E "LESS_TERMCAP_vb" "g" 21 1.1 simonb E "LESS_TERMCAP_kr" "OC" 22 1.1 simonb E "LESS_TERMCAP_kl" "OD" 23 1.1 simonb E "LESS_TERMCAP_ku" "OA" 24 1.1 simonb E "LESS_TERMCAP_kd" "OB" 25 1.1 simonb E "LESS_TERMCAP_kh" "OH" 26 1.1 simonb E "LESS_TERMCAP_@7" "OF" 27 1.1 simonb E "COLUMNS" "95" 28 1.1 simonb E "LINES" "34" 29 1.1 simonb E "LANG" "C" 30 1.1 simonb T "subsearch" 31 1.1 simonb A "subsearch" 32 1.1 simonb F "subsearch" 65115 33 1.1 simonb /* 34 1.1 simonb * Copyright (C) 1984-2023 Mark Nudelman 35 1.1 simonb * 36 1.1 simonb * You may distribute under the terms of either the GNU General Public 37 1.1 simonb * License or the Less License, as specified in the README file. 38 1.1 simonb * 39 1.1 simonb * For more information, see the README file. 40 1.1 simonb */ 41 1.1 simonb 42 1.1 simonb 43 1.1 simonb /* 44 1.1 simonb * Routines which deal with the characteristics of the terminal. 45 1.1 simonb * Uses termcap to be as terminal-independent as possible. 46 1.1 simonb */ 47 1.1 simonb 48 1.1 simonb #include "less.h" 49 1.1 simonb #include "cmd.h" 50 1.1 simonb 51 1.1 simonb #if MSDOS_COMPILER 52 1.1 simonb #include "pckeys.h" 53 1.1 simonb #if MSDOS_COMPILER==MSOFTC 54 1.1 simonb #include <graph.h> 55 1.1 simonb #else 56 1.1 simonb #if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC 57 1.1 simonb #include <conio.h> 58 1.1 simonb #if MSDOS_COMPILER==DJGPPC 59 1.1 simonb #include <pc.h> 60 1.1 simonb extern int fd0; 61 1.1 simonb #endif 62 1.1 simonb #else 63 1.1 simonb #if MSDOS_COMPILER==WIN32C 64 1.1 simonb #include <windows.h> 65 1.1 simonb #endif 66 1.1 simonb #endif 67 1.1 simonb #endif 68 1.1 simonb #include <time.h> 69 1.1 simonb 70 1.1 simonb #ifndef FOREGROUND_BLUE 71 1.1 simonb #define FOREGROUND_BLUE 0x0001 72 1.1 simonb #endif 73 1.1 simonb #ifndef FOREGROUND_GREEN 74 1.1 simonb #define FOREGROUND_GREEN 0x0002 75 1.1 simonb #endif 76 1.1 simonb #ifndef FOREGROUND_RED 77 1.1 simonb #define FOREGROUND_RED 0x0004 78 1.1 simonb #endif 79 1.1 simonb #ifndef FOREGROUND_INTENSITY 80 1.1 simonb #define FOREGROUND_INTENSITY 0x0008 81 1.1 simonb #endif 82 1.1 simonb 83 1.1 simonb #else 84 1.1 simonb 85 1.1 simonb #if HAVE_SYS_IOCTL_H 86 1.1 simonb #include <sys/ioctl.h> 87 1.1 simonb #endif 88 1.1 simonb 89 1.1 simonb #if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS 90 1.1 simonb #include <termios.h> 91 1.1 simonb #else 92 1.1 simonb #if HAVE_TERMIO_H 93 1.1 simonb #include <termio.h> 94 1.1 simonb #else 95 1.1 simonb #if HAVE_SGSTAT_H 96 1.1 simonb #include <sgstat.h> 97 1.1 simonb #else 98 1.1 simonb #include <sgtty.h> 99 1.1 simonb #endif 100 1.1 simonb #endif 101 1.1 simonb #endif 102 1.1 simonb 103 1.1 simonb #if HAVE_NCURSESW_TERMCAP_H 104 1.1 simonb #include <ncursesw/termcap.h> 105 1.1 simonb #else 106 1.1 simonb #if HAVE_NCURSES_TERMCAP_H 107 1.1 simonb #include <ncurses/termcap.h> 108 1.1 simonb #else 109 1.1 simonb #if HAVE_TERMCAP_H 110 1.1 simonb #include <termcap.h> 111 1.1 simonb #endif 112 1.1 simonb #endif 113 1.1 simonb #endif 114 1.1 simonb #ifdef _OSK 115 1.1 simonb #include <signal.h> 116 1.1 simonb #endif 117 1.1 simonb #if OS2 118 1.1 simonb #include <sys/signal.h> 119 1.1 simonb #include "pckeys.h" 120 1.1 simonb #endif 121 1.1 simonb #if HAVE_SYS_STREAM_H 122 1.1 simonb #include <sys/stream.h> 123 1.1 simonb #endif 124 1.1 simonb #if HAVE_SYS_PTEM_H 125 1.1 simonb #include <sys/ptem.h> 126 1.1 simonb #endif 127 1.1 simonb 128 1.1 simonb #endif /* MSDOS_COMPILER */ 129 1.1 simonb 130 1.1 simonb /* 131 1.1 simonb * Check for broken termios package that forces you to manually 132 1.1 simonb * set the line discipline. 133 1.1 simonb */ 134 1.1 simonb #ifdef __ultrix__ 135 1.1 simonb #define MUST_SET_LINE_DISCIPLINE 1 136 1.1 simonb #else 137 1.1 simonb #define MUST_SET_LINE_DISCIPLINE 0 138 1.1 simonb #endif 139 1.1 simonb 140 1.1 simonb #if OS2 141 1.1 simonb #define DEFAULT_TERM "ansi" 142 1.1 simonb static char *windowid; 143 1.1 simonb #else 144 1.1 simonb #define DEFAULT_TERM "unknown" 145 1.1 simonb #endif 146 1.1 simonb 147 1.1 simonb #if MSDOS_COMPILER==MSOFTC 148 1.1 simonb static int videopages; 149 1.1 simonb static long msec_loops; 150 1.1 simonb static int flash_created = 0; 151 1.1 simonb #define SET_FG_COLOR(fg) _settextcolor(fg) 152 1.1 simonb #define SET_BG_COLOR(bg) _setbkcolor(bg) 153 1.1 simonb #define SETCOLORS(fg,bg) { SET_FG_COLOR(fg); SET_BG_COLOR(bg); } 154 1.1 simonb #endif 155 1.1 simonb 156 1.1 simonb #if MSDOS_COMPILER==BORLANDC 157 1.1 simonb static unsigned short *whitescreen; 158 1.1 simonb static int flash_created = 0; 159 1.1 simonb #endif 160 1.1 simonb #if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC 161 1.1 simonb #define _settextposition(y,x) gotoxy(x,y) 162 1.1 simonb #define _clearscreen(m) clrscr() 163 1.1 simonb #define _outtext(s) cputs(s) 164 1.1 simonb #define SET_FG_COLOR(fg) textcolor(fg) 165 1.1 simonb #define SET_BG_COLOR(bg) textbackground(bg) 166 1.1 simonb #define SETCOLORS(fg,bg) { SET_FG_COLOR(fg); SET_BG_COLOR(bg); } 167 1.1 simonb extern int sc_height; 168 1.1 simonb #endif 169 1.1 simonb 170 1.1 simonb #if MSDOS_COMPILER==WIN32C 171 1.1 simonb #define UTF8_MAX_LENGTH 4 172 1.1 simonb struct keyRecord 173 1.1 simonb { 174 1.1 simonb WCHAR unicode; 175 1.1 simonb int ascii; 176 1.1 simonb int scan; 177 1.1 simonb } currentKey; 178 1.1 simonb 179 1.1 simonb static int keyCount = 0; 180 1.1 simonb static WORD curr_attr; 181 1.1 simonb static int pending_scancode = 0; 182 1.1 simonb static char x11mousebuf[] = "[M???"; /* Mouse report, after ESC */ 183 1.1 simonb static int x11mousePos, x11mouseCount; 184 1.1 simonb 185 1.1 simonb static HANDLE con_out_save = INVALID_HANDLE_VALUE; /* previous console */ 186 1.1 simonb static HANDLE con_out_ours = INVALID_HANDLE_VALUE; /* our own */ 187 1.1 simonb HANDLE con_out = INVALID_HANDLE_VALUE; /* current console */ 188 1.1 simonb 189 1.1 simonb extern int utf_mode; 190 1.1 simonb extern int quitting; 191 1.1 simonb static void win32_init_term(); 192 1.1 simonb static void win32_deinit_term(); 193 1.1 simonb 194 1.1 simonb #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING 195 1.1 simonb #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 4 196 1.1 simonb #endif 197 1.1 simonb 198 1.1 simonb #define FG_COLORS (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY) 199 1.1 simonb #define BG_COLORS (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY) 200 1.1 simonb #define MAKEATTR(fg,bg) ((WORD)((fg)|((bg)<<4))) 201 1.1 simonb #define APPLY_COLORS() { if (SetConsoleTextAttribute(con_out, curr_attr) == 0) \ 202 1.1 simonb error("SETCOLORS failed", NULL_PARG); } 203 1.1 simonb #define SET_FG_COLOR(fg) { curr_attr |= (fg); APPLY_COLORS(); } 204 1.1 simonb #define SET_BG_COLOR(bg) { curr_attr |= ((bg)<<4); APPLY_COLORS(); } 205 1.1 simonb #define SETCOLORS(fg,bg) { curr_attr = MAKEATTR(fg,bg); APPLY_COLORS(); } 206 1.1 simonb #endif 207 1.1 simonb 208 1.1 simonb #if MSDOS_COMPILER 209 1.1 simonb public int nm_fg_color; /* Color of normal text */ 210 1.1 simonb public int nm_bg_color; 211 1.1 simonb public int bo_fg_color; /* Color of bold text */ 212 1.1 simonb public int bo_bg_color; 213 1.1 simonb public int ul_fg_color; /* Color of underlined text */ 214 1.1 simonb public int ul_bg_color; 215 1.1 simonb public int so_fg_color; /* Color of standout text */ 216 1.1 simonb public int so_bg_color; 217 1.1 simonb public int bl_fg_color; /* Color of blinking text */ 218 1.1 simonb public int bl_bg_color; 219 1.1 simonb static int sy_fg_color; /* Color of system text (before less) */ 220 1.1 simonb static int sy_bg_color; 221 1.1 simonb public int sgr_mode; /* Honor ANSI sequences rather than using above */ 222 1.1 simonb #if MSDOS_COMPILER==WIN32C 223 1.1 simonb static DWORD init_output_mode; /* The initial console output mode */ 224 1.1 simonb public int vt_enabled = -1; /* Is virtual terminal processing available? */ 225 1.1 simonb #endif 226 1.1 simonb #else 227 1.1 simonb 228 1.1 simonb /* 229 1.1 simonb * Strings passed to tputs() to do various terminal functions. 230 1.1 simonb */ 231 1.1 simonb static char 232 1.1 simonb *sc_pad, /* Pad string */ 233 1.1 simonb *sc_home, /* Cursor home */ 234 1.1 simonb *sc_addline, /* Add line, scroll down following lines */ 235 1.1 simonb *sc_lower_left, /* Cursor to last line, first column */ 236 1.1 simonb *sc_return, /* Cursor to beginning of current line */ 237 1.1 simonb *sc_move, /* General cursor positioning */ 238 1.1 simonb *sc_clear, /* Clear screen */ 239 1.1 simonb *sc_eol_clear, /* Clear to end of line */ 240 1.1 simonb *sc_eos_clear, /* Clear to end of screen */ 241 1.1 simonb *sc_s_in, /* Enter standout (highlighted) mode */ 242 1.1 simonb *sc_s_out, /* Exit standout mode */ 243 1.1 simonb *sc_u_in, /* Enter underline mode */ 244 1.1 simonb *sc_u_out, /* Exit underline mode */ 245 1.1 simonb *sc_b_in, /* Enter bold mode */ 246 1.1 simonb *sc_b_out, /* Exit bold mode */ 247 1.1 simonb *sc_bl_in, /* Enter blink mode */ 248 1.1 simonb *sc_bl_out, /* Exit blink mode */ 249 1.1 simonb *sc_visual_bell, /* Visual bell (flash screen) sequence */ 250 1.1 simonb *sc_backspace, /* Backspace cursor */ 251 1.1 simonb *sc_s_keypad, /* Start keypad mode */ 252 1.1 simonb *sc_e_keypad, /* End keypad mode */ 253 1.1 simonb *sc_s_mousecap, /* Start mouse capture mode */ 254 1.1 simonb *sc_e_mousecap, /* End mouse capture mode */ 255 1.1 simonb *sc_init, /* Startup terminal initialization */ 256 1.1 simonb *sc_deinit; /* Exit terminal de-initialization */ 257 1.1 simonb 258 1.1 simonb static int attrcolor = -1; 259 1.1 simonb #endif 260 1.1 simonb 261 1.1 simonb static int init_done = 0; 262 1.1 simonb 263 1.1 simonb public int auto_wrap; /* Terminal does \r\n when write past margin */ 264 1.1 simonb public int ignaw; /* Terminal ignores \n immediately after wrap */ 265 1.1 simonb public int erase_char; /* The user's erase char */ 266 1.1 simonb public int erase2_char; /* The user's other erase char */ 267 1.1 simonb public int kill_char; /* The user's line-kill char */ 268 1.1 simonb public int werase_char; /* The user's word-erase char */ 269 1.1 simonb public int sc_width, sc_height; /* Height & width of screen */ 270 1.1 simonb public int bo_s_width, bo_e_width; /* Printing width of boldface seq */ 271 1.1 simonb public int ul_s_width, ul_e_width; /* Printing width of underline seq */ 272 1.1 simonb public int so_s_width, so_e_width; /* Printing width of standout seq */ 273 1.1 simonb public int bl_s_width, bl_e_width; /* Printing width of blink seq */ 274 1.1 simonb public int above_mem, below_mem; /* Memory retained above/below screen */ 275 1.1 simonb public int can_goto_line; /* Can move cursor to any line */ 276 1.1 simonb public int clear_bg; /* Clear fills with background color */ 277 1.1 simonb public int missing_cap = 0; /* Some capability is missing */ 278 1.1 simonb public char *kent = NULL; /* Keypad ENTER sequence */ 279 1.1 simonb public int term_init_done = FALSE; 280 1.1 simonb public int full_screen = TRUE; 281 1.1 simonb 282 1.1 simonb static int attrmode = AT_NORMAL; 283 1.1 simonb static int termcap_debug = -1; 284 1.1 simonb static int no_alt_screen; /* sc_init does not switch to alt screen */ 285 1.1 simonb extern int binattr; 286 1.1 simonb extern int one_screen; 287 1.1 simonb #if LESSTEST 288 1.1 simonb extern char *ttyin_name; 289 1.1 simonb #endif /*LESSTEST*/ 290 1.1 simonb 291 1.1 simonb #if !MSDOS_COMPILER 292 1.1 simonb static char *cheaper(char *t1, char *t2, char *def); 293 1.1 simonb static void tmodes(char *incap, char *outcap, char **instr, 294 1.1 simonb char **outstr, char *def_instr, char *def_outstr, char **spp); 295 1.1 simonb #endif 296 1.1 simonb 297 1.1 simonb /* 298 1.1 simonb * These two variables are sometimes defined in, 299 1.1 simonb * and needed by, the termcap library. 300 1.1 simonb */ 301 1.1 simonb #if MUST_DEFINE_OSPEED 302 1.1 simonb extern short ospeed; /* Terminal output baud rate */ 303 1.1 simonb extern char PC; /* Pad character */ 304 1.1 simonb #endif 305 1.1 simonb #ifdef _OSK 306 1.1 simonb short ospeed; 307 1.1 simonb char PC_, *UP, *BC; 308 1.1 simonb #endif 309 1.1 simonb 310 1.1 simonb extern int quiet; /* If VERY_QUIET, use visual bell for bell */ 311 1.1 simonb extern int no_vbell; 312 1.1 simonb extern int no_back_scroll; 313 1.1 simonb extern int swindow; 314 1.1 simonb extern int no_init; 315 1.1 simonb extern int no_keypad; 316 1.1 simonb extern int sigs; 317 1.1 simonb extern int wscroll; 318 1.1 simonb extern int screen_trashed; 319 1.1 simonb extern int top_scroll; 320 1.1 simonb extern int quit_if_one_screen; 321 1.1 simonb extern int oldbot; 322 1.1 simonb extern int mousecap; 323 1.1 simonb extern int is_tty; 324 1.1 simonb extern int use_color; 325 1.1 simonb #if HILITE_SEARCH 326 1.1 simonb extern int hilite_search; 327 1.1 simonb #endif 328 1.1 simonb #if MSDOS_COMPILER==WIN32C 329 1.1 simonb extern HANDLE tty; 330 1.1 simonb extern DWORD console_mode; 331 1.1 simonb #ifndef ENABLE_EXTENDED_FLAGS 332 1.1 simonb #define ENABLE_EXTENDED_FLAGS 0x80 333 1.1 simonb #define ENABLE_QUICK_EDIT_MODE 0x40 334 1.1 simonb #endif 335 1.1 simonb #else 336 1.1 simonb extern int tty; 337 1.1 simonb #endif 338 1.1 simonb 339 1.1 simonb #if (HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS) || defined(TCGETA) 340 1.1 simonb /* 341 1.1 simonb * Set termio flags for use by less. 342 1.1 simonb */ 343 1.1 simonb static void set_termio_flags( 344 1.1 simonb #if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS 345 1.1 simonb struct termios *s 346 1.1 simonb #else 347 1.1 simonb struct termio *s 348 1.1 simonb #endif 349 1.1 simonb ) 350 1.1 simonb { 351 1.1 simonb s->c_lflag &= ~(0 352 1.1 simonb #ifdef ICANON 353 1.1 simonb | ICANON 354 1.1 simonb #endif 355 1.1 simonb #ifdef ECHO 356 1.1 simonb | ECHO 357 1.1 simonb #endif 358 1.1 simonb #ifdef ECHOE 359 1.1 simonb | ECHOE 360 1.1 simonb #endif 361 1.1 simonb #ifdef ECHOK 362 1.1 simonb | ECHOK 363 1.1 simonb #endif 364 1.1 simonb #if ECHONL 365 1.1 simonb | ECHONL 366 1.1 simonb #endif 367 1.1 simonb ); 368 1.1 simonb 369 1.1 simonb s->c_oflag |= (0 370 1.1 simonb #ifdef OXTABS 371 1.1 simonb | OXTABS 372 1.1 simonb #else 373 1.1 simonb #ifdef TAB3 374 1.1 simonb | TAB3 375 1.1 simonb #else 376 1.1 simonb #ifdef XTABS 377 1.1 simonb | XTABS 378 1.1 simonb #endif 379 1.1 simonb #endif 380 1.1 simonb #endif 381 1.1 simonb #ifdef OPOST 382 1.1 simonb | OPOST 383 1.1 simonb #endif 384 1.1 simonb #ifdef ONLCR 385 1.1 simonb | ONLCR 386 1.1 simonb #endif 387 1.1 simonb ); 388 1.1 simonb 389 1.1 simonb s->c_oflag &= ~(0 390 1.1 simonb #ifdef ONOEOT 391 1.1 simonb | ONOEOT 392 1.1 simonb #endif 393 1.1 simonb #ifdef OCRNL 394 1.1 simonb | OCRNL 395 1.1 simonb #endif 396 1.1 simonb #ifdef ONOCR 397 1.1 simonb | ONOCR 398 1.1 simonb #endif 399 1.1 simonb #ifdef ONLRET 400 1.1 simonb | ONLRET 401 1.1 simonb #endif 402 1.1 simonb ); 403 1.1 simonb } 404 1.1 simonb #endif 405 1.1 simonb 406 1.1 simonb /* 407 1.1 simonb * Change terminal to "raw mode", or restore to "normal" mode. 408 1.1 simonb * "Raw mode" means 409 1.1 simonb * 1. An outstanding read will complete on receipt of a single keystroke. 410 1.1 simonb * 2. Input is not echoed. 411 1.1 simonb * 3. On output, \n is mapped to \r\n. 412 1.1 simonb * 4. \t is NOT expanded into spaces. 413 1.1 simonb * 5. Signal-causing characters such as ctrl-C (interrupt), 414 1.1 simonb * etc. are NOT disabled. 415 1.1 simonb * It doesn't matter whether an input \n is mapped to \r, or vice versa. 416 1.1 simonb */ 417 1.1 simonb public void raw_mode(int on) 418 1.1 simonb { 419 1.1 simonb static int curr_on = 0; 420 1.1 simonb 421 1.1 simonb if (on == curr_on) 422 1.1 simonb return; 423 1.1 simonb erase2_char = '\b'; /* in case OS doesn't know about erase2 */ 424 1.1 simonb #if LESSTEST 425 1.1 simonb if (ttyin_name != NULL) 426 1.1 simonb { 427 1.1 simonb /* {{ For consistent conditions when running tests. }} */ 428 1.1 simonb erase_char = '\b'; 429 1.1 simonb kill_char = CONTROL('U'); 430 1.1 simonb werase_char = CONTROL('W'); 431 1.1 simonb } else 432 1.1 simonb #endif /*LESSTEST*/ 433 1.1 simonb #if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS 434 1.1 simonb { 435 1.1 simonb struct termios s; 436 1.1 simonb static struct termios save_term; 437 1.1 simonb static int saved_term = 0; 438 1.1 simonb 439 1.1 simonb if (on) 440 1.1 simonb { 441 1.1 simonb /* 442 1.1 simonb * Get terminal modes. 443 1.1 simonb */ 444 1.1 simonb if (tcgetattr(tty, &s) < 0) 445 1.1 simonb { 446 1.1 simonb erase_char = '\b'; 447 1.1 simonb kill_char = CONTROL('U'); 448 1.1 simonb werase_char = CONTROL('W'); 449 1.1 simonb } else 450 1.1 simonb { 451 1.1 simonb /* 452 1.1 simonb * Save modes and set certain variables dependent on modes. 453 1.1 simonb */ 454 1.1 simonb if (!saved_term) 455 1.1 simonb { 456 1.1 simonb save_term = s; 457 1.1 simonb saved_term = 1; 458 1.1 simonb } 459 1.1 simonb #if HAVE_OSPEED 460 1.1 simonb switch (cfgetospeed(&s)) 461 1.1 simonb { 462 1.1 simonb #ifdef B0 463 1.1 simonb case B0: ospeed = 0; break; 464 1.1 simonb #endif 465 1.1 simonb #ifdef B50 466 1.1 simonb case B50: ospeed = 1; break; 467 1.1 simonb #endif 468 1.1 simonb #ifdef B75 469 1.1 simonb case B75: ospeed = 2; break; 470 1.1 simonb #endif 471 1.1 simonb #ifdef B110 472 1.1 simonb case B110: ospeed = 3; break; 473 1.1 simonb #endif 474 1.1 simonb #ifdef B134 475 1.1 simonb case B134: ospeed = 4; break; 476 1.1 simonb #endif 477 1.1 simonb #ifdef B150 478 1.1 simonb case B150: ospeed = 5; break; 479 1.1 simonb #endif 480 1.1 simonb #ifdef B200 481 1.1 simonb case B200: ospeed = 6; break; 482 1.1 simonb #endif 483 1.1 simonb #ifdef B300 484 1.1 simonb case B300: ospeed = 7; break; 485 1.1 simonb #endif 486 1.1 simonb #ifdef B600 487 1.1 simonb case B600: ospeed = 8; break; 488 1.1 simonb #endif 489 1.1 simonb #ifdef B1200 490 1.1 simonb case B1200: ospeed = 9; break; 491 1.1 simonb #endif 492 1.1 simonb #ifdef B1800 493 1.1 simonb case B1800: ospeed = 10; break; 494 1.1 simonb #endif 495 1.1 simonb #ifdef B2400 496 1.1 simonb case B2400: ospeed = 11; break; 497 1.1 simonb #endif 498 1.1 simonb #ifdef B4800 499 1.1 simonb case B4800: ospeed = 12; break; 500 1.1 simonb #endif 501 1.1 simonb #ifdef B9600 502 1.1 simonb case B9600: ospeed = 13; break; 503 1.1 simonb #endif 504 1.1 simonb #ifdef EXTA 505 1.1 simonb case EXTA: ospeed = 14; break; 506 1.1 simonb #endif 507 1.1 simonb #ifdef EXTB 508 1.1 simonb case EXTB: ospeed = 15; break; 509 1.1 simonb #endif 510 1.1 simonb #ifdef B57600 511 1.1 simonb case B57600: ospeed = 16; break; 512 1.1 simonb #endif 513 1.1 simonb #ifdef B115200 514 1.1 simonb case B115200: ospeed = 17; break; 515 1.1 simonb #endif 516 1.1 simonb default: ; 517 1.1 simonb } 518 1.1 simonb #endif 519 1.1 simonb erase_char = s.c_cc[VERASE]; 520 1.1 simonb #ifdef VERASE2 521 1.1 simonb erase2_char = s.c_cc[VERASE2]; 522 1.1 simonb #endif 523 1.1 simonb kill_char = s.c_cc[VKILL]; 524 1.1 simonb #ifdef VWERASE 525 1.1 simonb werase_char = s.c_cc[VWERASE]; 526 1.1 simonb #else 527 1.1 simonb werase_char = CONTROL('W'); 528 1.1 simonb #endif 529 1.1 simonb 530 1.1 simonb /* 531 1.1 simonb * Set the modes to the way we want them. 532 1.1 simonb */ 533 1.1 simonb set_termio_flags(&s); 534 1.1 simonb s.c_cc[VMIN] = 1; 535 1.1 simonb s.c_cc[VTIME] = 0; 536 1.1 simonb #ifdef VLNEXT 537 1.1 simonb s.c_cc[VLNEXT] = 0; 538 1.1 simonb #endif 539 1.1 simonb #ifdef VDSUSP 540 1.1 simonb s.c_cc[VDSUSP] = 0; 541 1.1 simonb #endif 542 1.1 simonb #ifdef VSTOP 543 1.1 simonb s.c_cc[VSTOP] = 0; 544 1.1 simonb #endif 545 1.1 simonb #ifdef VSTART 546 1.1 simonb s.c_cc[VSTART] = 0; 547 1.1 simonb #endif 548 1.1 simonb #if MUST_SET_LINE_DISCIPLINE 549 1.1 simonb /* 550 1.1 simonb * System's termios is broken; need to explicitly 551 1.1 simonb * request TERMIODISC line discipline. 552 1.1 simonb */ 553 1.1 simonb s.c_line = TERMIODISC; 554 1.1 simonb #endif 555 1.1 simonb } 556 1.1 simonb } else 557 1.1 simonb { 558 1.1 simonb /* 559 1.1 simonb * Restore saved modes. 560 1.1 simonb */ 561 1.1 simonb s = save_term; 562 1.1 simonb } 563 1.1 simonb #if HAVE_FSYNC 564 1.1 simonb fsync(tty); 565 1.1 simonb #endif 566 1.1 simonb tcsetattr(tty, TCSADRAIN, &s); 567 1.1 simonb #if MUST_SET_LINE_DISCIPLINE 568 1.1 simonb if (!on) 569 1.1 simonb { 570 1.1 simonb /* 571 1.1 simonb * Broken termios *ignores* any line discipline 572 1.1 simonb * except TERMIODISC. A different old line discipline 573 1.1 simonb * is therefore not restored, yet. Restore the old 574 1.1 simonb * line discipline by hand. 575 1.1 simonb */ 576 1.1 simonb ioctl(tty, TIOCSETD, &save_term.c_line); 577 1.1 simonb } 578 1.1 simonb #endif 579 1.1 simonb } 580 1.1 simonb #else 581 1.1 simonb #ifdef TCGETA 582 1.1 simonb { 583 1.1 simonb struct termio s; 584 1.1 simonb static struct termio save_term; 585 1.1 simonb static int saved_term = 0; 586 1.1 simonb 587 1.1 simonb if (on) 588 1.1 simonb { 589 1.1 simonb /* 590 1.1 simonb * Get terminal modes. 591 1.1 simonb */ 592 1.1 simonb ioctl(tty, TCGETA, &s); 593 1.1 simonb 594 1.1 simonb /* 595 1.1 simonb * Save modes and set certain variables dependent on modes. 596 1.1 simonb */ 597 1.1 simonb if (!saved_term) 598 1.1 simonb { 599 1.1 simonb save_term = s; 600 1.1 simonb saved_term = 1; 601 1.1 simonb } 602 1.1 simonb #if HAVE_OSPEED 603 1.1 simonb ospeed = s.c_cflag & CBAUD; 604 1.1 simonb #endif 605 1.1 simonb erase_char = s.c_cc[VERASE]; 606 1.1 simonb kill_char = s.c_cc[VKILL]; 607 1.1 simonb #ifdef VWERASE 608 1.1 simonb werase_char = s.c_cc[VWERASE]; 609 1.1 simonb #else 610 1.1 simonb werase_char = CONTROL('W'); 611 1.1 simonb #endif 612 1.1 simonb 613 1.1 simonb /* 614 1.1 simonb * Set the modes to the way we want them. 615 1.1 simonb */ 616 1.1 simonb set_termio_flags(&s); 617 1.1 simonb s.c_cc[VMIN] = 1; 618 1.1 simonb s.c_cc[VTIME] = 0; 619 1.1 simonb #ifdef VSTOP 620 1.1 simonb s.c_cc[VSTOP] = 0; 621 1.1 simonb #endif 622 1.1 simonb #ifdef VSTART 623 1.1 simonb s.c_cc[VSTART] = 0; 624 1.1 simonb #endif 625 1.1 simonb } else 626 1.1 simonb { 627 1.1 simonb /* 628 1.1 simonb * Restore saved modes. 629 1.1 simonb */ 630 1.1 simonb s = save_term; 631 1.1 simonb } 632 1.1 simonb ioctl(tty, TCSETAW, &s); 633 1.1 simonb } 634 1.1 simonb #else 635 1.1 simonb #ifdef TIOCGETP 636 1.1 simonb { 637 1.1 simonb struct sgttyb s; 638 1.1 simonb static struct sgttyb save_term; 639 1.1 simonb static int saved_term = 0; 640 1.1 simonb 641 1.1 simonb if (on) 642 1.1 simonb { 643 1.1 simonb /* 644 1.1 simonb * Get terminal modes. 645 1.1 simonb */ 646 1.1 simonb ioctl(tty, TIOCGETP, &s); 647 1.1 simonb 648 1.1 simonb /* 649 1.1 simonb * Save modes and set certain variables dependent on modes. 650 1.1 simonb */ 651 1.1 simonb if (!saved_term) 652 1.1 simonb { 653 1.1 simonb save_term = s; 654 1.1 simonb saved_term = 1; 655 1.1 simonb } 656 1.1 simonb #if HAVE_OSPEED 657 1.1 simonb ospeed = s.sg_ospeed; 658 1.1 simonb #endif 659 1.1 simonb erase_char = s.sg_erase; 660 1.1 simonb kill_char = s.sg_kill; 661 1.1 simonb werase_char = CONTROL('W'); 662 1.1 simonb 663 1.1 simonb /* 664 1.1 simonb * Set the modes to the way we want them. 665 1.1 simonb */ 666 1.1 simonb s.sg_flags |= CBREAK; 667 1.1 simonb s.sg_flags &= ~(ECHO|XTABS); 668 1.1 simonb } else 669 1.1 simonb { 670 1.1 simonb /* 671 1.1 simonb * Restore saved modes. 672 1.1 simonb */ 673 1.1 simonb s = save_term; 674 1.1 simonb } 675 1.1 simonb ioctl(tty, TIOCSETN, &s); 676 1.1 simonb } 677 1.1 simonb #else 678 1.1 simonb #ifdef _OSK 679 1.1 simonb { 680 1.1 simonb struct sgbuf s; 681 1.1 simonb static struct sgbuf save_term; 682 1.1 simonb static int saved_term = 0; 683 1.1 simonb 684 1.1 simonb if (on) 685 1.1 simonb { 686 1.1 simonb /* 687 1.1 simonb * Get terminal modes. 688 1.1 simonb */ 689 1.1 simonb _gs_opt(tty, &s); 690 1.1 simonb 691 1.1 simonb /* 692 1.1 simonb * Save modes and set certain variables dependent on modes. 693 1.1 simonb */ 694 1.1 simonb if (!saved_term) 695 1.1 simonb { 696 1.1 simonb save_term = s; 697 1.1 simonb saved_term = 1; 698 1.1 simonb } 699 1.1 simonb erase_char = s.sg_bspch; 700 1.1 simonb kill_char = s.sg_dlnch; 701 1.1 simonb werase_char = CONTROL('W'); 702 1.1 simonb 703 1.1 simonb /* 704 1.1 simonb * Set the modes to the way we want them. 705 1.1 simonb */ 706 1.1 simonb s.sg_echo = 0; 707 1.1 simonb s.sg_eofch = 0; 708 1.1 simonb s.sg_pause = 0; 709 1.1 simonb s.sg_psch = 0; 710 1.1 simonb } else 711 1.1 simonb { 712 1.1 simonb /* 713 1.1 simonb * Restore saved modes. 714 1.1 simonb */ 715 1.1 simonb s = save_term; 716 1.1 simonb } 717 1.1 simonb _ss_opt(tty, &s); 718 1.1 simonb } 719 1.1 simonb #else 720 1.1 simonb /* MS-DOS, Windows, or OS2 */ 721 1.1 simonb #if OS2 722 1.1 simonb /* OS2 */ 723 1.1 simonb LSIGNAL(SIGINT, SIG_IGN); 724 1.1 simonb #endif 725 1.1 simonb erase_char = '\b'; 726 1.1 simonb #if MSDOS_COMPILER==DJGPPC 727 1.1 simonb kill_char = CONTROL('U'); 728 1.1 simonb /* 729 1.1 simonb * So that when we shell out or run another program, its 730 1.1 simonb * stdin is in cooked mode. We do not switch stdin to binary 731 1.1 simonb * mode if fd0 is zero, since that means we were called before 732 1.1 simonb * tty was reopened in open_getchr, in which case we would be 733 1.1 simonb * changing the original stdin device outside less. 734 1.1 simonb */ 735 1.1 simonb if (fd0 != 0) 736 1.1 simonb setmode(0, on ? O_BINARY : O_TEXT); 737 1.1 simonb #else 738 1.1 simonb kill_char = ESC; 739 1.1 simonb #endif 740 1.1 simonb werase_char = CONTROL('W'); 741 1.1 simonb #endif 742 1.1 simonb #endif 743 1.1 simonb #endif 744 1.1 simonb #endif 745 1.1 simonb curr_on = on; 746 1.1 simonb } 747 1.1 simonb 748 1.1 simonb #if !MSDOS_COMPILER 749 1.1 simonb /* 750 1.1 simonb * Some glue to prevent calling termcap functions if tgetent() failed. 751 1.1 simonb */ 752 1.1 simonb static int hardcopy; 753 1.1 simonb 754 1.1 simonb static char * ltget_env(char *capname) 755 1.1 simonb { 756 1.1 simonb char name[64]; 757 1.1 simonb 758 1.1 simonb if (termcap_debug) 759 1.1 simonb { 760 1.1 simonb struct env { struct env *next; char *name; char *value; }; 761 1.1 simonb static struct env *envs = NULL; 762 1.1 simonb struct env *p; 763 1.1 simonb for (p = envs; p != NULL; p = p->next) 764 1.1 simonb if (strcmp(p->name, capname) == 0) 765 1.1 simonb return p->value; 766 1.1 simonb p = (struct env *) ecalloc(1, sizeof(struct env)); 767 1.1 simonb p->name = save(capname); 768 1.1 simonb p->value = (char *) ecalloc(strlen(capname)+3, sizeof(char)); 769 1.1 simonb sprintf(p->value, "<%s>", capname); 770 1.1 simonb p->next = envs; 771 1.1 simonb envs = p; 772 1.1 simonb return p->value; 773 1.1 simonb } 774 1.1 simonb SNPRINTF1(name, sizeof(name), "LESS_TERMCAP_%s", capname); 775 1.1 simonb return (lgetenv(name)); 776 1.1 simonb } 777 1.1 simonb 778 1.1 simonb static int ltgetflag(char *capname) 779 1.1 simonb { 780 1.1 simonb char *s; 781 1.1 simonb 782 1.1 simonb if ((s = ltget_env(capname)) != NULL) 783 1.1 simonb return (*s != '\0' && *s != '0'); 784 1.1 simonb if (hardcopy) 785 1.1 simonb return (0); 786 1.1 simonb return (tgetflag(capname)); 787 1.1 simonb } 788 1.1 simonb 789 1.1 simonb static int ltgetnum(char *capname) 790 1.1 simonb { 791 1.1 simonb char *s; 792 1.1 simonb 793 1.1 simonb if ((s = ltget_env(capname)) != NULL) 794 1.1 simonb return (atoi(s)); 795 1.1 simonb if (hardcopy) 796 1.1 simonb return (-1); 797 1.1 simonb return (tgetnum(capname)); 798 1.1 simonb } 799 1.1 simonb 800 1.1 simonb static char * ltgetstr(char *capname, char **pp) 801 1.1 simonb { 802 1.1 simonb char *s; 803 1.1 simonb 804 1.1 simonb if ((s = ltget_env(capname)) != NULL) 805 1.1 simonb return (s); 806 1.1 simonb if (hardcopy) 807 1.1 simonb return (NULL); 808 1.1 simonb return (tgetstr(capname, pp)); 809 1.1 simonb } 810 1.1 simonb #endif /* MSDOS_COMPILER */ 811 1.1 simonb 812 1.1 simonb /* 813 1.1 simonb * Get size of the output screen. 814 1.1 simonb */ 815 1.1 simonb public void scrsize(void) 816 1.1 simonb { 817 1.1 simonb char *s; 818 1.1 simonb int sys_height; 819 1.1 simonb int sys_width; 820 1.1 simonb #if !MSDOS_COMPILER 821 1.1 simonb int n; 822 1.1 simonb #endif 823 1.1 simonb 824 1.1 simonb #define DEF_SC_WIDTH 80 825 1.1 simonb #if MSDOS_COMPILER 826 1.1 simonb #define DEF_SC_HEIGHT 25 827 1.1 simonb #else 828 1.1 simonb #define DEF_SC_HEIGHT 24 829 1.1 simonb #endif 830 1.1 simonb 831 1.1 simonb 832 1.1 simonb sys_width = sys_height = 0; 833 1.1 simonb 834 1.1 simonb #if LESSTEST 835 1.1 simonb if (ttyin_name != NULL) 836 1.1 simonb #endif /*LESSTEST*/ 837 1.1 simonb { 838 1.1 simonb #if MSDOS_COMPILER==MSOFTC 839 1.1 simonb { 840 1.1 simonb struct videoconfig w; 841 1.1 simonb _getvideoconfig(&w); 842 1.1 simonb sys_height = w.numtextrows; 843 1.1 simonb sys_width = w.numtextcols; 844 1.1 simonb } 845 1.1 simonb #else 846 1.1 simonb #if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC 847 1.1 simonb { 848 1.1 simonb struct text_info w; 849 1.1 simonb gettextinfo(&w); 850 1.1 simonb sys_height = w.screenheight; 851 1.1 simonb sys_width = w.screenwidth; 852 1.1 simonb } 853 1.1 simonb #else 854 1.1 simonb #if MSDOS_COMPILER==WIN32C 855 1.1 simonb { 856 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO scr; 857 1.1 simonb GetConsoleScreenBufferInfo(con_out, &scr); 858 1.1 simonb sys_height = scr.srWindow.Bottom - scr.srWindow.Top + 1; 859 1.1 simonb sys_width = scr.srWindow.Right - scr.srWindow.Left + 1; 860 1.1 simonb } 861 1.1 simonb #else 862 1.1 simonb #if OS2 863 1.1 simonb { 864 1.1 simonb int s[2]; 865 1.1 simonb _scrsize(s); 866 1.1 simonb sys_width = s[0]; 867 1.1 simonb sys_height = s[1]; 868 1.1 simonb /* 869 1.1 simonb * When using terminal emulators for XFree86/OS2, the 870 1.1 simonb * _scrsize function does not work well. 871 1.1 simonb * Call the scrsize.exe program to get the window size. 872 1.1 simonb */ 873 1.1 simonb windowid = getenv("WINDOWID"); 874 1.1 simonb if (windowid != NULL) 875 1.1 simonb { 876 1.1 simonb FILE *fd = popen("scrsize", "rt"); 877 1.1 simonb if (fd != NULL) 878 1.1 simonb { 879 1.1 simonb int w, h; 880 1.1 simonb fscanf(fd, "%i %i", &w, &h); 881 1.1 simonb if (w > 0 && h > 0) 882 1.1 simonb { 883 1.1 simonb sys_width = w; 884 1.1 simonb sys_height = h; 885 1.1 simonb } 886 1.1 simonb pclose(fd); 887 1.1 simonb } 888 1.1 simonb } 889 1.1 simonb } 890 1.1 simonb #else 891 1.1 simonb #ifdef TIOCGWINSZ 892 1.1 simonb { 893 1.1 simonb struct winsize w; 894 1.1 simonb if (ioctl(2, TIOCGWINSZ, &w) == 0) 895 1.1 simonb { 896 1.1 simonb if (w.ws_row > 0) 897 1.1 simonb sys_height = w.ws_row; 898 1.1 simonb if (w.ws_col > 0) 899 1.1 simonb sys_width = w.ws_col; 900 1.1 simonb } 901 1.1 simonb } 902 1.1 simonb #else 903 1.1 simonb #ifdef WIOCGETD 904 1.1 simonb { 905 1.1 simonb struct uwdata w; 906 1.1 simonb if (ioctl(2, WIOCGETD, &w) == 0) 907 1.1 simonb { 908 1.1 simonb if (w.uw_height > 0) 909 1.1 simonb sys_height = w.uw_height / w.uw_vs; 910 1.1 simonb if (w.uw_width > 0) 911 1.1 simonb sys_width = w.uw_width / w.uw_hs; 912 1.1 simonb } 913 1.1 simonb } 914 1.1 simonb #endif 915 1.1 simonb #endif 916 1.1 simonb #endif 917 1.1 simonb #endif 918 1.1 simonb #endif 919 1.1 simonb #endif 920 1.1 simonb } 921 1.1 simonb 922 1.1 simonb if (sys_height > 0) 923 1.1 simonb sc_height = sys_height; 924 1.1 simonb else if ((s = lgetenv("LINES")) != NULL) 925 1.1 simonb sc_height = atoi(s); 926 1.1 simonb #if !MSDOS_COMPILER 927 1.1 simonb else if ((n = ltgetnum("li")) > 0) 928 1.1 simonb sc_height = n; 929 1.1 simonb #endif 930 1.1 simonb if ((s = lgetenv("LESS_LINES")) != NULL) 931 1.1 simonb { 932 1.1 simonb int height = atoi(s); 933 1.1 simonb sc_height = (height < 0) ? sc_height + height : height; 934 1.1 simonb full_screen = FALSE; 935 1.1 simonb } 936 1.1 simonb if (sc_height <= 0) 937 1.1 simonb sc_height = DEF_SC_HEIGHT; 938 1.1 simonb 939 1.1 simonb if (sys_width > 0) 940 1.1 simonb sc_width = sys_width; 941 1.1 simonb else if ((s = lgetenv("COLUMNS")) != NULL) 942 1.1 simonb sc_width = atoi(s); 943 1.1 simonb #if !MSDOS_COMPILER 944 1.1 simonb else if ((n = ltgetnum("co")) > 0) 945 1.1 simonb sc_width = n; 946 1.1 simonb #endif 947 1.1 simonb if ((s = lgetenv("LESS_COLUMNS")) != NULL) 948 1.1 simonb { 949 1.1 simonb int width = atoi(s); 950 1.1 simonb sc_width = (width < 0) ? sc_width + width : width; 951 1.1 simonb } 952 1.1 simonb if (sc_width <= 0) 953 1.1 simonb sc_width = DEF_SC_WIDTH; 954 1.1 simonb } 955 1.1 simonb 956 1.1 simonb #if MSDOS_COMPILER==MSOFTC 957 1.1 simonb /* 958 1.1 simonb * Figure out how many empty loops it takes to delay a millisecond. 959 1.1 simonb */ 960 1.1 simonb static void get_clock(void) 961 1.1 simonb { 962 1.1 simonb clock_t start; 963 1.1 simonb 964 1.1 simonb /* 965 1.1 simonb * Get synchronized at the start of a tick. 966 1.1 simonb */ 967 1.1 simonb start = clock(); 968 1.1 simonb while (clock() == start) 969 1.1 simonb ; 970 1.1 simonb /* 971 1.1 simonb * Now count loops till the next tick. 972 1.1 simonb */ 973 1.1 simonb start = clock(); 974 1.1 simonb msec_loops = 0; 975 1.1 simonb while (clock() == start) 976 1.1 simonb msec_loops++; 977 1.1 simonb /* 978 1.1 simonb * Convert from (loops per clock) to (loops per millisecond). 979 1.1 simonb */ 980 1.1 simonb msec_loops *= CLOCKS_PER_SEC; 981 1.1 simonb msec_loops /= 1000; 982 1.1 simonb } 983 1.1 simonb 984 1.1 simonb /* 985 1.1 simonb * Delay for a specified number of milliseconds. 986 1.1 simonb */ 987 1.1 simonb static void delay(int msec) 988 1.1 simonb { 989 1.1 simonb long i; 990 1.1 simonb 991 1.1 simonb while (msec-- > 0) 992 1.1 simonb { 993 1.1 simonb for (i = 0; i < msec_loops; i++) 994 1.1 simonb (void) clock(); 995 1.1 simonb } 996 1.1 simonb } 997 1.1 simonb #endif 998 1.1 simonb 999 1.1 simonb /* 1000 1.1 simonb * Return the characters actually input by a "special" key. 1001 1.1 simonb */ 1002 1.1 simonb public char * special_key_str(int key) 1003 1.1 simonb { 1004 1.1 simonb static char tbuf[40]; 1005 1.1 simonb char *s; 1006 1.1 simonb #if MSDOS_COMPILER || OS2 1007 1.1 simonb static char k_right[] = { '\340', PCK_RIGHT, 0 }; 1008 1.1 simonb static char k_left[] = { '\340', PCK_LEFT, 0 }; 1009 1.1 simonb static char k_ctl_right[] = { '\340', PCK_CTL_RIGHT, 0 }; 1010 1.1 simonb static char k_ctl_left[] = { '\340', PCK_CTL_LEFT, 0 }; 1011 1.1 simonb static char k_insert[] = { '\340', PCK_INSERT, 0 }; 1012 1.1 simonb static char k_delete[] = { '\340', PCK_DELETE, 0 }; 1013 1.1 simonb static char k_ctl_delete[] = { '\340', PCK_CTL_DELETE, 0 }; 1014 1.1 simonb static char k_ctl_backspace[] = { '\177', 0 }; 1015 1.1 simonb static char k_backspace[] = { '\b', 0 }; 1016 1.1 simonb static char k_home[] = { '\340', PCK_HOME, 0 }; 1017 1.1 simonb static char k_end[] = { '\340', PCK_END, 0 }; 1018 1.1 simonb static char k_up[] = { '\340', PCK_UP, 0 }; 1019 1.1 simonb static char k_down[] = { '\340', PCK_DOWN, 0 }; 1020 1.1 simonb static char k_backtab[] = { '\340', PCK_SHIFT_TAB, 0 }; 1021 1.1 simonb static char k_pagedown[] = { '\340', PCK_PAGEDOWN, 0 }; 1022 1.1 simonb static char k_pageup[] = { '\340', PCK_PAGEUP, 0 }; 1023 1.1 simonb static char k_f1[] = { '\340', PCK_F1, 0 }; 1024 1.1 simonb #endif 1025 1.1 simonb #if !MSDOS_COMPILER 1026 1.1 simonb char *sp = tbuf; 1027 1.1 simonb #endif 1028 1.1 simonb 1029 1.1 simonb switch (key) 1030 1.1 simonb { 1031 1.1 simonb #if OS2 1032 1.1 simonb /* 1033 1.1 simonb * If windowid is not NULL, assume less is executed in 1034 1.1 simonb * the XFree86 environment. 1035 1.1 simonb */ 1036 1.1 simonb case SK_RIGHT_ARROW: 1037 1.1 simonb s = windowid ? ltgetstr("kr", &sp) : k_right; 1038 1.1 simonb break; 1039 1.1 simonb case SK_LEFT_ARROW: 1040 1.1 simonb s = windowid ? ltgetstr("kl", &sp) : k_left; 1041 1.1 simonb break; 1042 1.1 simonb case SK_UP_ARROW: 1043 1.1 simonb s = windowid ? ltgetstr("ku", &sp) : k_up; 1044 1.1 simonb break; 1045 1.1 simonb case SK_DOWN_ARROW: 1046 1.1 simonb s = windowid ? ltgetstr("kd", &sp) : k_down; 1047 1.1 simonb break; 1048 1.1 simonb case SK_PAGE_UP: 1049 1.1 simonb s = windowid ? ltgetstr("kP", &sp) : k_pageup; 1050 1.1 simonb break; 1051 1.1 simonb case SK_PAGE_DOWN: 1052 1.1 simonb s = windowid ? ltgetstr("kN", &sp) : k_pagedown; 1053 1.1 simonb break; 1054 1.1 simonb case SK_HOME: 1055 1.1 simonb s = windowid ? ltgetstr("kh", &sp) : k_home; 1056 1.1 simonb break; 1057 1.1 simonb case SK_END: 1058 1.1 simonb s = windowid ? ltgetstr("@7", &sp) : k_end; 1059 1.1 simonb break; 1060 1.1 simonb case SK_DELETE: 1061 1.1 simonb s = windowid ? ltgetstr("kD", &sp) : k_delete; 1062 1.1 simonb if (s == NULL) 1063 1.1 simonb { 1064 1.1 simonb tbuf[0] = '\177'; 1065 1.1 simonb tbuf[1] = '\0'; 1066 1.1 simonb s = tbuf; 1067 1.1 simonb } 1068 1.1 simonb break; 1069 1.1 simonb #endif 1070 1.1 simonb #if MSDOS_COMPILER 1071 1.1 simonb case SK_RIGHT_ARROW: 1072 1.1 simonb s = k_right; 1073 1.1 simonb break; 1074 1.1 simonb case SK_LEFT_ARROW: 1075 1.1 simonb s = k_left; 1076 1.1 simonb break; 1077 1.1 simonb case SK_UP_ARROW: 1078 1.1 simonb s = k_up; 1079 1.1 simonb break; 1080 1.1 simonb case SK_DOWN_ARROW: 1081 1.1 simonb s = k_down; 1082 1.1 simonb break; 1083 1.1 simonb case SK_PAGE_UP: 1084 1.1 simonb s = k_pageup; 1085 1.1 simonb break; 1086 1.1 simonb case SK_PAGE_DOWN: 1087 1.1 simonb s = k_pagedown; 1088 1.1 simonb break; 1089 1.1 simonb case SK_HOME: 1090 1.1 simonb s = k_home; 1091 1.1 simonb break; 1092 1.1 simonb case SK_END: 1093 1.1 simonb s = k_end; 1094 1.1 simonb break; 1095 1.1 simonb case SK_DELETE: 1096 1.1 simonb s = k_delete; 1097 1.1 simonb break; 1098 1.1 simonb #endif 1099 1.1 simonb #if MSDOS_COMPILER || OS2 1100 1.1 simonb case SK_INSERT: 1101 1.1 simonb s = k_insert; 1102 1.1 simonb break; 1103 1.1 simonb case SK_CTL_LEFT_ARROW: 1104 1.1 simonb s = k_ctl_left; 1105 1.1 simonb break; 1106 1.1 simonb case SK_CTL_RIGHT_ARROW: 1107 1.1 simonb s = k_ctl_right; 1108 1.1 simonb break; 1109 1.1 simonb case SK_CTL_BACKSPACE: 1110 1.1 simonb s = k_ctl_backspace; 1111 1.1 simonb break; 1112 1.1 simonb case SK_CTL_DELETE: 1113 1.1 simonb s = k_ctl_delete; 1114 1.1 simonb break; 1115 1.1 simonb case SK_BACKSPACE: 1116 1.1 simonb s = k_backspace; 1117 1.1 simonb break; 1118 1.1 simonb case SK_F1: 1119 1.1 simonb s = k_f1; 1120 1.1 simonb break; 1121 1.1 simonb case SK_BACKTAB: 1122 1.1 simonb s = k_backtab; 1123 1.1 simonb break; 1124 1.1 simonb #else 1125 1.1 simonb case SK_RIGHT_ARROW: 1126 1.1 simonb s = ltgetstr("kr", &sp); 1127 1.1 simonb break; 1128 1.1 simonb case SK_LEFT_ARROW: 1129 1.1 simonb s = ltgetstr("kl", &sp); 1130 1.1 simonb break; 1131 1.1 simonb case SK_UP_ARROW: 1132 1.1 simonb s = ltgetstr("ku", &sp); 1133 1.1 simonb break; 1134 1.1 simonb case SK_DOWN_ARROW: 1135 1.1 simonb s = ltgetstr("kd", &sp); 1136 1.1 simonb break; 1137 1.1 simonb case SK_PAGE_UP: 1138 1.1 simonb s = ltgetstr("kP", &sp); 1139 1.1 simonb break; 1140 1.1 simonb case SK_PAGE_DOWN: 1141 1.1 simonb s = ltgetstr("kN", &sp); 1142 1.1 simonb break; 1143 1.1 simonb case SK_HOME: 1144 1.1 simonb s = ltgetstr("kh", &sp); 1145 1.1 simonb break; 1146 1.1 simonb case SK_END: 1147 1.1 simonb s = ltgetstr("@7", &sp); 1148 1.1 simonb break; 1149 1.1 simonb case SK_DELETE: 1150 1.1 simonb s = ltgetstr("kD", &sp); 1151 1.1 simonb if (s == NULL) 1152 1.1 simonb { 1153 1.1 simonb tbuf[0] = '\177'; 1154 1.1 simonb tbuf[1] = '\0'; 1155 1.1 simonb s = tbuf; 1156 1.1 simonb } 1157 1.1 simonb break; 1158 1.1 simonb case SK_BACKSPACE: 1159 1.1 simonb s = ltgetstr("kb", &sp); 1160 1.1 simonb if (s == NULL) 1161 1.1 simonb { 1162 1.1 simonb tbuf[0] = '\b'; 1163 1.1 simonb tbuf[1] = '\0'; 1164 1.1 simonb s = tbuf; 1165 1.1 simonb } 1166 1.1 simonb break; 1167 1.1 simonb #endif 1168 1.1 simonb case SK_CONTROL_K: 1169 1.1 simonb tbuf[0] = CONTROL('K'); 1170 1.1 simonb tbuf[1] = '\0'; 1171 1.1 simonb s = tbuf; 1172 1.1 simonb break; 1173 1.1 simonb default: 1174 1.1 simonb return (NULL); 1175 1.1 simonb } 1176 1.1 simonb return (s); 1177 1.1 simonb } 1178 1.1 simonb 1179 1.1 simonb /* 1180 1.1 simonb * Get terminal capabilities via termcap. 1181 1.1 simonb */ 1182 1.1 simonb public void get_term(void) 1183 1.1 simonb { 1184 1.1 simonb termcap_debug = !isnullenv(lgetenv("LESS_TERMCAP_DEBUG")); 1185 1.1 simonb #if MSDOS_COMPILER 1186 1.1 simonb auto_wrap = 1; 1187 1.1 simonb ignaw = 0; 1188 1.1 simonb can_goto_line = 1; 1189 1.1 simonb clear_bg = 1; 1190 1.1 simonb /* 1191 1.1 simonb * Set up default colors. 1192 1.1 simonb * The xx_s_width and xx_e_width vars are already initialized to 0. 1193 1.1 simonb */ 1194 1.1 simonb #if MSDOS_COMPILER==MSOFTC 1195 1.1 simonb sy_bg_color = _getbkcolor(); 1196 1.1 simonb sy_fg_color = _gettextcolor(); 1197 1.1 simonb get_clock(); 1198 1.1 simonb #else 1199 1.1 simonb #if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC 1200 1.1 simonb { 1201 1.1 simonb struct text_info w; 1202 1.1 simonb gettextinfo(&w); 1203 1.1 simonb sy_bg_color = (w.attribute >> 4) & 0x0F; 1204 1.1 simonb sy_fg_color = (w.attribute >> 0) & 0x0F; 1205 1.1 simonb } 1206 1.1 simonb #else 1207 1.1 simonb #if MSDOS_COMPILER==WIN32C 1208 1.1 simonb { 1209 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO scr; 1210 1.1 simonb 1211 1.1 simonb con_out_save = con_out = GetStdHandle(STD_OUTPUT_HANDLE); 1212 1.1 simonb /* 1213 1.1 simonb * Always open stdin in binary. Note this *must* be done 1214 1.1 simonb * before any file operations have been done on fd0. 1215 1.1 simonb */ 1216 1.1 simonb SET_BINARY(0); 1217 1.1 simonb GetConsoleMode(con_out, &init_output_mode); 1218 1.1 simonb GetConsoleScreenBufferInfo(con_out, &scr); 1219 1.1 simonb curr_attr = scr.wAttributes; 1220 1.1 simonb sy_bg_color = (curr_attr & BG_COLORS) >> 4; /* normalize */ 1221 1.1 simonb sy_fg_color = curr_attr & FG_COLORS; 1222 1.1 simonb } 1223 1.1 simonb #endif 1224 1.1 simonb #endif 1225 1.1 simonb #endif 1226 1.1 simonb nm_fg_color = sy_fg_color; 1227 1.1 simonb nm_bg_color = sy_bg_color; 1228 1.1 simonb bo_fg_color = 11; 1229 1.1 simonb bo_bg_color = 0; 1230 1.1 simonb ul_fg_color = 9; 1231 1.1 simonb ul_bg_color = 0; 1232 1.1 simonb so_fg_color = 15; 1233 1.1 simonb so_bg_color = 9; 1234 1.1 simonb bl_fg_color = 15; 1235 1.1 simonb bl_bg_color = 0; 1236 1.1 simonb sgr_mode = 0; 1237 1.1 simonb 1238 1.1 simonb /* 1239 1.1 simonb * Get size of the screen. 1240 1.1 simonb */ 1241 1.1 simonb scrsize(); 1242 1.1 simonb pos_init(); 1243 1.1 simonb 1244 1.1 simonb 1245 1.1 simonb #else /* !MSDOS_COMPILER */ 1246 1.1 simonb { 1247 1.1 simonb char *sp; 1248 1.1 simonb char *t1, *t2; 1249 1.1 simonb char *term; 1250 1.1 simonb /* 1251 1.1 simonb * Some termcap libraries assume termbuf is static 1252 1.1 simonb * (accessible after tgetent returns). 1253 1.1 simonb */ 1254 1.1 simonb static char termbuf[TERMBUF_SIZE]; 1255 1.1 simonb static char sbuf[TERMSBUF_SIZE]; 1256 1.1 simonb 1257 1.1 simonb #if OS2 1258 1.1 simonb /* 1259 1.1 simonb * Make sure the termcap database is available. 1260 1.1 simonb */ 1261 1.1 simonb sp = lgetenv("TERMCAP"); 1262 1.1 simonb if (isnullenv(sp)) 1263 1.1 simonb { 1264 1.1 simonb char *termcap; 1265 1.1 simonb if ((sp = homefile("termcap.dat")) != NULL) 1266 1.1 simonb { 1267 1.1 simonb termcap = (char *) ecalloc(strlen(sp)+9, sizeof(char)); 1268 1.1 simonb sprintf(termcap, "TERMCAP=%s", sp); 1269 1.1 simonb free(sp); 1270 1.1 simonb putenv(termcap); 1271 1.1 simonb } 1272 1.1 simonb } 1273 1.1 simonb #endif 1274 1.1 simonb /* 1275 1.1 simonb * Find out what kind of terminal this is. 1276 1.1 simonb */ 1277 1.1 simonb if ((term = lgetenv("TERM")) == NULL) 1278 1.1 simonb term = DEFAULT_TERM; 1279 1.1 simonb hardcopy = 0; 1280 1.1 simonb /* {{ Should probably just pass NULL instead of termbuf. }} */ 1281 1.1 simonb if (tgetent(termbuf, term) != TGETENT_OK) 1282 1.1 simonb hardcopy = 1; 1283 1.1 simonb if (ltgetflag("hc")) 1284 1.1 simonb hardcopy = 1; 1285 1.1 simonb 1286 1.1 simonb /* 1287 1.1 simonb * Get size of the screen. 1288 1.1 simonb */ 1289 1.1 simonb scrsize(); 1290 1.1 simonb pos_init(); 1291 1.1 simonb 1292 1.1 simonb auto_wrap = ltgetflag("am"); 1293 1.1 simonb ignaw = ltgetflag("xn"); 1294 1.1 simonb above_mem = ltgetflag("da"); 1295 1.1 simonb below_mem = ltgetflag("db"); 1296 1.1 simonb clear_bg = ltgetflag("ut"); 1297 1.1 simonb no_alt_screen = ltgetflag("NR"); 1298 1.1 simonb 1299 1.1 simonb /* 1300 1.1 simonb * Assumes termcap variable "sg" is the printing width of: 1301 1.1 simonb * the standout sequence, the end standout sequence, 1302 1.1 simonb * the underline sequence, the end underline sequence, 1303 1.1 simonb * the boldface sequence, and the end boldface sequence. 1304 1.1 simonb */ 1305 1.1 simonb if ((so_s_width = ltgetnum("sg")) < 0) 1306 1.1 simonb so_s_width = 0; 1307 1.1 simonb so_e_width = so_s_width; 1308 1.1 simonb 1309 1.1 simonb bo_s_width = bo_e_width = so_s_width; 1310 1.1 simonb ul_s_width = ul_e_width = so_s_width; 1311 1.1 simonb bl_s_width = bl_e_width = so_s_width; 1312 1.1 simonb 1313 1.1 simonb #if HILITE_SEARCH 1314 1.1 simonb if (so_s_width > 0 || so_e_width > 0) 1315 1.1 simonb /* 1316 1.1 simonb * Disable highlighting by default on magic cookie terminals. 1317 1.1 simonb * Turning on highlighting might change the displayed width 1318 1.1 simonb * of a line, causing the display to get messed up. 1319 1.1 simonb * The user can turn it back on with -g, 1320 1.1 simonb * but she won't like the results. 1321 1.1 simonb */ 1322 1.1 simonb hilite_search = 0; 1323 1.1 simonb #endif 1324 1.1 simonb 1325 1.1 simonb /* 1326 1.1 simonb * Get various string-valued capabilities. 1327 1.1 simonb */ 1328 1.1 simonb sp = sbuf; 1329 1.1 simonb 1330 1.1 simonb #if HAVE_OSPEED 1331 1.1 simonb sc_pad = ltgetstr("pc", &sp); 1332 1.1 simonb if (sc_pad != NULL) 1333 1.1 simonb PC = *sc_pad; 1334 1.1 simonb #endif 1335 1.1 simonb 1336 1.1 simonb sc_s_keypad = ltgetstr("ks", &sp); 1337 1.1 simonb if (sc_s_keypad == NULL) 1338 1.1 simonb sc_s_keypad = ""; 1339 1.1 simonb sc_e_keypad = ltgetstr("ke", &sp); 1340 1.1 simonb if (sc_e_keypad == NULL) 1341 1.1 simonb sc_e_keypad = ""; 1342 1.1 simonb kent = ltgetstr("@8", &sp); 1343 1.1 simonb 1344 1.1 simonb sc_s_mousecap = ltgetstr("MOUSE_START", &sp); 1345 1.1 simonb if (sc_s_mousecap == NULL) 1346 1.1 simonb sc_s_mousecap = ESCS "[?1000h" ESCS "[?1006h"; 1347 1.1 simonb sc_e_mousecap = ltgetstr("MOUSE_END", &sp); 1348 1.1 simonb if (sc_e_mousecap == NULL) 1349 1.1 simonb sc_e_mousecap = ESCS "[?1006l" ESCS "[?1000l"; 1350 1.1 simonb 1351 1.1 simonb sc_init = ltgetstr("ti", &sp); 1352 1.1 simonb if (sc_init == NULL) 1353 1.1 simonb sc_init = ""; 1354 1.1 simonb 1355 1.1 simonb sc_deinit= ltgetstr("te", &sp); 1356 1.1 simonb if (sc_deinit == NULL) 1357 1.1 simonb sc_deinit = ""; 1358 1.1 simonb 1359 1.1 simonb sc_eol_clear = ltgetstr("ce", &sp); 1360 1.1 simonb if (sc_eol_clear == NULL || *sc_eol_clear == '\0') 1361 1.1 simonb { 1362 1.1 simonb missing_cap = 1; 1363 1.1 simonb sc_eol_clear = ""; 1364 1.1 simonb } 1365 1.1 simonb 1366 1.1 simonb sc_eos_clear = ltgetstr("cd", &sp); 1367 1.1 simonb if (below_mem && (sc_eos_clear == NULL || *sc_eos_clear == '\0')) 1368 1.1 simonb { 1369 1.1 simonb missing_cap = 1; 1370 1.1 simonb sc_eos_clear = ""; 1371 1.1 simonb } 1372 1.1 simonb 1373 1.1 simonb sc_clear = ltgetstr("cl", &sp); 1374 1.1 simonb if (sc_clear == NULL || *sc_clear == '\0') 1375 1.1 simonb { 1376 1.1 simonb missing_cap = 1; 1377 1.1 simonb sc_clear = "\n\n"; 1378 1.1 simonb } 1379 1.1 simonb 1380 1.1 simonb sc_move = ltgetstr("cm", &sp); 1381 1.1 simonb if (sc_move == NULL || *sc_move == '\0') 1382 1.1 simonb { 1383 1.1 simonb /* 1384 1.1 simonb * This is not an error here, because we don't 1385 1.1 simonb * always need sc_move. 1386 1.1 simonb * We need it only if we don't have home or lower-left. 1387 1.1 simonb */ 1388 1.1 simonb sc_move = ""; 1389 1.1 simonb can_goto_line = 0; 1390 1.1 simonb } else 1391 1.1 simonb can_goto_line = 1; 1392 1.1 simonb 1393 1.1 simonb tmodes("so", "se", &sc_s_in, &sc_s_out, "", "", &sp); 1394 1.1 simonb tmodes("us", "ue", &sc_u_in, &sc_u_out, sc_s_in, sc_s_out, &sp); 1395 1.1 simonb tmodes("md", "me", &sc_b_in, &sc_b_out, sc_s_in, sc_s_out, &sp); 1396 1.1 simonb tmodes("mb", "me", &sc_bl_in, &sc_bl_out, sc_s_in, sc_s_out, &sp); 1397 1.1 simonb 1398 1.1 simonb sc_visual_bell = ltgetstr("vb", &sp); 1399 1.1 simonb if (sc_visual_bell == NULL) 1400 1.1 simonb sc_visual_bell = ""; 1401 1.1 simonb 1402 1.1 simonb if (ltgetflag("bs")) 1403 1.1 simonb sc_backspace = "\b"; 1404 1.1 simonb else 1405 1.1 simonb { 1406 1.1 simonb sc_backspace = ltgetstr("bc", &sp); 1407 1.1 simonb if (sc_backspace == NULL || *sc_backspace == '\0') 1408 1.1 simonb sc_backspace = "\b"; 1409 1.1 simonb } 1410 1.1 simonb 1411 1.1 simonb /* 1412 1.1 simonb * Choose between using "ho" and "cm" ("home" and "cursor move") 1413 1.1 simonb * to move the cursor to the upper left corner of the screen. 1414 1.1 simonb */ 1415 1.1 simonb t1 = ltgetstr("ho", &sp); 1416 1.1 simonb if (t1 == NULL) 1417 1.1 simonb t1 = ""; 1418 1.1 simonb if (*sc_move == '\0') 1419 1.1 simonb t2 = ""; 1420 1.1 simonb else 1421 1.1 simonb { 1422 1.1 simonb strcpy(sp, tgoto(sc_move, 0, 0)); 1423 1.1 simonb t2 = sp; 1424 1.1 simonb sp += strlen(sp) + 1; 1425 1.1 simonb } 1426 1.1 simonb sc_home = cheaper(t1, t2, "|\b^"); 1427 1.1 simonb 1428 1.1 simonb /* 1429 1.1 simonb * Choose between using "ll" and "cm" ("lower left" and "cursor move") 1430 1.1 simonb * to move the cursor to the lower left corner of the screen. 1431 1.1 simonb */ 1432 1.1 simonb t1 = ltgetstr("ll", &sp); 1433 1.1 simonb if (t1 == NULL || !full_screen) 1434 1.1 simonb t1 = ""; 1435 1.1 simonb if (*sc_move == '\0') 1436 1.1 simonb t2 = ""; 1437 1.1 simonb else 1438 1.1 simonb { 1439 1.1 simonb strcpy(sp, tgoto(sc_move, 0, sc_height-1)); 1440 1.1 simonb t2 = sp; 1441 1.1 simonb sp += strlen(sp) + 1; 1442 1.1 simonb } 1443 1.1 simonb sc_lower_left = cheaper(t1, t2, "\r"); 1444 1.1 simonb 1445 1.1 simonb /* 1446 1.1 simonb * Get carriage return string. 1447 1.1 simonb */ 1448 1.1 simonb sc_return = ltgetstr("cr", &sp); 1449 1.1 simonb if (sc_return == NULL) 1450 1.1 simonb sc_return = "\r"; 1451 1.1 simonb 1452 1.1 simonb /* 1453 1.1 simonb * Choose between using "al" or "sr" ("add line" or "scroll reverse") 1454 1.1 simonb * to add a line at the top of the screen. 1455 1.1 simonb */ 1456 1.1 simonb t1 = ltgetstr("al", &sp); 1457 1.1 simonb if (t1 == NULL) 1458 1.1 simonb t1 = ""; 1459 1.1 simonb t2 = ltgetstr("sr", &sp); 1460 1.1 simonb if (t2 == NULL) 1461 1.1 simonb t2 = ""; 1462 1.1 simonb #if OS2 1463 1.1 simonb if (*t1 == '\0' && *t2 == '\0') 1464 1.1 simonb sc_addline = ""; 1465 1.1 simonb else 1466 1.1 simonb #endif 1467 1.1 simonb if (above_mem) 1468 1.1 simonb sc_addline = t1; 1469 1.1 simonb else 1470 1.1 simonb sc_addline = cheaper(t1, t2, ""); 1471 1.1 simonb if (*sc_addline == '\0') 1472 1.1 simonb { 1473 1.1 simonb /* 1474 1.1 simonb * Force repaint on any backward movement. 1475 1.1 simonb */ 1476 1.1 simonb no_back_scroll = 1; 1477 1.1 simonb } 1478 1.1 simonb } 1479 1.1 simonb #endif /* MSDOS_COMPILER */ 1480 1.1 simonb } 1481 1.1 simonb 1482 1.1 simonb #if !MSDOS_COMPILER 1483 1.1 simonb /* 1484 1.1 simonb * Return the cost of displaying a termcap string. 1485 1.1 simonb * We use the trick of calling tputs, but as a char printing function 1486 1.1 simonb * we give it inc_costcount, which just increments "costcount". 1487 1.1 simonb * This tells us how many chars would be printed by using this string. 1488 1.1 simonb * {{ Couldn't we just use strlen? }} 1489 1.1 simonb */ 1490 1.1 simonb static int costcount; 1491 1.1 simonb 1492 1.1 simonb /*ARGSUSED*/ 1493 1.1 simonb static int inc_costcount(int c) 1494 1.1 simonb { 1495 1.1 simonb costcount++; 1496 1.1 simonb return (c); 1497 1.1 simonb } 1498 1.1 simonb 1499 1.1 simonb static int cost(char *t) 1500 1.1 simonb { 1501 1.1 simonb costcount = 0; 1502 1.1 simonb tputs(t, sc_height, inc_costcount); 1503 1.1 simonb return (costcount); 1504 1.1 simonb } 1505 1.1 simonb 1506 1.1 simonb /* 1507 1.1 simonb * Return the "best" of the two given termcap strings. 1508 1.1 simonb * The best, if both exist, is the one with the lower 1509 1.1 simonb * cost (see cost() function). 1510 1.1 simonb */ 1511 1.1 simonb static char * cheaper(char *t1, char *t2, char *def) 1512 1.1 simonb { 1513 1.1 simonb if (*t1 == '\0' && *t2 == '\0') 1514 1.1 simonb { 1515 1.1 simonb missing_cap = 1; 1516 1.1 simonb return (def); 1517 1.1 simonb } 1518 1.1 simonb if (*t1 == '\0') 1519 1.1 simonb return (t2); 1520 1.1 simonb if (*t2 == '\0') 1521 1.1 simonb return (t1); 1522 1.1 simonb if (cost(t1) < cost(t2)) 1523 1.1 simonb return (t1); 1524 1.1 simonb return (t2); 1525 1.1 simonb } 1526 1.1 simonb 1527 1.1 simonb static void tmodes(char *incap, char *outcap, char **instr, char **outstr, char *def_instr, char *def_outstr, char **spp) 1528 1.1 simonb { 1529 1.1 simonb *instr = ltgetstr(incap, spp); 1530 1.1 simonb if (*instr == NULL) 1531 1.1 simonb { 1532 1.1 simonb /* Use defaults. */ 1533 1.1 simonb *instr = def_instr; 1534 1.1 simonb *outstr = def_outstr; 1535 1.1 simonb return; 1536 1.1 simonb } 1537 1.1 simonb 1538 1.1 simonb *outstr = ltgetstr(outcap, spp); 1539 1.1 simonb if (*outstr == NULL) 1540 1.1 simonb /* No specific out capability; use "me". */ 1541 1.1 simonb *outstr = ltgetstr("me", spp); 1542 1.1 simonb if (*outstr == NULL) 1543 1.1 simonb /* Don't even have "me"; use a null string. */ 1544 1.1 simonb *outstr = ""; 1545 1.1 simonb } 1546 1.1 simonb 1547 1.1 simonb #endif /* MSDOS_COMPILER */ 1548 1.1 simonb 1549 1.1 simonb 1550 1.1 simonb /* 1551 1.1 simonb * Below are the functions which perform all the 1552 1.1 simonb * terminal-specific screen manipulation. 1553 1.1 simonb */ 1554 1.1 simonb 1555 1.1 simonb 1556 1.1 simonb #if MSDOS_COMPILER 1557 1.1 simonb 1558 1.1 simonb #if MSDOS_COMPILER==WIN32C 1559 1.1 simonb static void _settextposition(int row, int col) 1560 1.1 simonb { 1561 1.1 simonb COORD cpos; 1562 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO csbi; 1563 1.1 simonb 1564 1.1 simonb GetConsoleScreenBufferInfo(con_out, &csbi); 1565 1.1 simonb cpos.X = csbi.srWindow.Left + (col - 1); 1566 1.1 simonb cpos.Y = csbi.srWindow.Top + (row - 1); 1567 1.1 simonb SetConsoleCursorPosition(con_out, cpos); 1568 1.1 simonb } 1569 1.1 simonb #endif 1570 1.1 simonb 1571 1.1 simonb /* 1572 1.1 simonb * Initialize the screen to the correct color at startup. 1573 1.1 simonb */ 1574 1.1 simonb static void initcolor(void) 1575 1.1 simonb { 1576 1.1 simonb #if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC 1577 1.1 simonb intensevideo(); 1578 1.1 simonb #endif 1579 1.1 simonb SETCOLORS(nm_fg_color, nm_bg_color); 1580 1.1 simonb #if 0 1581 1.1 simonb /* 1582 1.1 simonb * This clears the screen at startup. This is different from 1583 1.1 simonb * the behavior of other versions of less. Disable it for now. 1584 1.1 simonb */ 1585 1.1 simonb char *blanks; 1586 1.1 simonb int row; 1587 1.1 simonb int col; 1588 1.1 simonb 1589 1.1 simonb /* 1590 1.1 simonb * Create a complete, blank screen using "normal" colors. 1591 1.1 simonb */ 1592 1.1 simonb SETCOLORS(nm_fg_color, nm_bg_color); 1593 1.1 simonb blanks = (char *) ecalloc(width+1, sizeof(char)); 1594 1.1 simonb for (col = 0; col < sc_width; col++) 1595 1.1 simonb blanks[col] = ' '; 1596 1.1 simonb blanks[sc_width] = '\0'; 1597 1.1 simonb for (row = 0; row < sc_height; row++) 1598 1.1 simonb _outtext(blanks); 1599 1.1 simonb free(blanks); 1600 1.1 simonb #endif 1601 1.1 simonb } 1602 1.1 simonb #endif 1603 1.1 simonb 1604 1.1 simonb #if MSDOS_COMPILER==WIN32C 1605 1.1 simonb 1606 1.1 simonb /* 1607 1.1 simonb * Enable virtual terminal processing, if available. 1608 1.1 simonb */ 1609 1.1 simonb static void win32_init_vt_term(void) 1610 1.1 simonb { 1611 1.1 simonb DWORD output_mode; 1612 1.1 simonb 1613 1.1 simonb if (vt_enabled == 0 || (vt_enabled == 1 && con_out == con_out_ours)) 1614 1.1 simonb return; 1615 1.1 simonb 1616 1.1 simonb GetConsoleMode(con_out, &output_mode); 1617 1.1 simonb vt_enabled = SetConsoleMode(con_out, 1618 1.1 simonb output_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING); 1619 1.1 simonb if (vt_enabled) 1620 1.1 simonb { 1621 1.1 simonb auto_wrap = 0; 1622 1.1 simonb ignaw = 1; 1623 1.1 simonb } 1624 1.1 simonb } 1625 1.1 simonb 1626 1.1 simonb static void win32_deinit_vt_term(void) 1627 1.1 simonb { 1628 1.1 simonb if (vt_enabled == 1 && con_out == con_out_save) 1629 1.1 simonb SetConsoleMode(con_out, init_output_mode); 1630 1.1 simonb } 1631 1.1 simonb 1632 1.1 simonb /* 1633 1.1 simonb * Termcap-like init with a private win32 console. 1634 1.1 simonb */ 1635 1.1 simonb static void win32_init_term(void) 1636 1.1 simonb { 1637 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO scr; 1638 1.1 simonb COORD size; 1639 1.1 simonb 1640 1.1 simonb if (con_out_save == INVALID_HANDLE_VALUE) 1641 1.1 simonb return; 1642 1.1 simonb 1643 1.1 simonb GetConsoleScreenBufferInfo(con_out_save, &scr); 1644 1.1 simonb 1645 1.1 simonb if (con_out_ours == INVALID_HANDLE_VALUE) 1646 1.1 simonb { 1647 1.1 simonb /* 1648 1.1 simonb * Create our own screen buffer, so that we 1649 1.1 simonb * may restore the original when done. 1650 1.1 simonb */ 1651 1.1 simonb con_out_ours = CreateConsoleScreenBuffer( 1652 1.1 simonb GENERIC_WRITE | GENERIC_READ, 1653 1.1 simonb FILE_SHARE_WRITE | FILE_SHARE_READ, 1654 1.1 simonb (LPSECURITY_ATTRIBUTES) NULL, 1655 1.1 simonb CONSOLE_TEXTMODE_BUFFER, 1656 1.1 simonb (LPVOID) NULL); 1657 1.1 simonb } 1658 1.1 simonb 1659 1.1 simonb size.X = scr.srWindow.Right - scr.srWindow.Left + 1; 1660 1.1 simonb size.Y = scr.srWindow.Bottom - scr.srWindow.Top + 1; 1661 1.1 simonb SetConsoleScreenBufferSize(con_out_ours, size); 1662 1.1 simonb SetConsoleActiveScreenBuffer(con_out_ours); 1663 1.1 simonb con_out = con_out_ours; 1664 1.1 simonb } 1665 1.1 simonb 1666 1.1 simonb /* 1667 1.1 simonb * Restore the startup console. 1668 1.1 simonb */ 1669 1.1 simonb static void win32_deinit_term(void) 1670 1.1 simonb { 1671 1.1 simonb if (con_out_save == INVALID_HANDLE_VALUE) 1672 1.1 simonb return; 1673 1.1 simonb if (quitting) 1674 1.1 simonb (void) CloseHandle(con_out_ours); 1675 1.1 simonb SetConsoleActiveScreenBuffer(con_out_save); 1676 1.1 simonb con_out = con_out_save; 1677 1.1 simonb } 1678 1.1 simonb 1679 1.1 simonb #endif 1680 1.1 simonb 1681 1.1 simonb #if !MSDOS_COMPILER 1682 1.1 simonb static void do_tputs(char *str, int affcnt, int (*f_putc)(int)) 1683 1.1 simonb { 1684 1.1 simonb #if LESSTEST 1685 1.1 simonb if (ttyin_name != NULL && f_putc == putchr) 1686 1.1 simonb putstr(str); 1687 1.1 simonb else 1688 1.1 simonb #endif /*LESSTEST*/ 1689 1.1 simonb tputs(str, affcnt, f_putc); 1690 1.1 simonb } 1691 1.1 simonb 1692 1.1 simonb /* 1693 1.1 simonb * Like tputs but we handle $<...> delay strings here because 1694 1.1 simonb * some implementations of tputs don't perform delays correctly. 1695 1.1 simonb */ 1696 1.1 simonb static void ltputs(char *str, int affcnt, int (*f_putc)(int)) 1697 1.1 simonb { 1698 1.1 simonb while (str != NULL && *str != '\0') 1699 1.1 simonb { 1700 1.1 simonb #if HAVE_STRSTR 1701 1.1 simonb char *obrac = strstr(str, "$<"); 1702 1.1 simonb if (obrac != NULL) 1703 1.1 simonb { 1704 1.1 simonb char str2[64]; 1705 1.1 simonb int slen = obrac - str; 1706 1.1 simonb if (slen < sizeof(str2)) 1707 1.1 simonb { 1708 1.1 simonb int delay; 1709 1.1 simonb /* Output first part of string (before "$<"). */ 1710 1.1 simonb memcpy(str2, str, slen); 1711 1.1 simonb str2[slen] = '\0'; 1712 1.1 simonb do_tputs(str2, affcnt, f_putc); 1713 1.1 simonb str += slen + 2; 1714 1.1 simonb /* Perform the delay. */ 1715 1.1 simonb delay = lstrtoi(str, &str, 10); 1716 1.1 simonb if (*str == '*') 1717 1.1 simonb if (ckd_mul(&delay, delay, affcnt)) 1718 1.1 simonb delay = INT_MAX; 1719 1.1 simonb flush(); 1720 1.1 simonb sleep_ms(delay); 1721 1.1 simonb /* Skip past closing ">" at end of delay string. */ 1722 1.1 simonb str = strstr(str, ">"); 1723 1.1 simonb if (str != NULL) 1724 1.1 simonb str++; 1725 1.1 simonb continue; 1726 1.1 simonb } 1727 1.1 simonb } 1728 1.1 simonb #endif 1729 1.1 simonb /* Pass the rest of the string to tputs and we're done. */ 1730 1.1 simonb do_tputs(str, affcnt, f_putc); 1731 1.1 simonb break; 1732 1.1 simonb } 1733 1.1 simonb } 1734 1.1 simonb #endif /* MSDOS_COMPILER */ 1735 1.1 simonb 1736 1.1 simonb /* 1737 1.1 simonb * Configure the terminal so mouse clicks and wheel moves 1738 1.1 simonb * produce input to less. 1739 1.1 simonb */ 1740 1.1 simonb public void init_mouse(void) 1741 1.1 simonb { 1742 1.1 simonb #if !MSDOS_COMPILER 1743 1.1 simonb ltputs(sc_s_mousecap, sc_height, putchr); 1744 1.1 simonb #else 1745 1.1 simonb #if MSDOS_COMPILER==WIN32C 1746 1.1 simonb SetConsoleMode(tty, ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT 1747 1.1 simonb | ENABLE_EXTENDED_FLAGS /* disable quick edit */); 1748 1.1 simonb 1749 1.1 simonb #endif 1750 1.1 simonb #endif 1751 1.1 simonb } 1752 1.1 simonb 1753 1.1 simonb /* 1754 1.1 simonb * Configure the terminal so mouse clicks and wheel moves 1755 1.1 simonb * are handled by the system (so text can be selected, etc). 1756 1.1 simonb */ 1757 1.1 simonb public void deinit_mouse(void) 1758 1.1 simonb { 1759 1.1 simonb #if !MSDOS_COMPILER 1760 1.1 simonb ltputs(sc_e_mousecap, sc_height, putchr); 1761 1.1 simonb #else 1762 1.1 simonb #if MSDOS_COMPILER==WIN32C 1763 1.1 simonb SetConsoleMode(tty, ENABLE_PROCESSED_INPUT | ENABLE_EXTENDED_FLAGS 1764 1.1 simonb | (console_mode & ENABLE_QUICK_EDIT_MODE)); 1765 1.1 simonb #endif 1766 1.1 simonb #endif 1767 1.1 simonb } 1768 1.1 simonb 1769 1.1 simonb /* 1770 1.1 simonb * Initialize terminal 1771 1.1 simonb */ 1772 1.1 simonb public void init(void) 1773 1.1 simonb { 1774 1.1 simonb clear_bot_if_needed(); 1775 1.1 simonb #if !MSDOS_COMPILER 1776 1.1 simonb if (!(quit_if_one_screen && one_screen)) 1777 1.1 simonb { 1778 1.1 simonb if (!no_init) 1779 1.1 simonb { 1780 1.1 simonb ltputs(sc_init, sc_height, putchr); 1781 1.1 simonb /* 1782 1.1 simonb * Some terminals leave the cursor unmoved when switching 1783 1.1 simonb * to the alt screen. To avoid having the text appear at 1784 1.1 simonb * a seemingly random line on the alt screen, move to 1785 1.1 simonb * lower left if we are using an alt screen. 1786 1.1 simonb */ 1787 1.1 simonb if (*sc_init != '\0' && *sc_deinit != '\0' && !no_alt_screen) 1788 1.1 simonb lower_left(); 1789 1.1 simonb term_init_done = 1; 1790 1.1 simonb } 1791 1.1 simonb if (!no_keypad) 1792 1.1 simonb ltputs(sc_s_keypad, sc_height, putchr); 1793 1.1 simonb if (mousecap) 1794 1.1 simonb init_mouse(); 1795 1.1 simonb } 1796 1.1 simonb init_done = 1; 1797 1.1 simonb if (top_scroll) 1798 1.1 simonb { 1799 1.1 simonb int i; 1800 1.1 simonb 1801 1.1 simonb /* 1802 1.1 simonb * This is nice to terminals with no alternate screen, 1803 1.1 simonb * but with saved scrolled-off-the-top lines. This way, 1804 1.1 simonb * no previous line is lost, but we start with a whole 1805 1.1 simonb * screen to ourself. 1806 1.1 simonb */ 1807 1.1 simonb for (i = 1; i < sc_height; i++) 1808 1.1 simonb putchr('\n'); 1809 1.1 simonb } else 1810 1.1 simonb line_left(); 1811 1.1 simonb #else 1812 1.1 simonb #if MSDOS_COMPILER==WIN32C 1813 1.1 simonb if (!(quit_if_one_screen && one_screen)) 1814 1.1 simonb { 1815 1.1 simonb if (!no_init) 1816 1.1 simonb { 1817 1.1 simonb win32_init_term(); 1818 1.1 simonb term_init_done = 1; 1819 1.1 simonb } 1820 1.1 simonb if (mousecap) 1821 1.1 simonb init_mouse(); 1822 1.1 simonb 1823 1.1 simonb } 1824 1.1 simonb win32_init_vt_term(); 1825 1.1 simonb #endif 1826 1.1 simonb init_done = 1; 1827 1.1 simonb initcolor(); 1828 1.1 simonb flush(); 1829 1.1 simonb #endif 1830 1.1 simonb } 1831 1.1 simonb 1832 1.1 simonb /* 1833 1.1 simonb * Deinitialize terminal 1834 1.1 simonb */ 1835 1.1 simonb public void deinit(void) 1836 1.1 simonb { 1837 1.1 simonb if (!init_done) 1838 1.1 simonb return; 1839 1.1 simonb #if !MSDOS_COMPILER 1840 1.1 simonb if (!(quit_if_one_screen && one_screen)) 1841 1.1 simonb { 1842 1.1 simonb if (mousecap) 1843 1.1 simonb deinit_mouse(); 1844 1.1 simonb if (!no_keypad) 1845 1.1 simonb ltputs(sc_e_keypad, sc_height, putchr); 1846 1.1 simonb if (!no_init) 1847 1.1 simonb ltputs(sc_deinit, sc_height, putchr); 1848 1.1 simonb } 1849 1.1 simonb #else 1850 1.1 simonb /* Restore system colors. */ 1851 1.1 simonb SETCOLORS(sy_fg_color, sy_bg_color); 1852 1.1 simonb #if MSDOS_COMPILER==WIN32C 1853 1.1 simonb win32_deinit_vt_term(); 1854 1.1 simonb if (!(quit_if_one_screen && one_screen)) 1855 1.1 simonb { 1856 1.1 simonb if (mousecap) 1857 1.1 simonb deinit_mouse(); 1858 1.1 simonb if (!no_init) 1859 1.1 simonb win32_deinit_term(); 1860 1.1 simonb } 1861 1.1 simonb #else 1862 1.1 simonb /* Need clreol to make SETCOLORS take effect. */ 1863 1.1 simonb clreol(); 1864 1.1 simonb #endif 1865 1.1 simonb #endif 1866 1.1 simonb init_done = 0; 1867 1.1 simonb } 1868 1.1 simonb 1869 1.1 simonb /* 1870 1.1 simonb * Are we interactive (ie. writing to an initialized tty)? 1871 1.1 simonb */ 1872 1.1 simonb public int interactive(void) 1873 1.1 simonb { 1874 1.1 simonb return (is_tty && init_done); 1875 1.1 simonb } 1876 1.1 simonb 1877 1.1 simonb static void assert_interactive(void) 1878 1.1 simonb { 1879 1.1 simonb if (interactive()) return; 1880 1.1 simonb /* abort(); */ 1881 1.1 simonb } 1882 1.1 simonb 1883 1.1 simonb /* 1884 1.1 simonb * Home cursor (move to upper left corner of screen). 1885 1.1 simonb */ 1886 1.1 simonb public void home(void) 1887 1.1 simonb { 1888 1.1 simonb assert_interactive(); 1889 1.1 simonb #if !MSDOS_COMPILER 1890 1.1 simonb ltputs(sc_home, 1, putchr); 1891 1.1 simonb #else 1892 1.1 simonb flush(); 1893 1.1 simonb _settextposition(1,1); 1894 1.1 simonb #endif 1895 1.1 simonb } 1896 1.1 simonb 1897 1.1 simonb #if LESSTEST 1898 1.1 simonb public void dump_screen(void) 1899 1.1 simonb { 1900 1.1 simonb char dump_cmd[32]; 1901 1.1 simonb SNPRINTF1(dump_cmd, sizeof(dump_cmd), ESCS"0;0;%dR", sc_width * sc_height); 1902 1.1 simonb ltputs(dump_cmd, sc_height, putchr); 1903 1.1 simonb flush(); 1904 1.1 simonb } 1905 1.1 simonb #endif /*LESSTEST*/ 1906 1.1 simonb 1907 1.1 simonb /* 1908 1.1 simonb * Add a blank line (called with cursor at home). 1909 1.1 simonb * Should scroll the display down. 1910 1.1 simonb */ 1911 1.1 simonb public void add_line(void) 1912 1.1 simonb { 1913 1.1 simonb assert_interactive(); 1914 1.1 simonb #if !MSDOS_COMPILER 1915 1.1 simonb ltputs(sc_addline, sc_height, putchr); 1916 1.1 simonb #else 1917 1.1 simonb flush(); 1918 1.1 simonb #if MSDOS_COMPILER==MSOFTC 1919 1.1 simonb _scrolltextwindow(_GSCROLLDOWN); 1920 1.1 simonb _settextposition(1,1); 1921 1.1 simonb #else 1922 1.1 simonb #if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC 1923 1.1 simonb movetext(1,1, sc_width,sc_height-1, 1,2); 1924 1.1 simonb gotoxy(1,1); 1925 1.1 simonb clreol(); 1926 1.1 simonb #else 1927 1.1 simonb #if MSDOS_COMPILER==WIN32C 1928 1.1 simonb { 1929 1.1 simonb CHAR_INFO fillchar; 1930 1.1 simonb SMALL_RECT rcSrc, rcClip; 1931 1.1 simonb COORD new_org; 1932 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO csbi; 1933 1.1 simonb 1934 1.1 simonb GetConsoleScreenBufferInfo(con_out,&csbi); 1935 1.1 simonb 1936 1.1 simonb /* The clip rectangle is the entire visible screen. */ 1937 1.1 simonb rcClip.Left = csbi.srWindow.Left; 1938 1.1 simonb rcClip.Top = csbi.srWindow.Top; 1939 1.1 simonb rcClip.Right = csbi.srWindow.Right; 1940 1.1 simonb rcClip.Bottom = csbi.srWindow.Bottom; 1941 1.1 simonb 1942 1.1 simonb /* The source rectangle is the visible screen minus the last line. */ 1943 1.1 simonb rcSrc = rcClip; 1944 1.1 simonb rcSrc.Bottom--; 1945 1.1 simonb 1946 1.1 simonb /* Move the top left corner of the source window down one row. */ 1947 1.1 simonb new_org.X = rcSrc.Left; 1948 1.1 simonb new_org.Y = rcSrc.Top + 1; 1949 1.1 simonb 1950 1.1 simonb /* Fill the right character and attributes. */ 1951 1.1 simonb fillchar.Char.AsciiChar = ' '; 1952 1.1 simonb curr_attr = MAKEATTR(nm_fg_color, nm_bg_color); 1953 1.1 simonb fillchar.Attributes = curr_attr; 1954 1.1 simonb ScrollConsoleScreenBuffer(con_out, &rcSrc, &rcClip, new_org, &fillchar); 1955 1.1 simonb _settextposition(1,1); 1956 1.1 simonb } 1957 1.1 simonb #endif 1958 1.1 simonb #endif 1959 1.1 simonb #endif 1960 1.1 simonb #endif 1961 1.1 simonb } 1962 1.1 simonb 1963 1.1 simonb #if 0 1964 1.1 simonb /* 1965 1.1 simonb * Remove the n topmost lines and scroll everything below it in the 1966 1.1 simonb * window upward. This is needed to stop leaking the topmost line 1967 1.1 simonb * into the scrollback buffer when we go down-one-line (in WIN32). 1968 1.1 simonb */ 1969 1.1 simonb public void remove_top(int n) 1970 1.1 simonb { 1971 1.1 simonb #if MSDOS_COMPILER==WIN32C 1972 1.1 simonb SMALL_RECT rcSrc, rcClip; 1973 1.1 simonb CHAR_INFO fillchar; 1974 1.1 simonb COORD new_org; 1975 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO csbi; /* to get buffer info */ 1976 1.1 simonb 1977 1.1 simonb if (n >= sc_height - 1) 1978 1.1 simonb { 1979 1.1 simonb clear(); 1980 1.1 simonb home(); 1981 1.1 simonb return; 1982 1.1 simonb } 1983 1.1 simonb 1984 1.1 simonb flush(); 1985 1.1 simonb 1986 1.1 simonb GetConsoleScreenBufferInfo(con_out, &csbi); 1987 1.1 simonb 1988 1.1 simonb /* Get the extent of all-visible-rows-but-the-last. */ 1989 1.1 simonb rcSrc.Left = csbi.srWindow.Left; 1990 1.1 simonb rcSrc.Top = csbi.srWindow.Top + n; 1991 1.1 simonb rcSrc.Right = csbi.srWindow.Right; 1992 1.1 simonb rcSrc.Bottom = csbi.srWindow.Bottom; 1993 1.1 simonb 1994 1.1 simonb /* Get the clip rectangle. */ 1995 1.1 simonb rcClip.Left = rcSrc.Left; 1996 1.1 simonb rcClip.Top = csbi.srWindow.Top; 1997 1.1 simonb rcClip.Right = rcSrc.Right; 1998 1.1 simonb rcClip.Bottom = rcSrc.Bottom ; 1999 1.1 simonb 2000 1.1 simonb /* Move the source window up n rows. */ 2001 1.1 simonb new_org.X = rcSrc.Left; 2002 1.1 simonb new_org.Y = rcSrc.Top - n; 2003 1.1 simonb 2004 1.1 simonb /* Fill the right character and attributes. */ 2005 1.1 simonb fillchar.Char.AsciiChar = ' '; 2006 1.1 simonb curr_attr = MAKEATTR(nm_fg_color, nm_bg_color); 2007 1.1 simonb fillchar.Attributes = curr_attr; 2008 1.1 simonb 2009 1.1 simonb ScrollConsoleScreenBuffer(con_out, &rcSrc, &rcClip, new_org, &fillchar); 2010 1.1 simonb 2011 1.1 simonb /* Position cursor on first blank line. */ 2012 1.1 simonb goto_line(sc_height - n - 1); 2013 1.1 simonb #endif 2014 1.1 simonb } 2015 1.1 simonb #endif 2016 1.1 simonb 2017 1.1 simonb #if MSDOS_COMPILER==WIN32C 2018 1.1 simonb /* 2019 1.1 simonb * Clear the screen. 2020 1.1 simonb */ 2021 1.1 simonb static void win32_clear(void) 2022 1.1 simonb { 2023 1.1 simonb /* 2024 1.1 simonb * This will clear only the currently visible rows of the NT 2025 1.1 simonb * console buffer, which means none of the precious scrollback 2026 1.1 simonb * rows are touched making for faster scrolling. Note that, if 2027 1.1 simonb * the window has fewer columns than the console buffer (i.e. 2028 1.1 simonb * there is a horizontal scrollbar as well), the entire width 2029 1.1 simonb * of the visible rows will be cleared. 2030 1.1 simonb */ 2031 1.1 simonb COORD topleft; 2032 1.1 simonb DWORD nchars; 2033 1.1 simonb DWORD winsz; 2034 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO csbi; 2035 1.1 simonb 2036 1.1 simonb /* get the number of cells in the current buffer */ 2037 1.1 simonb GetConsoleScreenBufferInfo(con_out, &csbi); 2038 1.1 simonb winsz = csbi.dwSize.X * (csbi.srWindow.Bottom - csbi.srWindow.Top + 1); 2039 1.1 simonb topleft.X = 0; 2040 1.1 simonb topleft.Y = csbi.srWindow.Top; 2041 1.1 simonb 2042 1.1 simonb curr_attr = MAKEATTR(nm_fg_color, nm_bg_color); 2043 1.1 simonb FillConsoleOutputCharacter(con_out, ' ', winsz, topleft, &nchars); 2044 1.1 simonb FillConsoleOutputAttribute(con_out, curr_attr, winsz, topleft, &nchars); 2045 1.1 simonb } 2046 1.1 simonb 2047 1.1 simonb /* 2048 1.1 simonb * Remove the n topmost lines and scroll everything below it in the 2049 1.1 simonb * window upward. 2050 1.1 simonb */ 2051 1.1 simonb public void win32_scroll_up(int n) 2052 1.1 simonb { 2053 1.1 simonb SMALL_RECT rcSrc, rcClip; 2054 1.1 simonb CHAR_INFO fillchar; 2055 1.1 simonb COORD topleft; 2056 1.1 simonb COORD new_org; 2057 1.1 simonb DWORD nchars; 2058 1.1 simonb DWORD size; 2059 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO csbi; 2060 1.1 simonb 2061 1.1 simonb if (n <= 0) 2062 1.1 simonb return; 2063 1.1 simonb 2064 1.1 simonb if (n >= sc_height - 1) 2065 1.1 simonb { 2066 1.1 simonb win32_clear(); 2067 1.1 simonb _settextposition(1,1); 2068 1.1 simonb return; 2069 1.1 simonb } 2070 1.1 simonb 2071 1.1 simonb /* Get the extent of what will remain visible after scrolling. */ 2072 1.1 simonb GetConsoleScreenBufferInfo(con_out, &csbi); 2073 1.1 simonb rcSrc.Left = csbi.srWindow.Left; 2074 1.1 simonb rcSrc.Top = csbi.srWindow.Top + n; 2075 1.1 simonb rcSrc.Right = csbi.srWindow.Right; 2076 1.1 simonb rcSrc.Bottom = csbi.srWindow.Bottom; 2077 1.1 simonb 2078 1.1 simonb /* Get the clip rectangle. */ 2079 1.1 simonb rcClip.Left = rcSrc.Left; 2080 1.1 simonb rcClip.Top = csbi.srWindow.Top; 2081 1.1 simonb rcClip.Right = rcSrc.Right; 2082 1.1 simonb rcClip.Bottom = rcSrc.Bottom ; 2083 1.1 simonb 2084 1.1 simonb /* Move the source text to the top of the screen. */ 2085 1.1 simonb new_org.X = rcSrc.Left; 2086 1.1 simonb new_org.Y = rcClip.Top; 2087 1.1 simonb 2088 1.1 simonb /* Fill the right character and attributes. */ 2089 1.1 simonb fillchar.Char.AsciiChar = ' '; 2090 1.1 simonb fillchar.Attributes = MAKEATTR(nm_fg_color, nm_bg_color); 2091 1.1 simonb 2092 1.1 simonb /* Scroll the window. */ 2093 1.1 simonb SetConsoleTextAttribute(con_out, fillchar.Attributes); 2094 1.1 simonb ScrollConsoleScreenBuffer(con_out, &rcSrc, &rcClip, new_org, &fillchar); 2095 1.1 simonb 2096 1.1 simonb /* Clear remaining lines at bottom. */ 2097 1.1 simonb topleft.X = csbi.dwCursorPosition.X; 2098 1.1 simonb topleft.Y = rcSrc.Bottom - n; 2099 1.1 simonb size = (n * csbi.dwSize.X) + (rcSrc.Right - topleft.X); 2100 1.1 simonb FillConsoleOutputCharacter(con_out, ' ', size, topleft, 2101 1.1 simonb &nchars); 2102 1.1 simonb FillConsoleOutputAttribute(con_out, fillchar.Attributes, size, topleft, 2103 1.1 simonb &nchars); 2104 1.1 simonb SetConsoleTextAttribute(con_out, curr_attr); 2105 1.1 simonb 2106 1.1 simonb /* Move cursor n lines up from where it was. */ 2107 1.1 simonb csbi.dwCursorPosition.Y -= n; 2108 1.1 simonb SetConsoleCursorPosition(con_out, csbi.dwCursorPosition); 2109 1.1 simonb } 2110 1.1 simonb #endif 2111 1.1 simonb 2112 1.1 simonb /* 2113 1.1 simonb * Move cursor to lower left corner of screen. 2114 1.1 simonb */ 2115 1.1 simonb public void lower_left(void) 2116 1.1 simonb { 2117 1.1 simonb assert_interactive(); 2118 1.1 simonb #if !MSDOS_COMPILER 2119 1.1 simonb ltputs(sc_lower_left, 1, putchr); 2120 1.1 simonb #else 2121 1.1 simonb flush(); 2122 1.1 simonb _settextposition(sc_height, 1); 2123 1.1 simonb #endif 2124 1.1 simonb } 2125 1.1 simonb 2126 1.1 simonb /* 2127 1.1 simonb * Move cursor to left position of current line. 2128 1.1 simonb */ 2129 1.1 simonb public void line_left(void) 2130 1.1 simonb { 2131 1.1 simonb assert_interactive(); 2132 1.1 simonb #if !MSDOS_COMPILER 2133 1.1 simonb ltputs(sc_return, 1, putchr); 2134 1.1 simonb #else 2135 1.1 simonb { 2136 1.1 simonb int row; 2137 1.1 simonb flush(); 2138 1.1 simonb #if MSDOS_COMPILER==WIN32C 2139 1.1 simonb { 2140 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO scr; 2141 1.1 simonb GetConsoleScreenBufferInfo(con_out, &scr); 2142 1.1 simonb row = scr.dwCursorPosition.Y - scr.srWindow.Top + 1; 2143 1.1 simonb } 2144 1.1 simonb #else 2145 1.1 simonb #if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC 2146 1.1 simonb row = wherey(); 2147 1.1 simonb #else 2148 1.1 simonb { 2149 1.1 simonb struct rccoord tpos = _gettextposition(); 2150 1.1 simonb row = tpos.row; 2151 1.1 simonb } 2152 1.1 simonb #endif 2153 1.1 simonb #endif 2154 1.1 simonb _settextposition(row, 1); 2155 1.1 simonb } 2156 1.1 simonb #endif 2157 1.1 simonb } 2158 1.1 simonb 2159 1.1 simonb /* 2160 1.1 simonb * Check if the console size has changed and reset internals 2161 1.1 simonb * (in lieu of SIGWINCH for WIN32). 2162 1.1 simonb */ 2163 1.1 simonb public void check_winch(void) 2164 1.1 simonb { 2165 1.1 simonb #if MSDOS_COMPILER==WIN32C 2166 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO scr; 2167 1.1 simonb COORD size; 2168 1.1 simonb 2169 1.1 simonb if (con_out == INVALID_HANDLE_VALUE) 2170 1.1 simonb return; 2171 1.1 simonb 2172 1.1 simonb flush(); 2173 1.1 simonb GetConsoleScreenBufferInfo(con_out, &scr); 2174 1.1 simonb size.Y = scr.srWindow.Bottom - scr.srWindow.Top + 1; 2175 1.1 simonb size.X = scr.srWindow.Right - scr.srWindow.Left + 1; 2176 1.1 simonb if (size.Y != sc_height || size.X != sc_width) 2177 1.1 simonb { 2178 1.1 simonb sc_height = size.Y; 2179 1.1 simonb sc_width = size.X; 2180 1.1 simonb if (!no_init && con_out_ours == con_out) 2181 1.1 simonb SetConsoleScreenBufferSize(con_out, size); 2182 1.1 simonb pos_init(); 2183 1.1 simonb wscroll = (sc_height + 1) / 2; 2184 1.1 simonb screen_trashed = 1; 2185 1.1 simonb } 2186 1.1 simonb #endif 2187 1.1 simonb } 2188 1.1 simonb 2189 1.1 simonb /* 2190 1.1 simonb * Goto a specific line on the screen. 2191 1.1 simonb */ 2192 1.1 simonb public void goto_line(int sindex) 2193 1.1 simonb { 2194 1.1 simonb assert_interactive(); 2195 1.1 simonb #if !MSDOS_COMPILER 2196 1.1 simonb ltputs(tgoto(sc_move, 0, sindex), 1, putchr); 2197 1.1 simonb #else 2198 1.1 simonb flush(); 2199 1.1 simonb _settextposition(sindex+1, 1); 2200 1.1 simonb #endif 2201 1.1 simonb } 2202 1.1 simonb 2203 1.1 simonb #if MSDOS_COMPILER==MSOFTC || MSDOS_COMPILER==BORLANDC 2204 1.1 simonb /* 2205 1.1 simonb * Create an alternate screen which is all white. 2206 1.1 simonb * This screen is used to create a "flash" effect, by displaying it 2207 1.1 simonb * briefly and then switching back to the normal screen. 2208 1.1 simonb * {{ Yuck! There must be a better way to get a visual bell. }} 2209 1.1 simonb */ 2210 1.1 simonb static void create_flash(void) 2211 1.1 simonb { 2212 1.1 simonb #if MSDOS_COMPILER==MSOFTC 2213 1.1 simonb struct videoconfig w; 2214 1.1 simonb char *blanks; 2215 1.1 simonb int row, col; 2216 1.1 simonb 2217 1.1 simonb _getvideoconfig(&w); 2218 1.1 simonb videopages = w.numvideopages; 2219 1.1 simonb if (videopages < 2) 2220 1.1 simonb { 2221 1.1 simonb at_enter(AT_STANDOUT); 2222 1.1 simonb at_exit(); 2223 1.1 simonb } else 2224 1.1 simonb { 2225 1.1 simonb _setactivepage(1); 2226 1.1 simonb at_enter(AT_STANDOUT); 2227 1.1 simonb blanks = (char *) ecalloc(w.numtextcols, sizeof(char)); 2228 1.1 simonb for (col = 0; col < w.numtextcols; col++) 2229 1.1 simonb blanks[col] = ' '; 2230 1.1 simonb for (row = w.numtextrows; row > 0; row--) 2231 1.1 simonb _outmem(blanks, w.numtextcols); 2232 1.1 simonb _setactivepage(0); 2233 1.1 simonb _setvisualpage(0); 2234 1.1 simonb free(blanks); 2235 1.1 simonb at_exit(); 2236 1.1 simonb } 2237 1.1 simonb #else 2238 1.1 simonb #if MSDOS_COMPILER==BORLANDC 2239 1.1 simonb int n; 2240 1.1 simonb 2241 1.1 simonb whitescreen = (unsigned short *) 2242 1.1 simonb malloc(sc_width * sc_height * sizeof(short)); 2243 1.1 simonb if (whitescreen == NULL) 2244 1.1 simonb return; 2245 1.1 simonb for (n = 0; n < sc_width * sc_height; n++) 2246 1.1 simonb whitescreen[n] = 0x7020; 2247 1.1 simonb #endif 2248 1.1 simonb #endif 2249 1.1 simonb flash_created = 1; 2250 1.1 simonb } 2251 1.1 simonb #endif /* MSDOS_COMPILER */ 2252 1.1 simonb 2253 1.1 simonb /* 2254 1.1 simonb * Output the "visual bell", if there is one. 2255 1.1 simonb */ 2256 1.1 simonb public void vbell(void) 2257 1.1 simonb { 2258 1.1 simonb if (no_vbell) 2259 1.1 simonb return; 2260 1.1 simonb #if !MSDOS_COMPILER 2261 1.1 simonb if (*sc_visual_bell == '\0') 2262 1.1 simonb return; 2263 1.1 simonb ltputs(sc_visual_bell, sc_height, putchr); 2264 1.1 simonb #else 2265 1.1 simonb #if MSDOS_COMPILER==DJGPPC 2266 1.1 simonb ScreenVisualBell(); 2267 1.1 simonb #else 2268 1.1 simonb #if MSDOS_COMPILER==MSOFTC 2269 1.1 simonb /* 2270 1.1 simonb * Create a flash screen on the second video page. 2271 1.1 simonb * Switch to that page, then switch back. 2272 1.1 simonb */ 2273 1.1 simonb if (!flash_created) 2274 1.1 simonb create_flash(); 2275 1.1 simonb if (videopages < 2) 2276 1.1 simonb return; 2277 1.1 simonb _setvisualpage(1); 2278 1.1 simonb delay(100); 2279 1.1 simonb _setvisualpage(0); 2280 1.1 simonb #else 2281 1.1 simonb #if MSDOS_COMPILER==BORLANDC 2282 1.1 simonb unsigned short *currscreen; 2283 1.1 simonb 2284 1.1 simonb /* 2285 1.1 simonb * Get a copy of the current screen. 2286 1.1 simonb * Display the flash screen. 2287 1.1 simonb * Then restore the old screen. 2288 1.1 simonb */ 2289 1.1 simonb if (!flash_created) 2290 1.1 simonb create_flash(); 2291 1.1 simonb if (whitescreen == NULL) 2292 1.1 simonb return; 2293 1.1 simonb currscreen = (unsigned short *) 2294 1.1 simonb malloc(sc_width * sc_height * sizeof(short)); 2295 1.1 simonb if (currscreen == NULL) return; 2296 1.1 simonb gettext(1, 1, sc_width, sc_height, currscreen); 2297 1.1 simonb puttext(1, 1, sc_width, sc_height, whitescreen); 2298 1.1 simonb delay(100); 2299 1.1 simonb puttext(1, 1, sc_width, sc_height, currscreen); 2300 1.1 simonb free(currscreen); 2301 1.1 simonb #else 2302 1.1 simonb #if MSDOS_COMPILER==WIN32C 2303 1.1 simonb /* paint screen with an inverse color */ 2304 1.1 simonb clear(); 2305 1.1 simonb 2306 1.1 simonb /* leave it displayed for 100 msec. */ 2307 1.1 simonb Sleep(100); 2308 1.1 simonb 2309 1.1 simonb /* restore with a redraw */ 2310 1.1 simonb repaint(); 2311 1.1 simonb #endif 2312 1.1 simonb #endif 2313 1.1 simonb #endif 2314 1.1 simonb #endif 2315 1.1 simonb #endif 2316 1.1 simonb } 2317 1.1 simonb 2318 1.1 simonb /* 2319 1.1 simonb * Make a noise. 2320 1.1 simonb */ 2321 1.1 simonb static void beep(void) 2322 1.1 simonb { 2323 1.1 simonb #if !MSDOS_COMPILER 2324 1.1 simonb putchr(CONTROL('G')); 2325 1.1 simonb #else 2326 1.1 simonb #if MSDOS_COMPILER==WIN32C 2327 1.1 simonb MessageBeep(0); 2328 1.1 simonb #else 2329 1.1 simonb write(1, "\7", 1); 2330 1.1 simonb #endif 2331 1.1 simonb #endif 2332 1.1 simonb } 2333 1.1 simonb 2334 1.1 simonb /* 2335 1.1 simonb * Ring the terminal bell. 2336 1.1 simonb */ 2337 1.1 simonb public void bell(void) 2338 1.1 simonb { 2339 1.1 simonb if (quiet == VERY_QUIET) 2340 1.1 simonb vbell(); 2341 1.1 simonb else 2342 1.1 simonb beep(); 2343 1.1 simonb } 2344 1.1 simonb 2345 1.1 simonb /* 2346 1.1 simonb * Clear the screen. 2347 1.1 simonb */ 2348 1.1 simonb public void clear(void) 2349 1.1 simonb { 2350 1.1 simonb assert_interactive(); 2351 1.1 simonb #if !MSDOS_COMPILER 2352 1.1 simonb ltputs(sc_clear, sc_height, putchr); 2353 1.1 simonb #else 2354 1.1 simonb flush(); 2355 1.1 simonb #if MSDOS_COMPILER==WIN32C 2356 1.1 simonb win32_clear(); 2357 1.1 simonb #else 2358 1.1 simonb _clearscreen(_GCLEARSCREEN); 2359 1.1 simonb #endif 2360 1.1 simonb #endif 2361 1.1 simonb } 2362 1.1 simonb 2363 1.1 simonb /* 2364 1.1 simonb * Clear from the cursor to the end of the cursor's line. 2365 1.1 simonb * {{ This must not move the cursor. }} 2366 1.1 simonb */ 2367 1.1 simonb public void clear_eol(void) 2368 1.1 simonb { 2369 1.1 simonb /* assert_interactive();*/ 2370 1.1 simonb #if !MSDOS_COMPILER 2371 1.1 simonb ltputs(sc_eol_clear, 1, putchr); 2372 1.1 simonb #else 2373 1.1 simonb #if MSDOS_COMPILER==MSOFTC 2374 1.1 simonb short top, left; 2375 1.1 simonb short bot, right; 2376 1.1 simonb struct rccoord tpos; 2377 1.1 simonb 2378 1.1 simonb flush(); 2379 1.1 simonb /* 2380 1.1 simonb * Save current state. 2381 1.1 simonb */ 2382 1.1 simonb tpos = _gettextposition(); 2383 1.1 simonb _gettextwindow(&top, &left, &bot, &right); 2384 1.1 simonb /* 2385 1.1 simonb * Set a temporary window to the current line, 2386 1.1 simonb * from the cursor's position to the right edge of the screen. 2387 1.1 simonb * Then clear that window. 2388 1.1 simonb */ 2389 1.1 simonb _settextwindow(tpos.row, tpos.col, tpos.row, sc_width); 2390 1.1 simonb _clearscreen(_GWINDOW); 2391 1.1 simonb /* 2392 1.1 simonb * Restore state. 2393 1.1 simonb */ 2394 1.1 simonb _settextwindow(top, left, bot, right); 2395 1.1 simonb _settextposition(tpos.row, tpos.col); 2396 1.1 simonb #else 2397 1.1 simonb #if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC 2398 1.1 simonb flush(); 2399 1.1 simonb clreol(); 2400 1.1 simonb #else 2401 1.1 simonb #if MSDOS_COMPILER==WIN32C 2402 1.1 simonb DWORD nchars; 2403 1.1 simonb COORD cpos; 2404 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO scr; 2405 1.1 simonb 2406 1.1 simonb flush(); 2407 1.1 simonb memset(&scr, 0, sizeof(scr)); 2408 1.1 simonb GetConsoleScreenBufferInfo(con_out, &scr); 2409 1.1 simonb cpos.X = scr.dwCursorPosition.X; 2410 1.1 simonb cpos.Y = scr.dwCursorPosition.Y; 2411 1.1 simonb curr_attr = MAKEATTR(nm_fg_color, nm_bg_color); 2412 1.1 simonb FillConsoleOutputAttribute(con_out, curr_attr, 2413 1.1 simonb scr.dwSize.X - cpos.X, cpos, &nchars); 2414 1.1 simonb FillConsoleOutputCharacter(con_out, ' ', 2415 1.1 simonb scr.dwSize.X - cpos.X, cpos, &nchars); 2416 1.1 simonb #endif 2417 1.1 simonb #endif 2418 1.1 simonb #endif 2419 1.1 simonb #endif 2420 1.1 simonb } 2421 1.1 simonb 2422 1.1 simonb /* 2423 1.1 simonb * Clear the current line. 2424 1.1 simonb * Clear the screen if there's off-screen memory below the display. 2425 1.1 simonb */ 2426 1.1 simonb static void clear_eol_bot(void) 2427 1.1 simonb { 2428 1.1 simonb assert_interactive(); 2429 1.1 simonb #if MSDOS_COMPILER 2430 1.1 simonb clear_eol(); 2431 1.1 simonb #else 2432 1.1 simonb if (below_mem) 2433 1.1 simonb ltputs(sc_eos_clear, 1, putchr); 2434 1.1 simonb else 2435 1.1 simonb ltputs(sc_eol_clear, 1, putchr); 2436 1.1 simonb #endif 2437 1.1 simonb } 2438 1.1 simonb 2439 1.1 simonb /* 2440 1.1 simonb * Clear the bottom line of the display. 2441 1.1 simonb * Leave the cursor at the beginning of the bottom line. 2442 1.1 simonb */ 2443 1.1 simonb public void clear_bot(void) 2444 1.1 simonb { 2445 1.1 simonb /* 2446 1.1 simonb * If we're in a non-normal attribute mode, temporarily exit 2447 1.1 simonb * the mode while we do the clear. Some terminals fill the 2448 1.1 simonb * cleared area with the current attribute. 2449 1.1 simonb */ 2450 1.1 simonb if (oldbot) 2451 1.1 simonb lower_left(); 2452 1.1 simonb else 2453 1.1 simonb line_left(); 2454 1.1 simonb 2455 1.1 simonb if (attrmode == AT_NORMAL) 2456 1.1 simonb clear_eol_bot(); 2457 1.1 simonb else 2458 1.1 simonb { 2459 1.1 simonb int saved_attrmode = attrmode; 2460 1.1 simonb 2461 1.1 simonb at_exit(); 2462 1.1 simonb clear_eol_bot(); 2463 1.1 simonb at_enter(saved_attrmode); 2464 1.1 simonb } 2465 1.1 simonb } 2466 1.1 simonb 2467 1.1 simonb /* 2468 1.1 simonb * Color string may be "x[y]" where x and y are 4-bit color chars, 2469 1.1 simonb * or "N[.M]" where N and M are decimal integers> 2470 1.1 simonb * Any of x,y,N,M may also be "-" to mean "unchanged". 2471 1.1 simonb */ 2472 1.1 simonb 2473 1.1 simonb /* 2474 1.1 simonb * Parse a 4-bit color char. 2475 1.1 simonb */ 2476 1.1 simonb static int parse_color4(char ch) 2477 1.1 simonb { 2478 1.1 simonb switch (ch) 2479 1.1 simonb { 2480 1.1 simonb case 'k': return 0; 2481 1.1 simonb case 'r': return CV_RED; 2482 1.1 simonb case 'g': return CV_GREEN; 2483 1.1 simonb case 'y': return CV_RED|CV_GREEN; 2484 1.1 simonb case 'b': return CV_BLUE; 2485 1.1 simonb case 'm': return CV_RED|CV_BLUE; 2486 1.1 simonb case 'c': return CV_GREEN|CV_BLUE; 2487 1.1 simonb case 'w': return CV_RED|CV_GREEN|CV_BLUE; 2488 1.1 simonb case 'K': return 0|CV_BRIGHT; 2489 1.1 simonb case 'R': return CV_RED|CV_BRIGHT; 2490 1.1 simonb case 'G': return CV_GREEN|CV_BRIGHT; 2491 1.1 simonb case 'Y': return CV_RED|CV_GREEN|CV_BRIGHT; 2492 1.1 simonb case 'B': return CV_BLUE|CV_BRIGHT; 2493 1.1 simonb case 'M': return CV_RED|CV_BLUE|CV_BRIGHT; 2494 1.1 simonb case 'C': return CV_GREEN|CV_BLUE|CV_BRIGHT; 2495 1.1 simonb case 'W': return CV_RED|CV_GREEN|CV_BLUE|CV_BRIGHT; 2496 1.1 simonb case '-': return CV_NOCHANGE; 2497 1.1 simonb default: return CV_ERROR; 2498 1.1 simonb } 2499 1.1 simonb } 2500 1.1 simonb 2501 1.1 simonb /* 2502 1.1 simonb * Parse a color as a decimal integer. 2503 1.1 simonb */ 2504 1.1 simonb static int parse_color6(char **ps) 2505 1.1 simonb { 2506 1.1 simonb if (**ps == '-') 2507 1.1 simonb { 2508 1.1 simonb (*ps)++; 2509 1.1 simonb return CV_NOCHANGE; 2510 1.1 simonb } else 2511 1.1 simonb { 2512 1.1 simonb char *ops = *ps; 2513 1.1 simonb int color = lstrtoi(ops, ps, 10); 2514 1.1 simonb if (color < 0 || *ps == ops) 2515 1.1 simonb return CV_ERROR; 2516 1.1 simonb return color; 2517 1.1 simonb } 2518 1.1 simonb } 2519 1.1 simonb 2520 1.1 simonb /* 2521 1.1 simonb * Parse a color pair and return the foreground/background values. 2522 1.1 simonb * Return type of color specifier: 2523 1.1 simonb * CV_4BIT: fg/bg values are OR of CV_{RGB} bits. 2524 1.1 simonb * CV_6BIT: fg/bg values are integers entered by user. 2525 1.1 simonb */ 2526 1.1 simonb public COLOR_TYPE parse_color(char *str, int *p_fg, int *p_bg) 2527 1.1 simonb { 2528 1.1 simonb int fg; 2529 1.1 simonb int bg; 2530 1.1 simonb COLOR_TYPE type = CT_NULL; 2531 1.1 simonb 2532 1.1 simonb if (str == NULL || *str == '\0') 2533 1.1 simonb return CT_NULL; 2534 1.1 simonb if (*str == '+') 2535 1.1 simonb str++; /* ignore leading + */ 2536 1.1 simonb 2537 1.1 simonb fg = parse_color4(str[0]); 2538 1.1 simonb bg = parse_color4((strlen(str) < 2) ? '-' : str[1]); 2539 1.1 simonb if (fg != CV_ERROR && bg != CV_ERROR) 2540 1.1 simonb type = CT_4BIT; 2541 1.1 simonb else 2542 1.1 simonb { 2543 1.1 simonb fg = parse_color6(&str); 2544 1.1 simonb bg = (fg != CV_ERROR && *str++ == '.') ? parse_color6(&str) : CV_NOCHANGE; 2545 1.1 simonb if (fg != CV_ERROR && bg != CV_ERROR) 2546 1.1 simonb type = CT_6BIT; 2547 1.1 simonb } 2548 1.1 simonb if (p_fg != NULL) *p_fg = fg; 2549 1.1 simonb if (p_bg != NULL) *p_bg = bg; 2550 1.1 simonb return type; 2551 1.1 simonb } 2552 1.1 simonb 2553 1.1 simonb #if !MSDOS_COMPILER 2554 1.1 simonb 2555 1.1 simonb static int sgr_color(int color) 2556 1.1 simonb { 2557 1.1 simonb switch (color) 2558 1.1 simonb { 2559 1.1 simonb case 0: return 30; 2560 1.1 simonb case CV_RED: return 31; 2561 1.1 simonb case CV_GREEN: return 32; 2562 1.1 simonb case CV_RED|CV_GREEN: return 33; 2563 1.1 simonb case CV_BLUE: return 34; 2564 1.1 simonb case CV_RED|CV_BLUE: return 35; 2565 1.1 simonb case CV_GREEN|CV_BLUE: return 36; 2566 1.1 simonb case CV_RED|CV_GREEN|CV_BLUE: return 37; 2567 1.1 simonb 2568 1.1 simonb case CV_BRIGHT: return 90; 2569 1.1 simonb case CV_RED|CV_BRIGHT: return 91; 2570 1.1 simonb case CV_GREEN|CV_BRIGHT: return 92; 2571 1.1 simonb case CV_RED|CV_GREEN|CV_BRIGHT: return 93; 2572 1.1 simonb case CV_BLUE|CV_BRIGHT: return 94; 2573 1.1 simonb case CV_RED|CV_BLUE|CV_BRIGHT: return 95; 2574 1.1 simonb case CV_GREEN|CV_BLUE|CV_BRIGHT: return 96; 2575 1.1 simonb case CV_RED|CV_GREEN|CV_BLUE|CV_BRIGHT: return 97; 2576 1.1 simonb 2577 1.1 simonb default: return color; 2578 1.1 simonb } 2579 1.1 simonb } 2580 1.1 simonb 2581 1.1 simonb static void tput_fmt(char *fmt, int color, int (*f_putc)(int)) 2582 1.1 simonb { 2583 1.1 simonb char buf[INT_STRLEN_BOUND(int)+16]; 2584 1.1 simonb if (color == attrcolor) 2585 1.1 simonb return; 2586 1.1 simonb SNPRINTF1(buf, sizeof(buf), fmt, color); 2587 1.1 simonb ltputs(buf, 1, f_putc); 2588 1.1 simonb attrcolor = color; 2589 1.1 simonb } 2590 1.1 simonb 2591 1.1 simonb static void tput_color(char *str, int (*f_putc)(int)) 2592 1.1 simonb { 2593 1.1 simonb int fg; 2594 1.1 simonb int bg; 2595 1.1 simonb 2596 1.1 simonb if (str != NULL && strcmp(str, "*") == 0) 2597 1.1 simonb { 2598 1.1 simonb /* Special case: reset to normal */ 2599 1.1 simonb tput_fmt(ESCS"[m", -1, f_putc); 2600 1.1 simonb return; 2601 1.1 simonb } 2602 1.1 simonb switch (parse_color(str, &fg, &bg)) 2603 1.1 simonb { 2604 1.1 simonb case CT_4BIT: 2605 1.1 simonb if (fg >= 0) 2606 1.1 simonb tput_fmt(ESCS"[%dm", sgr_color(fg), f_putc); 2607 1.1 simonb if (bg >= 0) 2608 1.1 simonb tput_fmt(ESCS"[%dm", sgr_color(bg)+10, f_putc); 2609 1.1 simonb break; 2610 1.1 simonb case CT_6BIT: 2611 1.1 simonb if (fg >= 0) 2612 1.1 simonb tput_fmt(ESCS"[38;5;%dm", fg, f_putc); 2613 1.1 simonb if (bg >= 0) 2614 1.1 simonb tput_fmt(ESCS"[48;5;%dm", bg, f_putc); 2615 1.1 simonb break; 2616 1.1 simonb default: 2617 1.1 simonb break; 2618 1.1 simonb } 2619 1.1 simonb } 2620 1.1 simonb 2621 1.1 simonb static void tput_inmode(char *mode_str, int attr, int attr_bit, int (*f_putc)(int)) 2622 1.1 simonb { 2623 1.1 simonb char *color_str; 2624 1.1 simonb if ((attr & attr_bit) == 0) 2625 1.1 simonb return; 2626 1.1 simonb color_str = get_color_map(attr_bit); 2627 1.1 simonb if (color_str == NULL || *color_str == '\0' || *color_str == '+') 2628 1.1 simonb { 2629 1.1 simonb ltputs(mode_str, 1, f_putc); 2630 1.1 simonb if (color_str == NULL || *color_str++ != '+') 2631 1.1 simonb return; 2632 1.1 simonb } 2633 1.1 simonb /* Color overrides mode string */ 2634 1.1 simonb tput_color(color_str, f_putc); 2635 1.1 simonb } 2636 1.1 simonb 2637 1.1 simonb static void tput_outmode(char *mode_str, int attr_bit, int (*f_putc)(int)) 2638 1.1 simonb { 2639 1.1 simonb if ((attrmode & attr_bit) == 0) 2640 1.1 simonb return; 2641 1.1 simonb ltputs(mode_str, 1, f_putc); 2642 1.1 simonb } 2643 1.1 simonb 2644 1.1 simonb #else /* MSDOS_COMPILER */ 2645 1.1 simonb 2646 1.1 simonb #if MSDOS_COMPILER==WIN32C 2647 1.1 simonb static int WIN32put_fmt(char *fmt, int color) 2648 1.1 simonb { 2649 1.1 simonb char buf[INT_STRLEN_BOUND(int)+16]; 2650 1.1 simonb int len = SNPRINTF1(buf, sizeof(buf), fmt, color); 2651 1.1 simonb WIN32textout(buf, len); 2652 1.1 simonb return TRUE; 2653 1.1 simonb } 2654 1.1 simonb #endif 2655 1.1 simonb 2656 1.1 simonb static int win_set_color(int attr) 2657 1.1 simonb { 2658 1.1 simonb int fg; 2659 1.1 simonb int bg; 2660 1.1 simonb int out = FALSE; 2661 1.1 simonb char *str = get_color_map(attr); 2662 1.1 simonb if (str == NULL || str[0] == '\0') 2663 1.1 simonb return FALSE; 2664 1.1 simonb switch (parse_color(str, &fg, &bg)) 2665 1.1 simonb { 2666 1.1 simonb case CT_4BIT: 2667 1.1 simonb if (fg >= 0 && bg >= 0) 2668 1.1 simonb { 2669 1.1 simonb SETCOLORS(fg, bg); 2670 1.1 simonb out = TRUE; 2671 1.1 simonb } else if (fg >= 0) 2672 1.1 simonb { 2673 1.1 simonb SET_FG_COLOR(fg); 2674 1.1 simonb out = TRUE; 2675 1.1 simonb } else if (bg >= 0) 2676 1.1 simonb { 2677 1.1 simonb SET_BG_COLOR(bg); 2678 1.1 simonb out = TRUE; 2679 1.1 simonb } 2680 1.1 simonb break; 2681 1.1 simonb #if MSDOS_COMPILER==WIN32C 2682 1.1 simonb case CT_6BIT: 2683 1.1 simonb if (vt_enabled) 2684 1.1 simonb { 2685 1.1 simonb if (fg > 0) 2686 1.1 simonb out = WIN32put_fmt(ESCS"[38;5;%dm", fg); 2687 1.1 simonb if (bg > 0) 2688 1.1 simonb out = WIN32put_fmt(ESCS"[48;5;%dm", bg); 2689 1.1 simonb } 2690 1.1 simonb break; 2691 1.1 simonb #endif 2692 1.1 simonb default: 2693 1.1 simonb break; 2694 1.1 simonb } 2695 1.1 simonb return out; 2696 1.1 simonb } 2697 1.1 simonb 2698 1.1 simonb #endif /* MSDOS_COMPILER */ 2699 1.1 simonb 2700 1.1 simonb public void at_enter(int attr) 2701 1.1 simonb { 2702 1.1 simonb attr = apply_at_specials(attr); 2703 1.1 simonb #if !MSDOS_COMPILER 2704 1.1 simonb /* The one with the most priority is last. */ 2705 1.1 simonb tput_inmode(sc_u_in, attr, AT_UNDERLINE, putchr); 2706 1.1 simonb tput_inmode(sc_b_in, attr, AT_BOLD, putchr); 2707 1.1 simonb tput_inmode(sc_bl_in, attr, AT_BLINK, putchr); 2708 1.1 simonb /* Don't use standout and color at the same time. */ 2709 1.1 simonb if (use_color && (attr & AT_COLOR)) 2710 1.1 simonb tput_color(get_color_map(attr), putchr); 2711 1.1 simonb else 2712 1.1 simonb tput_inmode(sc_s_in, attr, AT_STANDOUT, putchr); 2713 1.1 simonb #else 2714 1.1 simonb flush(); 2715 1.1 simonb /* The one with the most priority is first. */ 2716 1.1 simonb if ((attr & AT_COLOR) && use_color) 2717 1.1 simonb { 2718 1.1 simonb win_set_color(attr); 2719 1.1 simonb } else if (attr & AT_STANDOUT) 2720 1.1 simonb { 2721 1.1 simonb SETCOLORS(so_fg_color, so_bg_color); 2722 1.1 simonb } else if (attr & AT_BLINK) 2723 1.1 simonb { 2724 1.1 simonb SETCOLORS(bl_fg_color, bl_bg_color); 2725 1.1 simonb } else if (attr & AT_BOLD) 2726 1.1 simonb { 2727 1.1 simonb SETCOLORS(bo_fg_color, bo_bg_color); 2728 1.1 simonb } else if (attr & AT_UNDERLINE) 2729 1.1 simonb { 2730 1.1 simonb SETCOLORS(ul_fg_color, ul_bg_color); 2731 1.1 simonb } 2732 1.1 simonb #endif 2733 1.1 simonb attrmode = attr; 2734 1.1 simonb } 2735 1.1 simonb 2736 1.1 simonb public void at_exit(void) 2737 1.1 simonb { 2738 1.1 simonb #if !MSDOS_COMPILER 2739 1.1 simonb /* Undo things in the reverse order we did them. */ 2740 1.1 simonb tput_color("*", putchr); 2741 1.1 simonb tput_outmode(sc_s_out, AT_STANDOUT, putchr); 2742 1.1 simonb tput_outmode(sc_bl_out, AT_BLINK, putchr); 2743 1.1 simonb tput_outmode(sc_b_out, AT_BOLD, putchr); 2744 1.1 simonb tput_outmode(sc_u_out, AT_UNDERLINE, putchr); 2745 1.1 simonb #else 2746 1.1 simonb flush(); 2747 1.1 simonb SETCOLORS(nm_fg_color, nm_bg_color); 2748 1.1 simonb #endif 2749 1.1 simonb attrmode = AT_NORMAL; 2750 1.1 simonb } 2751 1.1 simonb 2752 1.1 simonb public void at_switch(int attr) 2753 1.1 simonb { 2754 1.1 simonb int new_attrmode = apply_at_specials(attr); 2755 1.1 simonb int ignore_modes = AT_ANSI; 2756 1.1 simonb 2757 1.1 simonb if ((new_attrmode & ~ignore_modes) != (attrmode & ~ignore_modes)) 2758 1.1 simonb { 2759 1.1 simonb at_exit(); 2760 1.1 simonb at_enter(attr); 2761 1.1 simonb } 2762 1.1 simonb } 2763 1.1 simonb 2764 1.1 simonb public int is_at_equiv(int attr1, int attr2) 2765 1.1 simonb { 2766 1.1 simonb attr1 = apply_at_specials(attr1); 2767 1.1 simonb attr2 = apply_at_specials(attr2); 2768 1.1 simonb 2769 1.1 simonb return (attr1 == attr2); 2770 1.1 simonb } 2771 1.1 simonb 2772 1.1 simonb public int apply_at_specials(int attr) 2773 1.1 simonb { 2774 1.1 simonb if (attr & AT_BINARY) 2775 1.1 simonb attr |= binattr; 2776 1.1 simonb if (attr & AT_HILITE) 2777 1.1 simonb attr |= AT_STANDOUT; 2778 1.1 simonb attr &= ~(AT_BINARY|AT_HILITE); 2779 1.1 simonb 2780 1.1 simonb return attr; 2781 1.1 simonb } 2782 1.1 simonb 2783 1.1 simonb /* 2784 1.1 simonb * Output a plain backspace, without erasing the previous char. 2785 1.1 simonb */ 2786 1.1 simonb public void putbs(void) 2787 1.1 simonb { 2788 1.1 simonb if (termcap_debug) 2789 1.1 simonb putstr("<bs>"); 2790 1.1 simonb else 2791 1.1 simonb { 2792 1.1 simonb #if !MSDOS_COMPILER 2793 1.1 simonb ltputs(sc_backspace, 1, putchr); 2794 1.1 simonb #else 2795 1.1 simonb int row, col; 2796 1.1 simonb 2797 1.1 simonb flush(); 2798 1.1 simonb { 2799 1.1 simonb #if MSDOS_COMPILER==MSOFTC 2800 1.1 simonb struct rccoord tpos; 2801 1.1 simonb tpos = _gettextposition(); 2802 1.1 simonb row = tpos.row; 2803 1.1 simonb col = tpos.col; 2804 1.1 simonb #else 2805 1.1 simonb #if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC 2806 1.1 simonb row = wherey(); 2807 1.1 simonb col = wherex(); 2808 1.1 simonb #else 2809 1.1 simonb #if MSDOS_COMPILER==WIN32C 2810 1.1 simonb CONSOLE_SCREEN_BUFFER_INFO scr; 2811 1.1 simonb GetConsoleScreenBufferInfo(con_out, &scr); 2812 1.1 simonb row = scr.dwCursorPosition.Y - scr.srWindow.Top + 1; 2813 1.1 simonb col = scr.dwCursorPosition.X - scr.srWindow.Left + 1; 2814 1.1 simonb #endif 2815 1.1 simonb #endif 2816 1.1 simonb #endif 2817 1.1 simonb } 2818 1.1 simonb if (col <= 1) 2819 1.1 simonb return; 2820 1.1 simonb _settextposition(row, col-1); 2821 1.1 simonb #endif /* MSDOS_COMPILER */ 2822 1.1 simonb } 2823 1.1 simonb } 2824 1.1 simonb 2825 1.1 simonb #if MSDOS_COMPILER==WIN32C 2826 1.1 simonb /* 2827 1.1 simonb * Determine whether an input character is waiting to be read. 2828 1.1 simonb */ 2829 1.1 simonb public int win32_kbhit(void) 2830 1.1 simonb { 2831 1.1 simonb INPUT_RECORD ip; 2832 1.1 simonb DWORD read; 2833 1.1 simonb 2834 1.1 simonb if (keyCount > 0) 2835 1.1 simonb return (TRUE); 2836 1.1 simonb 2837 1.1 simonb currentKey.ascii = 0; 2838 1.1 simonb currentKey.scan = 0; 2839 1.1 simonb 2840 1.1 simonb if (x11mouseCount > 0) 2841 1.1 simonb { 2842 1.1 simonb currentKey.ascii = x11mousebuf[x11mousePos++]; 2843 1.1 simonb --x11mouseCount; 2844 1.1 simonb keyCount = 1; 2845 1.1 simonb return (TRUE); 2846 1.1 simonb } 2847 1.1 simonb 2848 1.1 simonb /* 2849 1.1 simonb * Wait for a real key-down event, but 2850 1.1 simonb * ignore SHIFT and CONTROL key events. 2851 1.1 simonb */ 2852 1.1 simonb do 2853 1.1 simonb { 2854 1.1 simonb PeekConsoleInputW(tty, &ip, 1, &read); 2855 1.1 simonb if (read == 0) 2856 1.1 simonb return (FALSE); 2857 1.1 simonb ReadConsoleInputW(tty, &ip, 1, &read); 2858 1.1 simonb /* generate an X11 mouse sequence from the mouse event */ 2859 1.1 simonb if (mousecap && ip.EventType == MOUSE_EVENT && 2860 1.1 simonb ip.Event.MouseEvent.dwEventFlags != MOUSE_MOVED) 2861 1.1 simonb { 2862 1.1 simonb x11mousebuf[3] = X11MOUSE_OFFSET + ip.Event.MouseEvent.dwMousePosition.X + 1; 2863 1.1 simonb x11mousebuf[4] = X11MOUSE_OFFSET + ip.Event.MouseEvent.dwMousePosition.Y + 1; 2864 1.1 simonb switch (ip.Event.MouseEvent.dwEventFlags) 2865 1.1 simonb { 2866 1.1 simonb case 0: /* press or release */ 2867 1.1 simonb if (ip.Event.MouseEvent.dwButtonState == 0) 2868 1.1 simonb x11mousebuf[2] = X11MOUSE_OFFSET + X11MOUSE_BUTTON_REL; 2869 1.1 simonb else if (ip.Event.MouseEvent.dwButtonState & (FROM_LEFT_3RD_BUTTON_PRESSED | FROM_LEFT_4TH_BUTTON_PRESSED)) 2870 1.1 simonb continue; 2871 1.1 simonb else 2872 1.1 simonb x11mousebuf[2] = X11MOUSE_OFFSET + X11MOUSE_BUTTON1 + ((int)ip.Event.MouseEvent.dwButtonState << 1); 2873 1.1 simonb break; 2874 1.1 simonb case MOUSE_WHEELED: 2875 1.1 simonb x11mousebuf[2] = X11MOUSE_OFFSET + (((int)ip.Event.MouseEvent.dwButtonState < 0) ? X11MOUSE_WHEEL_DOWN : X11MOUSE_WHEEL_UP); 2876 1.1 simonb break; 2877 1.1 simonb default: 2878 1.1 simonb continue; 2879 1.1 simonb } 2880 1.1 simonb x11mousePos = 0; 2881 1.1 simonb x11mouseCount = 5; 2882 1.1 simonb currentKey.ascii = ESC; 2883 1.1 simonb keyCount = 1; 2884 1.1 simonb return (TRUE); 2885 1.1 simonb } 2886 1.1 simonb } while (ip.EventType != KEY_EVENT || 2887 1.1 simonb ip.Event.KeyEvent.bKeyDown != TRUE || 2888 1.1 simonb (ip.Event.KeyEvent.wVirtualScanCode == 0 && ip.Event.KeyEvent.uChar.UnicodeChar == 0) || 2889 1.1 simonb ((ip.Event.KeyEvent.dwControlKeyState & (RIGHT_ALT_PRESSED|LEFT_CTRL_PRESSED)) == (RIGHT_ALT_PRESSED|LEFT_CTRL_PRESSED) && ip.Event.KeyEvent.uChar.UnicodeChar == 0) || 2890 1.1 simonb ip.Event.KeyEvent.wVirtualKeyCode == VK_KANJI || 2891 1.1 simonb ip.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT || 2892 1.1 simonb ip.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL || 2893 1.1 simonb ip.Event.KeyEvent.wVirtualKeyCode == VK_MENU); 2894 1.1 simonb 2895 1.1 simonb currentKey.unicode = ip.Event.KeyEvent.uChar.UnicodeChar; 2896 1.1 simonb currentKey.ascii = ip.Event.KeyEvent.uChar.AsciiChar; 2897 1.1 simonb currentKey.scan = ip.Event.KeyEvent.wVirtualScanCode; 2898 1.1 simonb keyCount = ip.Event.KeyEvent.wRepeatCount; 2899 1.1 simonb 2900 1.1 simonb if (ip.Event.KeyEvent.dwControlKeyState & 2901 1.1 simonb (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) 2902 1.1 simonb { 2903 1.1 simonb switch (currentKey.scan) 2904 1.1 simonb { 2905 1.1 simonb case PCK_ALT_E: /* letter 'E' */ 2906 1.1 simonb currentKey.ascii = 0; 2907 1.1 simonb break; 2908 1.1 simonb } 2909 1.1 simonb } else if (ip.Event.KeyEvent.dwControlKeyState & 2910 1.1 simonb (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) 2911 1.1 simonb { 2912 1.1 simonb switch (currentKey.scan) 2913 1.1 simonb { 2914 1.1 simonb case PCK_RIGHT: /* right arrow */ 2915 1.1 simonb currentKey.scan = PCK_CTL_RIGHT; 2916 1.1 simonb break; 2917 1.1 simonb case PCK_LEFT: /* left arrow */ 2918 1.1 simonb currentKey.scan = PCK_CTL_LEFT; 2919 1.1 simonb break; 2920 1.1 simonb case PCK_DELETE: /* delete */ 2921 1.1 simonb currentKey.scan = PCK_CTL_DELETE; 2922 1.1 simonb break; 2923 1.1 simonb } 2924 1.1 simonb } else if (ip.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED) 2925 1.1 simonb { 2926 1.1 simonb switch (currentKey.scan) 2927 1.1 simonb { 2928 1.1 simonb case PCK_SHIFT_TAB: /* tab */ 2929 1.1 simonb currentKey.ascii = 0; 2930 1.1 simonb break; 2931 1.1 simonb } 2932 1.1 simonb } 2933 1.1 simonb 2934 1.1 simonb return (TRUE); 2935 1.1 simonb } 2936 1.1 simonb 2937 1.1 simonb /* 2938 1.1 simonb * Read a character from the keyboard. 2939 1.1 simonb */ 2940 1.1 simonb public char WIN32getch(void) 2941 1.1 simonb { 2942 1.1 simonb char ascii; 2943 1.1 simonb static unsigned char utf8[UTF8_MAX_LENGTH]; 2944 1.1 simonb static int utf8_size = 0; 2945 1.1 simonb static int utf8_next_byte = 0; 2946 1.1 simonb 2947 1.1 simonb // Return the rest of multibyte character from the prior call 2948 1.1 simonb if (utf8_next_byte < utf8_size) 2949 1.1 simonb { 2950 1.1 simonb ascii = utf8[utf8_next_byte++]; 2951 1.1 simonb return ascii; 2952 1.1 simonb } 2953 1.1 simonb utf8_size = 0; 2954 1.1 simonb 2955 1.1 simonb if (pending_scancode) 2956 1.1 simonb { 2957 1.1 simonb pending_scancode = 0; 2958 1.1 simonb return ((char)(currentKey.scan & 0x00FF)); 2959 1.1 simonb } 2960 1.1 simonb 2961 1.1 simonb do { 2962 1.1 simonb while (win32_kbhit() == FALSE) 2963 1.1 simonb { 2964 1.1 simonb Sleep(20); 2965 1.1 simonb if (ABORT_SIGS()) 2966 1.1 simonb return ('\003'); 2967 1.1 simonb continue; 2968 1.1 simonb } 2969 1.1 simonb keyCount --; 2970 1.1 simonb // If multibyte character, return its first byte 2971 1.1 simonb if (currentKey.ascii != currentKey.unicode) 2972 1.1 simonb { 2973 1.1 simonb utf8_size = WideCharToMultiByte(CP_UTF8, 0, ¤tKey.unicode, 1, &utf8, sizeof(utf8), NULL, NULL); 2974 1.1 simonb if (utf8_size == 0 ) 2975 1.1 simonb return '\0'; 2976 1.1 simonb ascii = utf8[0]; 2977 1.1 simonb utf8_next_byte = 1; 2978 1.1 simonb } else 2979 1.1 simonb ascii = currentKey.ascii; 2980 1.1 simonb /* 2981 1.1 simonb * On PC's, the extended keys return a 2 byte sequence beginning 2982 1.1 simonb * with '00', so if the ascii code is 00, the next byte will be 2983 1.1 simonb * the lsb of the scan code. 2984 1.1 simonb */ 2985 1.1 simonb pending_scancode = (ascii == 0x00); 2986 1.1 simonb } while (pending_scancode && 2987 1.1 simonb (currentKey.scan == PCK_CAPS_LOCK || currentKey.scan == PCK_NUM_LOCK)); 2988 1.1 simonb 2989 1.1 simonb return ascii; 2990 1.1 simonb } 2991 1.1 simonb #endif 2992 1.1 simonb 2993 1.1 simonb #if MSDOS_COMPILER 2994 1.1 simonb /* 2995 1.1 simonb */ 2996 1.1 simonb public void WIN32setcolors(int fg, int bg) 2997 1.1 simonb { 2998 1.1 simonb SETCOLORS(fg, bg); 2999 1.1 simonb } 3000 1.1 simonb 3001 1.1 simonb /* 3002 1.1 simonb */ 3003 1.1 simonb public void WIN32textout(char *text, int len) 3004 1.1 simonb { 3005 1.1 simonb #if MSDOS_COMPILER==WIN32C 3006 1.1 simonb DWORD written; 3007 1.1 simonb if (utf_mode == 2) 3008 1.1 simonb { 3009 1.1 simonb /* 3010 1.1 simonb * We've got UTF-8 text in a non-UTF-8 console. Convert it to 3011 1.1 simonb * wide and use WriteConsoleW. 3012 1.1 simonb */ 3013 1.1 simonb WCHAR wtext[1024]; 3014 1.1 simonb len = MultiByteToWideChar(CP_UTF8, 0, text, len, wtext, 3015 1.1 simonb sizeof(wtext)/sizeof(*wtext)); 3016 1.1 simonb WriteConsoleW(con_out, wtext, len, &written, NULL); 3017 1.1 simonb } else 3018 1.1 simonb WriteConsole(con_out, text, len, &written, NULL); 3019 1.1 simonb #else 3020 1.1 simonb char c = text[len]; 3021 1.1 simonb text[len] = '\0'; 3022 1.1 simonb cputs(text); 3023 1.1 simonb text[len] = c; 3024 1.1 simonb #endif 3025 1.1 simonb } 3026 1.1 simonb #endif 3027 1.1 simonb 3028 1.1 simonb R 3029 1.1 simonb =/*_____________________________________________________________________________________________ * Copyright (C) 1984-2023 Mark Nudelman______________________________________________________ *_____________________________________________________________________________________________ * You may distribute under the terms of either the GNU General Public_________________________ * License or the Less License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which deal with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "less.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________@04subsearch@00#______________________________________________________________________________________ 3030 1.1 simonb +6a 3031 1.1 simonb = * Copyright (C) 1984-2023 Mark Nudelman______________________________________________________ *_____________________________________________________________________________________________ * You may distribute under the terms of either the GNU General Public_________________________ * License or the Less License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which deal with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "less.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________:#______________________________________________________________________________________________ 3032 1.1 simonb +6a 3033 1.1 simonb = *_____________________________________________________________________________________________ * You may distribute under the terms of either the GNU General Public_________________________ * License or the Less License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which deal with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "less.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________:#______________________________________________________________________________________________ 3034 1.1 simonb +2f 3035 1.1 simonb = *_____________________________________________________________________________________________ * You may distribute under the terms of either the GNU General Public_________________________ * License or the Less License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which deal with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "less.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________/#______________________________________________________________________________________________ 3036 1.1 simonb +65 3037 1.1 simonb = *_____________________________________________________________________________________________ * You may distribute under the terms of either the GNU General Public_________________________ * License or the Less License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which deal with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "less.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________/e#_____________________________________________________________________________________________ 3038 1.1 simonb +73 3039 1.1 simonb = *_____________________________________________________________________________________________ * You may distribute under the terms of either the GNU General Public_________________________ * License or the Less License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which deal with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "less.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________/es#____________________________________________________________________________________________ 3040 1.1 simonb +a 3041 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________:#______________________________________________________________________________________________ 3042 1.1 simonb +2f 3043 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________/#______________________________________________________________________________________________ 3044 1.1 simonb +e 3045 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match /#____________________________________________________________________________________ 3046 1.1 simonb +17 3047 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match Wrap /#_______________________________________________________________________________ 3048 1.1 simonb +5 3049 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match EOF-ignore /#_________________________________________________________________________ 3050 1.1 simonb +5 3051 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match /#____________________________________________________________________________________ 3052 1.1 simonb +17 3053 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match Wrap /#_______________________________________________________________________________ 3054 1.1 simonb +5 3055 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match EOF-ignore /#_________________________________________________________________________ 3056 1.1 simonb +17 3057 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match Wrap /#_______________________________________________________________________________ 3058 1.1 simonb +5 3059 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match EOF-ignore /#_________________________________________________________________________ 3060 1.1 simonb +17 3061 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match Wrap /#_______________________________________________________________________________ 3062 1.1 simonb +17 3063 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match /#____________________________________________________________________________________ 3064 1.1 simonb +65 3065 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match /e#___________________________________________________________________________________ 3066 1.1 simonb +73 3067 1.1 simonb = * License or the L@04es@00s License, as specified in the README file._______________________________ *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________Non-match /es#__________________________________________________________________________________ 3068 1.1 simonb +a 3069 1.1 simonb = *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifndef FOREGROUND_BLUE________________________________________________________________________:#______________________________________________________________________________________________ 3070 1.1 simonb +2f 3071 1.1 simonb = *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifndef FOREGROUND_BLUE________________________________________________________________________/#______________________________________________________________________________________________ 3072 1.1 simonb +21 3073 1.1 simonb = *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifndef FOREGROUND_BLUE________________________________________________________________________Non-match /#____________________________________________________________________________________ 3074 1.1 simonb +64 3075 1.1 simonb = *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifndef FOREGROUND_BLUE________________________________________________________________________Non-match /d#___________________________________________________________________________________ 3076 1.1 simonb +65 3077 1.1 simonb = *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routin@04es@00 which deal with the characteristics of the terminal._______________________________ * Us@04es@00 termcap to be as terminal-independent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#include "l@04es (a] 00s.h"______________________________________________________________________________\#include "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#include "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#include <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#include <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#include <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#include <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#include <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifndef FOREGROUND_BLUE________________________________________________________________________Non-match /de#__________________________________________________________________________________ 3078 1.1 simonb +a 3079 1.1 simonb = *_____________________________________________________________________________________________ * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which @04de@00al with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-in@04de@00pendent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#inclu@04de@00 "less.h"______________________________________________________________________________\#inclu@04de@00 "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#inclu@04de@00 "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________:#______________________________________________________________________________________________ 3080 1.1 simonb +6e 3081 1.1 simonb = * For more information, see the README file.__________________________________________________ */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which @04de@00al with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-in@04de@00pendent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#inclu@04de@00 "less.h"______________________________________________________________________________\#inclu@04de@00 "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#inclu@04de@00 "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________:#______________________________________________________________________________________________ 3082 1.1 simonb +6e 3083 1.1 simonb = */__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which @04de@00al with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-in@04de@00pendent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#inclu@04de@00 "less.h"______________________________________________________________________________\#inclu@04de@00 "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#inclu@04de@00 "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________:#______________________________________________________________________________________________ 3084 1.1 simonb +6e 3085 1.1 simonb =______________________________________________________________________________________________________________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which @04de@00al with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-in@04de@00pendent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#inclu@04de@00 "less.h"______________________________________________________________________________\#inclu@04de@00 "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#inclu@04de@00 "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________:#______________________________________________________________________________________________ 3086 1.1 simonb +6e 3087 1.1 simonb =_______________________________________________________________________________________________/*_____________________________________________________________________________________________ * Routines which @04de@00al with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-in@04de@00pendent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#inclu@04de@00 "less.h"______________________________________________________________________________\#inclu@04de@00 "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#inclu@04de@00 "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________:#______________________________________________________________________________________________ 3088 1.1 simonb +6e 3089 1.1 simonb =/*_____________________________________________________________________________________________ * Routines which @04de@00al with the characteristics of the terminal._______________________________ * Uses termcap to be as terminal-in@04de@00pendent as possible._____________________________________ */___________________________________________________________________________________________________________________________________________________________________________________________\#inclu@04de@00 "less.h"______________________________________________________________________________\#inclu@04de@00 "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#inclu@04de@00 "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________:#______________________________________________________________________________________________ 3090 1.1 simonb +6e 3091 1.1 simonb = */___________________________________________________________________________________________________________________________________________________________________________________________\#inclu@04de@00 "less.h"______________________________________________________________________________\#inclu@04de@00 "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#inclu@04de@00 "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________:#______________________________________________________________________________________________ 3092 1.1 simonb +6e 3093 1.1 simonb =_______________________________________________________________________________________________\#inclu@04de@00 "less.h"______________________________________________________________________________\#inclu@04de@00 "cmd.h"______________________________________________________________________________________________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#inclu@04de@00 "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________:#______________________________________________________________________________________________ 3094 1.1 simonb +6e 3095 1.1 simonb =_______________________________________________________________________________________________\#if MSDOS_COMPILER_____________________________________________________________________________\#inclu@04de@00 "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________:#______________________________________________________________________________________________ 3096 1.1 simonb +6e 3097 1.1 simonb =\#if MSDOS_COMPILER_____________________________________________________________________________\#inclu@04de@00 "pckeys.h"____________________________________________________________________________\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else__________________________________________________________________________________________:#______________________________________________________________________________________________ 3098 1.1 simonb +6e 3099 1.1 simonb =\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________:#______________________________________________________________________________________________ 3100 1.1 simonb +2f 3101 1.1 simonb =\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________/#______________________________________________________________________________________________ 3102 1.1 simonb +64 3103 1.1 simonb =\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________/d#_____________________________________________________________________________________________ 3104 1.1 simonb +1b 3105 1.1 simonb =\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________/d#_____________________________________________________________________________________________ 3106 1.1 simonb +4f 3107 1.1 simonb =\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________/d#_____________________________________________________________________________________________ 3108 1.1 simonb +41 3109 1.1 simonb =\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________/de#____________________________________________________________________________________________ 3110 1.1 simonb +8 3111 1.1 simonb =\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________/d#_____________________________________________________________________________________________ 3112 1.1 simonb +28 3113 1.1 simonb =\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________/d(#____________________________________________________________________________________________ 3114 1.1 simonb +65 3115 1.1 simonb =\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________/d(e#___________________________________________________________________________________________ 3116 1.1 simonb +29 3117 1.1 simonb =\#if MSDOS_COMPILER==MSOFTC_____________________________________________________________________\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________/d(e)#__________________________________________________________________________________________ 3118 1.1 simonb +a 3119 1.1 simonb =\#inclu@04de@00 <graph.h>_____________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC_________________________________________\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________:#______________________________________________________________________________________________ 3120 1.1 simonb +6e 3121 1.1 simonb =\#inclu@04de@00 <conio.h>_____________________________________________________________________________\#if MSDOS_COMPILER==DJGPPC_____________________________________________________________________\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________:#______________________________________________________________________________________________ 3122 1.1 simonb +6e 3123 1.1 simonb =\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________:#______________________________________________________________________________________________ 3124 1.1 simonb +2f 3125 1.1 simonb =\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________/#______________________________________________________________________________________________ 3126 1.1 simonb +21 3127 1.1 simonb =\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________Non-match /#____________________________________________________________________________________ 3128 1.1 simonb +64 3129 1.1 simonb =\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________Non-match /d#___________________________________________________________________________________ 3130 1.1 simonb +28 3131 1.1 simonb =\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________Non-match /d(#__________________________________________________________________________________ 3132 1.1 simonb +65 3133 1.1 simonb =\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________Non-match /d(e#_________________________________________________________________________________ 3134 1.1 simonb +29 3135 1.1 simonb =\#inclu@04de@00 <pc.h>________________________________________________________________________________extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________Non-match /d(e)#________________________________________________________________________________ 3136 1.1 simonb +a 3137 1.1 simonb =extern int fd0;________________________________________________________________________________\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________\#if HAVE_TERMIO_H______________________________________________________________________________:#______________________________________________________________________________________________ 3138 1.1 simonb +6e 3139 1.1 simonb =\#endif_________________________________________________________________________________________\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________\#if HAVE_TERMIO_H______________________________________________________________________________\#inclu@04de@00 <termio.h>____________________________________________________________________________:#______________________________________________________________________________________________ 3140 1.1 simonb +6e 3141 1.1 simonb =\#else__________________________________________________________________________________________\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________\#if HAVE_TERMIO_H______________________________________________________________________________\#inclu@04de@00 <termio.h>____________________________________________________________________________\#else__________________________________________________________________________________________:#______________________________________________________________________________________________ 3142 1.1 simonb +6e 3143 1.1 simonb =\#if MSDOS_COMPILER==WIN32C_____________________________________________________________________\#inclu@04de@00 <windows.h>___________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________\#if HAVE_TERMIO_H______________________________________________________________________________\#inclu@04de@00 <termio.h>____________________________________________________________________________\#else__________________________________________________________________________________________\#if HAVE_SGSTAT_H______________________________________________________________________________:#______________________________________________________________________________________________ 3144 1.1 simonb +6e 3145 1.1 simonb =\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#endif_________________________________________________________________________________________\#inclu@04de@00 <time.h>_____________________________________________________________________________________________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_BLUE________________________________________________________________________\#@04de@00fine FOREGROUND_BLUE 0x0001 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_GREEN_______________________________________________________________________\#@04de@00fine FOREGROUND_GREEN 0x0002 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_RED_________________________________________________________________________\#@04de@00fine FOREGROUND_RED 0x0004 _______________________________________________________\#endif_________________________________________________________________________________________\#ifn@04de@00f FOREGROUND_INTENSITY___________________________________________________________________\#@04de@00fine FOREGROUND_INTENSITY 0x0008____________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#else_________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_SYS_IOCTL_H___________________________________________________________________________\#inclu@04de@00 <sys/ioctl.h>_________________________________________________________________________\#endif________________________________________________________________________________________________________________________________________________________________________________________\#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS_______________________________________________________\#inclu@04de@00 <termios.h>___________________________________________________________________________\#else__________________________________________________________________________________________\#if HAVE_TERMIO_H______________________________________________________________________________\#inclu@04de@00 <termio.h>____________________________________________________________________________\#else__________________________________________________________________________________________\#if HAVE_SGSTAT_H______________________________________________________________________________\#inclu@04de@00 <sgstat.h>____________________________________________________________________________\#else__________________________________________________________________________________________:#______________________________________________________________________________________________ 3146 1.1 simonb +71 3147 1.1 simonb Q 3148