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