From f3e2efddedcd14d4f5420fb6d8bdeffe9370bfe0 Mon Sep 17 00:00:00 2001 From: millert Date: Sun, 26 Mar 2000 16:45:00 +0000 Subject: [PATCH] Update to ncurses-5.0-20000325 --- lib/libcurses/base/lib_color.c | 86 ++++---- lib/libcurses/base/lib_dft_fgbg.c | 7 +- lib/libcurses/base/lib_mouse.c | 6 +- lib/libcurses/base/lib_set_term.c | 6 +- lib/libcurses/curses.h | 4 +- lib/libcurses/curses.priv.h | 13 +- lib/libcurses/doc/hackguide.html | 4 +- lib/libcurses/shlib_version | 2 +- lib/libcurses/term_entry.h | 5 +- lib/libcurses/tic.h | 4 +- lib/libcurses/tinfo/add_tries.c | 133 ++++++------ lib/libcurses/tinfo/alloc_ttype.c | 190 +++++++++-------- lib/libcurses/tinfo/captoinfo.c | 7 +- lib/libcurses/tinfo/comp_parse.c | 12 +- lib/libcurses/tinfo/comp_scan.c | 26 ++- lib/libcurses/tinfo/free_ttype.c | 5 +- lib/libcurses/tinfo/read_termcap.c | 4 +- lib/libcurses/tty/lib_vidattr.c | 331 +++++++++++++++-------------- lib/libcurses/tty/tty_update.c | 10 +- share/termtypes/termtypes.master | 60 +++--- usr.bin/infocmp/infocmp.1tbl | 15 +- usr.bin/infocmp/infocmp.c | 23 +- usr.bin/tic/captoinfo.1tbl | 7 +- usr.bin/tic/infotocap.1 | 7 +- usr.bin/tic/tic.1 | 25 ++- usr.bin/tic/tic.c | 17 +- 26 files changed, 552 insertions(+), 457 deletions(-) diff --git a/lib/libcurses/base/lib_color.c b/lib/libcurses/base/lib_color.c index e917647497b..7d246bd05ee 100644 --- a/lib/libcurses/base/lib_color.c +++ b/lib/libcurses/base/lib_color.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_color.c,v 1.6 2000/03/10 01:35:02 millert Exp $ */ +/* $OpenBSD: lib_color.c,v 1.7 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,7 +43,7 @@ #include #include -MODULE_ID("$From: lib_color.c,v 1.45 2000/02/27 00:20:31 tom Exp $") +MODULE_ID("$From: lib_color.c,v 1.49 2000/03/26 03:12:12 tom Exp $") /* * These should be screen structure members. They need to be globals for @@ -88,16 +88,20 @@ static const color_t hls_palette[] = /* *INDENT-ON* */ #ifdef NCURSES_EXT_FUNCS +/* + * These are called from _nc_do_color(), which in turn is called from + * vidattr - so we have to assume that SP may be null. + */ static int default_fg(void) { - return (SP->_default_fg != C_MASK) ? SP->_default_fg : COLOR_WHITE; + return (SP != 0) ? SP->_default_fg : COLOR_WHITE; } static int default_bg(void) { - return (SP->_default_bg != C_MASK) ? SP->_default_bg : COLOR_BLACK; + return SP != 0 ? SP->_default_bg : COLOR_BLACK; } #else #define default_fg() COLOR_WHITE @@ -261,7 +265,7 @@ init_pair(short pair, short f, short b) T((T_CALLED("init_pair(%d,%d,%d)"), pair, f, b)); - if ((pair < 1) || (pair >= COLOR_PAIRS)) + if ((pair < 0) || (pair >= COLOR_PAIRS)) returnCode(ERR); #ifdef NCURSES_EXT_FUNCS if (SP->_default_color) { @@ -275,9 +279,12 @@ init_pair(short pair, short f, short b) returnCode(ERR); } else #endif + { if ((f < 0) || (f >= COLORS) - || (b < 0) || (b >= COLORS)) - returnCode(ERR); + || (b < 0) || (b >= COLORS) + || (pair < 1)) + returnCode(ERR); + } /* * When a pair's content is changed, replace its colors (if pair was @@ -307,6 +314,8 @@ init_pair(short pair, short f, short b) } } SP->_color_pairs[pair] = result; + if ((int)(SP->_current_attr & A_COLOR) == COLOR_PAIR(pair)) + SP->_current_attr |= A_COLOR; /* force attribute update */ if (initialize_pair) { const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette; @@ -410,49 +419,52 @@ pair_content(short pair, short *f, short *b) } void -_nc_do_color(int pair, bool reverse, int (*outc) (int)) +_nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) { - short fg, bg; + short fg = C_MASK, bg = C_MASK; + short old_fg, old_bg; - if (pair == 0) { - if ( -#ifdef NCURSES_EXT_FUNCS - !SP->_default_color || -#endif - !set_original_colors()) { - fg = default_fg(); - bg = default_bg(); - } else { - fg = C_MASK; - bg = C_MASK; - } - } else { + if (pair != 0) { if (set_color_pair) { TPUTS_TRACE("set_color_pair"); tputs(tparm(set_color_pair, pair), 1, outc); return; - } else { + } else if (SP != 0) { pair_content(pair, &fg, &bg); -#ifdef NCURSES_EXT_FUNCS - if (SP->_default_color) { - if (fg == C_MASK) - fg = SP->_default_fg; - if (bg == C_MASK) - bg = SP->_default_bg; - } -#endif } } - if (fg == C_MASK || bg == C_MASK) { - if (set_original_colors() != TRUE) { - if (fg == C_MASK) - fg = default_fg(); - if (bg == C_MASK) - bg = default_bg(); + if (old_pair >= 0 && SP != 0) { + pair_content(old_pair, &old_fg, &old_bg); + if ((fg == C_MASK && old_fg != C_MASK) + || (bg == C_MASK && old_bg != C_MASK)) { +#ifdef NCURSES_EXT_FUNCS + /* + * A minor optimization - but extension. If "AX" is specified in + * the terminal description, treat it as screen's indicator of ECMA + * SGR 39 and SGR 49, and assume the two sequences are independent. + */ + if (SP->_has_sgr_39_49 && old_bg == C_MASK && old_fg != C_MASK) { + tputs("\033[39m", 1, outc); + } else if (SP->_has_sgr_39_49 && old_fg == C_MASK && old_bg != C_MASK) { + tputs("\033[49m", 1, outc); + } else +#endif + set_original_colors(); } + } else { + set_original_colors(); + if (old_pair < 0) + return; } +#ifdef NCURSES_EXT_FUNCS + if (fg == C_MASK) + fg = default_fg(); + if (bg == C_MASK) + bg = default_bg(); +#endif + if (reverse) { short xx = fg; fg = bg; diff --git a/lib/libcurses/base/lib_dft_fgbg.c b/lib/libcurses/base/lib_dft_fgbg.c index df007242458..b695b6d7f1e 100644 --- a/lib/libcurses/base/lib_dft_fgbg.c +++ b/lib/libcurses/base/lib_dft_fgbg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_dft_fgbg.c,v 1.3 2000/03/10 01:35:02 millert Exp $ */ +/* $OpenBSD: lib_dft_fgbg.c,v 1.4 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -35,7 +35,7 @@ #include #include -MODULE_ID("$From: lib_dft_fgbg.c,v 1.8 2000/02/19 23:57:40 tom Exp $") +MODULE_ID("$From: lib_dft_fgbg.c,v 1.10 2000/03/26 03:08:53 Alexander.V.Lukyanov Exp $") /* * Modify the behavior of color-pair 0 so that the library doesn't assume that @@ -64,9 +64,10 @@ assume_default_colors(int fg, int bg) returnCode(ERR); SP->_default_color = (fg != COLOR_WHITE) || (bg != COLOR_BLACK); + SP->_has_sgr_39_49 = tigetflag("AX"); SP->_default_fg = (fg >= 0) ? (fg & C_MASK) : C_MASK; SP->_default_bg = (bg >= 0) ? (bg & C_MASK) : C_MASK; if (SP->_color_pairs != 0) - SP->_color_pairs[0] = PAIR_OF(fg, bg); + init_pair(0, fg, bg); returnCode(OK); } diff --git a/lib/libcurses/base/lib_mouse.c b/lib/libcurses/base/lib_mouse.c index 2bac96dd2e6..44bf768e833 100644 --- a/lib/libcurses/base/lib_mouse.c +++ b/lib/libcurses/base/lib_mouse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_mouse.c,v 1.8 2000/03/10 01:35:02 millert Exp $ */ +/* $OpenBSD: lib_mouse.c,v 1.9 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -86,7 +86,7 @@ #endif #endif -MODULE_ID("$From: lib_mouse.c,v 1.50 2000/02/13 00:59:39 tom Exp $") +MODULE_ID("$From: lib_mouse.c,v 1.51 2000/03/18 22:11:42 tom Exp $") #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT @@ -228,7 +228,7 @@ static int initialized; static void initialize_mousetype(void) { - static char *xterm_kmous = "\033[M"; + static const char *xterm_kmous = "\033[M"; /* Try gpm first, because gpm may be configured to run in xterm */ #if USE_GPM_SUPPORT diff --git a/lib/libcurses/base/lib_set_term.c b/lib/libcurses/base/lib_set_term.c index 55f4b205a34..014e43a85f3 100644 --- a/lib/libcurses/base/lib_set_term.c +++ b/lib/libcurses/base/lib_set_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_set_term.c,v 1.7 2000/03/10 01:35:02 millert Exp $ */ +/* $OpenBSD: lib_set_term.c,v 1.8 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -45,7 +45,7 @@ #include /* cur_term */ #include -MODULE_ID("$From: lib_set_term.c,v 1.50 2000/02/13 00:59:39 tom Exp $") +MODULE_ID("$From: lib_set_term.c,v 1.51 2000/03/26 01:03:36 tom Exp $") SCREEN * set_term(SCREEN * screenp) @@ -190,6 +190,8 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output) SP->_no_padding = getenv("NCURSES_NO_PADDING") != 0; #endif #ifdef NCURSES_EXT_FUNCS + SP->_default_color = FALSE; + SP->_has_sgr_39_49 = FALSE; SP->_default_fg = COLOR_WHITE; SP->_default_bg = COLOR_BLACK; #endif diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index b17f89d8f67..99a3783cda8 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -1,4 +1,4 @@ -/* $OpenBSD: curses.h,v 1.48 2000/03/13 23:53:38 millert Exp $ */ +/* $OpenBSD: curses.h,v 1.49 2000/03/26 16:45:02 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -50,7 +50,7 @@ /* These are defined only in curses.h, and are used for conditional compiles */ #define NCURSES_VERSION_MAJOR 5 #define NCURSES_VERSION_MINOR 0 -#define NCURSES_VERSION_PATCH 20000311 +#define NCURSES_VERSION_PATCH 20000325 /* This is defined in more than one ncurses header, for identification */ #undef NCURSES_VERSION diff --git a/lib/libcurses/curses.priv.h b/lib/libcurses/curses.priv.h index e65f9172291..595591c027f 100644 --- a/lib/libcurses/curses.priv.h +++ b/lib/libcurses/curses.priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: curses.priv.h,v 1.25 2000/03/10 01:35:01 millert Exp $ */ +/* $OpenBSD: curses.priv.h,v 1.26 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -35,7 +35,7 @@ /* - * $From: curses.priv.h,v 1.153 2000/02/19 23:31:39 tom Exp $ + * $From: curses.priv.h,v 1.157 2000/03/26 01:01:14 tom Exp $ * * curses.priv.h * @@ -340,7 +340,8 @@ struct screen { unsigned short *_color_pairs; /* screen's color pair list */ int _pair_count; /* count of color pairs */ #ifdef NCURSES_EXT_FUNCS - int _default_color; /* use default colors */ + bool _default_color; /* use default colors */ + bool _has_sgr_39_49; /* has ECMA default color support */ int _default_fg; /* assumed default foreground */ int _default_bg; /* assumed default background */ #endif @@ -621,7 +622,7 @@ extern const char *_nc_visbuf2(int, const char *); vidattr(AttrOf(c)) #endif -#ifdef NCURSES_EXPANDED +#if defined(NCURSES_EXPANDED) && defined(NCURSES_EXT_FUNCS) #undef toggle_attr_on #define toggle_attr_on(S,at) _nc_toggle_attr_on(&(S), at) @@ -699,7 +700,7 @@ extern int _nc_has_mouse(void); extern char * _nc_printf_string(const char *fmt, va_list ap); /* tries.c */ -extern void _nc_add_to_try(struct tries **tree, char *str, unsigned short code); +extern void _nc_add_to_try(struct tries **tree, const char *str, unsigned short code); extern char *_nc_expand_try(struct tries *tree, unsigned short code, int *count, size_t len); extern int _nc_remove_key(struct tries **tree, unsigned short code); extern int _nc_remove_string(struct tries **tree, char *string); @@ -719,7 +720,7 @@ extern int _nc_outch(int); extern int _nc_setupscreen(short, short const, FILE *); extern int _nc_timed_wait(int, int, int *); extern int _nc_waddch_nosync(WINDOW *, const chtype); -extern void _nc_do_color(int, bool, int (*)(int)); +extern void _nc_do_color(int, int, bool, int (*)(int)); extern void _nc_freeall(void); extern void _nc_freewin(WINDOW *win); extern void _nc_hash_map(void); diff --git a/lib/libcurses/doc/hackguide.html b/lib/libcurses/doc/hackguide.html index f2c6d0a9cd4..c52dd5b171f 100644 --- a/lib/libcurses/doc/hackguide.html +++ b/lib/libcurses/doc/hackguide.html @@ -1,6 +1,6 @@ @@ -186,7 +186,7 @@ have to wait a while.
  1. Develop a recipe to reproduce the bug. - +

    Bugs we can reproduce are likely to be fixed very quickly, often within days. The most effective single thing you can do to get a quick fix is develop a way we can duplicate the bad behavior -- diff --git a/lib/libcurses/shlib_version b/lib/libcurses/shlib_version index 5b844bbf422..b39addfcc64 100644 --- a/lib/libcurses/shlib_version +++ b/lib/libcurses/shlib_version @@ -1,2 +1,2 @@ major=7 -minor=0 +minor=1 diff --git a/lib/libcurses/term_entry.h b/lib/libcurses/term_entry.h index 4d42cb32e56..a1c8678bc8f 100644 --- a/lib/libcurses/term_entry.h +++ b/lib/libcurses/term_entry.h @@ -1,4 +1,4 @@ -/* $OpenBSD: term_entry.h,v 1.9 2000/03/13 23:53:39 millert Exp $ */ +/* $OpenBSD: term_entry.h,v 1.10 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -33,7 +33,7 @@ * and: Eric S. Raymond * ****************************************************************************/ -/* $From: term_entry.h,v 1.28 2000/03/12 00:44:04 tom Exp $ */ +/* $From: term_entry.h,v 1.29 2000/03/19 02:04:15 tom Exp $ */ /* * term_entry.h -- interface to entry-manipulation code @@ -137,6 +137,7 @@ extern void _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ /* parse_entry.c: entry-parsing code */ #if NCURSES_XNAMES extern bool _nc_user_definable; +extern bool _nc_disable_period; #endif extern int _nc_parse_entry(ENTRY *, int, bool); extern int _nc_capcmp(const char *, const char *); diff --git a/lib/libcurses/tic.h b/lib/libcurses/tic.h index b7652978ff1..27ca09bfce4 100644 --- a/lib/libcurses/tic.h +++ b/lib/libcurses/tic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tic.h,v 1.8 2000/01/16 01:35:17 millert Exp $ */ +/* $OpenBSD: tic.h,v 1.9 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998-2000 Free Software Foundation, Inc. * @@ -273,7 +273,7 @@ extern bool _nc_suppress_warnings; extern char *_nc_tic_expand(const char *, bool, int); /* comp_scan.c: decode string from readable form */ -extern char _nc_trans_string(char *); +extern char _nc_trans_string(char *, char *); /* captoinfo.c: capability conversion */ extern char *_nc_captoinfo(const char *, const char *, int const); diff --git a/lib/libcurses/tinfo/add_tries.c b/lib/libcurses/tinfo/add_tries.c index 31a6e6906ec..fddee879548 100644 --- a/lib/libcurses/tinfo/add_tries.c +++ b/lib/libcurses/tinfo/add_tries.c @@ -1,7 +1,7 @@ -/* $OpenBSD: add_tries.c,v 1.1 1999/01/18 19:10:12 millert Exp $ */ +/* $OpenBSD: add_tries.c,v 1.2 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,86 +41,87 @@ #include -MODULE_ID("$From: add_tries.c,v 1.1 1998/11/08 00:04:18 tom Exp $") +MODULE_ID("$From: add_tries.c,v 1.2 2000/03/18 22:23:56 tom Exp $") #define SET_TRY(dst,src) if ((dst->ch = *src++) == 128) dst->ch = '\0' #define CMP_TRY(a,b) ((a)? (a == b) : (b == 128)) -void _nc_add_to_try(struct tries **tree, char *str, unsigned short code) +void +_nc_add_to_try(struct tries **tree, const char *str, unsigned short code) { - static bool out_of_memory = FALSE; - struct tries *ptr, *savedptr; - unsigned char *txt = (unsigned char *)str; - - if (txt == 0 || *txt == '\0' || out_of_memory || code == 0) - return; - - if ((*tree) != 0) { - ptr = savedptr = (*tree); - - for (;;) { - unsigned char cmp = *txt; - - while (!CMP_TRY(ptr->ch, cmp) - && ptr->sibling != 0) - ptr = ptr->sibling; - - if (CMP_TRY(ptr->ch, cmp)) { - if (*(++txt) == '\0') { - ptr->value = code; - return; - } - if (ptr->child != 0) - ptr = ptr->child; - else - break; - } else { - if ((ptr->sibling = typeCalloc(struct tries,1)) == 0) { - out_of_memory = TRUE; - return; - } - - savedptr = ptr = ptr->sibling; - SET_TRY(ptr,txt); - ptr->value = 0; - - break; - } - } /* end for (;;) */ - } else { /* (*tree) == 0 :: First sequence to be added */ - savedptr = ptr = (*tree) = typeCalloc(struct tries,1); - - if (ptr == 0) { - out_of_memory = TRUE; - return; + static bool out_of_memory = FALSE; + struct tries *ptr, *savedptr; + unsigned const char *txt = (unsigned const char *) str; + + if (txt == 0 || *txt == '\0' || out_of_memory || code == 0) + return; + + if ((*tree) != 0) { + ptr = savedptr = (*tree); + + for (;;) { + unsigned char cmp = *txt; + + while (!CMP_TRY(ptr->ch, cmp) + && ptr->sibling != 0) + ptr = ptr->sibling; + + if (CMP_TRY(ptr->ch, cmp)) { + if (*(++txt) == '\0') { + ptr->value = code; + return; + } + if (ptr->child != 0) + ptr = ptr->child; + else + break; + } else { + if ((ptr->sibling = typeCalloc(struct tries, 1)) == 0) { + out_of_memory = TRUE; + return; } - SET_TRY(ptr,txt); + savedptr = ptr = ptr->sibling; + SET_TRY(ptr, txt); ptr->value = 0; + + break; + } + } /* end for (;;) */ + } else { /* (*tree) == 0 :: First sequence to be added */ + savedptr = ptr = (*tree) = typeCalloc(struct tries, 1); + + if (ptr == 0) { + out_of_memory = TRUE; + return; } - /* at this point, we are adding to the try. ptr->child == 0 */ + SET_TRY(ptr, txt); + ptr->value = 0; + } - while (*txt) { - ptr->child = typeCalloc(struct tries,1); + /* at this point, we are adding to the try. ptr->child == 0 */ - ptr = ptr->child; + while (*txt) { + ptr->child = typeCalloc(struct tries, 1); - if (ptr == 0) { - out_of_memory = TRUE; + ptr = ptr->child; - while ((ptr = savedptr) != 0) { - savedptr = ptr->child; - free(ptr); - } + if (ptr == 0) { + out_of_memory = TRUE; - return; - } + while ((ptr = savedptr) != 0) { + savedptr = ptr->child; + free(ptr); + } - SET_TRY(ptr,txt); - ptr->value = 0; + return; } - ptr->value = code; - return; + SET_TRY(ptr, txt); + ptr->value = 0; + } + + ptr->value = code; + return; } diff --git a/lib/libcurses/tinfo/alloc_ttype.c b/lib/libcurses/tinfo/alloc_ttype.c index 85b88790c88..c2ec35fc070 100644 --- a/lib/libcurses/tinfo/alloc_ttype.c +++ b/lib/libcurses/tinfo/alloc_ttype.c @@ -1,7 +1,7 @@ -/* $OpenBSD: alloc_ttype.c,v 1.2 1999/05/08 20:29:00 millert Exp $ */ +/* $OpenBSD: alloc_ttype.c,v 1.3 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,6 @@ * Author: Thomas E. Dickey 1999 * ****************************************************************************/ - /* * align_ttype.c -- functions for TERMTYPE * @@ -46,14 +45,15 @@ #include #include -MODULE_ID("$From: alloc_ttype.c,v 1.6 1999/03/01 22:10:44 tom Exp $") +MODULE_ID("$From: alloc_ttype.c,v 1.8 2000/03/25 17:03:11 tom Exp $") #if NCURSES_XNAMES /* * Merge the a/b lists into dst. Both a/b are sorted (see _nc_extend_names()), * so we do not have to worry about order dependencies. */ -static int merge_names(char **dst, char **a, int na, char **b, int nb) +static int +merge_names(char **dst, char **a, int na, char **b, int nb) { int n = 0; while (na && nb) { @@ -80,7 +80,8 @@ static int merge_names(char **dst, char **a, int na, char **b, int nb) return n; } -static bool find_name(char **table, int length, char *name) +static bool +find_name(char **table, int length, char *name) { while (length-- > 0) { if (!strcmp(*table++, name)) { @@ -92,7 +93,9 @@ static bool find_name(char **table, int length, char *name) return FALSE; } -static void realign_data(TERMTYPE *to, char **ext_Names, int ext_Booleans, int ext_Numbers, int ext_Strings) +static void +realign_data(TERMTYPE * to, char **ext_Names, int ext_Booleans, int + ext_Numbers, int ext_Strings) { int n, m, base; int limit = (to->ext_Booleans + to->ext_Numbers + to->ext_Strings); @@ -100,9 +103,9 @@ static void realign_data(TERMTYPE *to, char **ext_Names, int ext_Booleans, int e if (to->ext_Booleans != ext_Booleans) { to->num_Booleans += (ext_Booleans - to->ext_Booleans); to->Booleans = typeRealloc(char, to->num_Booleans, to->Booleans); - for (n = to->ext_Booleans-1, - m = ext_Booleans-1, - base = to->num_Booleans - (m+1); m >= 0; m--) { + for (n = to->ext_Booleans - 1, + m = ext_Booleans - 1, + base = to->num_Booleans - (m + 1); m >= 0; m--) { if (find_name(to->ext_Names, limit, ext_Names[m])) { to->Booleans[base + m] = to->Booleans[base + n--]; } else { @@ -114,24 +117,24 @@ static void realign_data(TERMTYPE *to, char **ext_Names, int ext_Booleans, int e if (to->ext_Numbers != ext_Numbers) { to->num_Numbers += (ext_Numbers - to->ext_Numbers); to->Numbers = typeRealloc(short, to->num_Numbers, to->Numbers); - for (n = to->ext_Numbers-1, - m = ext_Numbers-1, - base = to->num_Numbers - (m+1); m >= 0; m--) { - if (find_name(to->ext_Names, limit, ext_Names[m+ext_Booleans])) { + for (n = to->ext_Numbers - 1, + m = ext_Numbers - 1, + base = to->num_Numbers - (m + 1); m >= 0; m--) { + if (find_name(to->ext_Names, limit, ext_Names[m + ext_Booleans])) { to->Numbers[base + m] = to->Numbers[base + n--]; } else { to->Numbers[base + m] = ABSENT_NUMERIC; } } - to->ext_Numbers = ext_Numbers; + to->ext_Numbers = ext_Numbers; } if (to->ext_Strings != ext_Strings) { to->num_Strings += (ext_Strings - to->ext_Strings); - to->Strings = typeRealloc(char*, to->num_Strings, to->Strings); - for (n = to->ext_Strings-1, - m = ext_Strings-1, - base = to->num_Strings - (m+1); m >= 0; m--) { - if (find_name(to->ext_Names, limit, ext_Names[m+ext_Booleans+ext_Numbers])) { + to->Strings = typeRealloc(char *, to->num_Strings, to->Strings); + for (n = to->ext_Strings - 1, + m = ext_Strings - 1, + base = to->num_Strings - (m + 1); m >= 0; m--) { + if (find_name(to->ext_Names, limit, ext_Names[m + ext_Booleans + ext_Numbers])) { to->Strings[base + m] = to->Strings[base + n--]; } else { to->Strings[base + m] = ABSENT_STRING; @@ -144,7 +147,8 @@ static void realign_data(TERMTYPE *to, char **ext_Names, int ext_Booleans, int e /* * Returns the first index in ext_Names[] for the given token-type */ -static int _nc_first_ext_name(TERMTYPE *tp, int token_type) +static int +_nc_first_ext_name(TERMTYPE * tp, int token_type) { int first; @@ -168,20 +172,21 @@ static int _nc_first_ext_name(TERMTYPE *tp, int token_type) /* * Returns the last index in ext_Names[] for the given token-type */ -static int _nc_last_ext_name(TERMTYPE *tp, int token_type) +static int +_nc_last_ext_name(TERMTYPE * tp, int token_type) { int last; switch (token_type) { case BOOLEAN: - last = tp->ext_Booleans; + last = tp->ext_Booleans; break; case NUMBER: - last = tp->ext_Booleans + tp->ext_Numbers; + last = tp->ext_Booleans + tp->ext_Numbers; break; default: case STRING: - last = NUM_EXT_NAMES(tp); + last = NUM_EXT_NAMES(tp); break; } return last; @@ -190,11 +195,12 @@ static int _nc_last_ext_name(TERMTYPE *tp, int token_type) /* * Lookup an entry from extended-names, returning -1 if not found */ -static int _nc_find_ext_name(TERMTYPE *tp, char *name, int token_type) +static int +_nc_find_ext_name(TERMTYPE * tp, char *name, int token_type) { unsigned j; unsigned first = _nc_first_ext_name(tp, token_type); - unsigned last = _nc_last_ext_name(tp, token_type); + unsigned last = _nc_last_ext_name(tp, token_type); for (j = first; j < last; j++) { if (!strcmp(name, tp->ext_Names[j])) { @@ -208,7 +214,8 @@ static int _nc_find_ext_name(TERMTYPE *tp, char *name, int token_type) * Translate an index into ext_Names[] into the corresponding index into data * (e.g., Booleans[]). */ -static int _nc_ext_data_index(TERMTYPE *tp, int n, int token_type) +static int +_nc_ext_data_index(TERMTYPE * tp, int n, int token_type) { switch (token_type) { case BOOLEAN: @@ -216,12 +223,12 @@ static int _nc_ext_data_index(TERMTYPE *tp, int n, int token_type) break; case NUMBER: n += (tp->num_Numbers - tp->ext_Numbers) - - (tp->ext_Booleans); + - (tp->ext_Booleans); break; default: case STRING: n += (tp->num_Strings - tp->ext_Strings) - - (tp->ext_Booleans + tp->ext_Numbers); + - (tp->ext_Booleans + tp->ext_Numbers); } return n; } @@ -230,7 +237,8 @@ static int _nc_ext_data_index(TERMTYPE *tp, int n, int token_type) * Adjust tables to remove (not free) an extended name and its corresponding * data. */ -static void _nc_del_ext_name(TERMTYPE *tp, char *name, int token_type) +static void +_nc_del_ext_name(TERMTYPE * tp, char *name, int token_type) { int j; int first, last; @@ -238,28 +246,28 @@ static void _nc_del_ext_name(TERMTYPE *tp, char *name, int token_type) if ((first = _nc_find_ext_name(tp, name, token_type)) >= 0) { last = NUM_EXT_NAMES(tp) - 1; for (j = first; j < last; j++) { - tp->ext_Names[j] = tp->ext_Names[j+1]; + tp->ext_Names[j] = tp->ext_Names[j + 1]; } first = _nc_ext_data_index(tp, first, token_type); switch (token_type) { case BOOLEAN: last = tp->num_Booleans - 1; for (j = first; j < last; j++) - tp->Booleans[j] = tp->Booleans[j+1]; + tp->Booleans[j] = tp->Booleans[j + 1]; tp->ext_Booleans -= 1; tp->num_Booleans -= 1; break; case NUMBER: last = tp->num_Numbers - 1; for (j = first; j < last; j++) - tp->Numbers[j] = tp->Numbers[j+1]; + tp->Numbers[j] = tp->Numbers[j + 1]; tp->ext_Numbers -= 1; tp->num_Numbers -= 1; break; case STRING: last = tp->num_Strings - 1; for (j = first; j < last; j++) - tp->Strings[j] = tp->Strings[j+1]; + tp->Strings[j] = tp->Strings[j + 1]; tp->ext_Strings -= 1; tp->num_Strings -= 1; break; @@ -271,10 +279,11 @@ static void _nc_del_ext_name(TERMTYPE *tp, char *name, int token_type) * Adjust tables to insert an extended name, making room for new data. The * index into the corresponding data array is returned. */ -static int _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type) +static int +_nc_ins_ext_name(TERMTYPE * tp, char *name, int token_type) { unsigned first = _nc_first_ext_name(tp, token_type); - unsigned last = _nc_last_ext_name(tp, token_type); + unsigned last = _nc_last_ext_name(tp, token_type); unsigned total = NUM_EXT_NAMES(tp) + 1; unsigned j, k; @@ -289,8 +298,8 @@ static int _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type) } tp->ext_Names = typeRealloc(char *, total, tp->ext_Names); - for (k = total-1; k > j; k--) - tp->ext_Names[k] = tp->ext_Names[k-1]; + for (k = total - 1; k > j; k--) + tp->ext_Names[k] = tp->ext_Names[k - 1]; tp->ext_Names[j] = name; j = _nc_ext_data_index(tp, j, token_type); @@ -299,22 +308,22 @@ static int _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type) tp->ext_Booleans += 1; tp->num_Booleans += 1; tp->Booleans = typeRealloc(char, tp->num_Booleans, tp->Booleans); - for (k = tp->num_Booleans-1; k > j; k--) - tp->Booleans[k] = tp->Booleans[k-1]; + for (k = tp->num_Booleans - 1; k > j; k--) + tp->Booleans[k] = tp->Booleans[k - 1]; break; case NUMBER: tp->ext_Numbers += 1; tp->num_Numbers += 1; tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers); - for (k = tp->num_Numbers-1; k > j; k--) - tp->Numbers[k] = tp->Numbers[k-1]; + for (k = tp->num_Numbers - 1; k > j; k--) + tp->Numbers[k] = tp->Numbers[k - 1]; break; case STRING: tp->ext_Strings += 1; tp->num_Strings += 1; tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings); - for (k = tp->num_Strings-1; k > j; k--) - tp->Strings[k] = tp->Strings[k-1]; + for (k = tp->num_Strings - 1; k > j; k--) + tp->Strings[k] = tp->Strings[k - 1]; break; } return j; @@ -325,13 +334,14 @@ static int _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type) * as a boolean or number. We'll get this as a special case when we get a * cancellation of a name that is inherited from another entry. */ -static void adjust_cancels(TERMTYPE *to, TERMTYPE *from) +static void +adjust_cancels(TERMTYPE * to, TERMTYPE * from) { int first = to->ext_Booleans + to->ext_Numbers; - int last = first + to->ext_Strings; + int last = first + to->ext_Strings; int j, k; - for (j = first; j < last; ) { + for (j = first; j < last;) { char *name = to->ext_Names[j]; unsigned j_str = to->num_Strings - first - to->ext_Strings; @@ -340,7 +350,8 @@ static void adjust_cancels(TERMTYPE *to, TERMTYPE *from) _nc_del_ext_name(to, name, STRING); k = _nc_ins_ext_name(to, name, BOOLEAN); to->Booleans[k] = FALSE; - } else if ((k = _nc_find_ext_name(from, to->ext_Names[j], NUMBER)) >= 0) { + } else if ((k = _nc_find_ext_name(from, to->ext_Names[j], + NUMBER)) >= 0) { _nc_del_ext_name(to, name, STRING); k = _nc_ins_ext_name(to, name, NUMBER); to->Numbers[k] = CANCELLED_NUMERIC; @@ -351,7 +362,8 @@ static void adjust_cancels(TERMTYPE *to, TERMTYPE *from) } } -void _nc_align_termtype(TERMTYPE *to, TERMTYPE *from) +void +_nc_align_termtype(TERMTYPE * to, TERMTYPE * from) { int na = NUM_EXT_NAMES(to); int nb = NUM_EXT_NAMES(from); @@ -360,13 +372,14 @@ void _nc_align_termtype(TERMTYPE *to, TERMTYPE *from) char **ext_Names; int ext_Booleans, ext_Numbers, ext_Strings; - DEBUG(2, ("align_termtype to(%d:%s), from(%d:%s)", na, to->term_names, nb, from->term_names)); + DEBUG(2, ("align_termtype to(%d:%s), from(%d:%s)", na, to->term_names, + nb, from->term_names)); if (na != 0 || nb != 0) { if ((na == nb) /* check if the arrays are equivalent */ - && (to->ext_Booleans == from->ext_Booleans) - && (to->ext_Numbers == from->ext_Numbers) - && (to->ext_Strings == from->ext_Strings)) { + &&(to->ext_Booleans == from->ext_Booleans) + && (to->ext_Numbers == from->ext_Numbers) + && (to->ext_Strings == from->ext_Strings)) { for (n = 0, same = TRUE; n < na; n++) { if (strcmp(to->ext_Names[n], from->ext_Names[n])) { same = FALSE; @@ -382,7 +395,7 @@ void _nc_align_termtype(TERMTYPE *to, TERMTYPE *from) * into it, updating to's counts for booleans, etc. Fortunately we do * this only for the terminfo compiler (tic) and comparer (infocmp). */ - ext_Names = typeMalloc(char *, na+nb); + ext_Names = typeMalloc(char *, na + nb); if (to->ext_Strings && (from->ext_Booleans + from->ext_Numbers)) adjust_cancels(to, from); @@ -391,62 +404,65 @@ void _nc_align_termtype(TERMTYPE *to, TERMTYPE *from) adjust_cancels(from, to); ext_Booleans = merge_names(ext_Names, - to->ext_Names, - to->ext_Booleans, - from->ext_Names, - from->ext_Booleans); - ext_Numbers = merge_names(ext_Names + ext_Booleans, - to->ext_Names - + to->ext_Booleans, - to->ext_Numbers, - from->ext_Names - + from->ext_Booleans, - from->ext_Numbers); - ext_Strings = merge_names(ext_Names + ext_Numbers + ext_Booleans, - to->ext_Names - + to->ext_Booleans - + to->ext_Numbers, - to->ext_Strings, - from->ext_Names - + from->ext_Booleans - + from->ext_Numbers, - from->ext_Strings); + to->ext_Names, + to->ext_Booleans, + from->ext_Names, + from->ext_Booleans); + ext_Numbers = merge_names(ext_Names + ext_Booleans, + to->ext_Names + + to->ext_Booleans, + to->ext_Numbers, + from->ext_Names + + from->ext_Booleans, + from->ext_Numbers); + ext_Strings = merge_names(ext_Names + ext_Numbers + ext_Booleans, + to->ext_Names + + to->ext_Booleans + + to->ext_Numbers, + to->ext_Strings, + from->ext_Names + + from->ext_Booleans + + from->ext_Numbers, + from->ext_Strings); /* * Now we must reallocate the Booleans, etc., to allow the data to be * overlaid. */ if (na != (ext_Booleans + ext_Numbers + ext_Strings)) { realign_data(to, ext_Names, ext_Booleans, ext_Numbers, ext_Strings); - free(to->ext_Names); + FreeIfNeeded(to->ext_Names); to->ext_Names = ext_Names; - DEBUG(2, ("realigned %d extended names for '%s' (to)", NUM_EXT_NAMES(to), to->term_names)); + DEBUG(2, ("realigned %d extended names for '%s' (to)", + NUM_EXT_NAMES(to), to->term_names)); } if (nb != (ext_Booleans + ext_Numbers + ext_Strings)) { nb = (ext_Booleans + ext_Numbers + ext_Strings); realign_data(from, ext_Names, ext_Booleans, ext_Numbers, ext_Strings); from->ext_Names = typeRealloc(char *, nb, from->ext_Names); memcpy(from->ext_Names, ext_Names, sizeof(char *) * nb); - DEBUG(2, ("realigned %d extended names for '%s' (from)", NUM_EXT_NAMES(from), from->term_names)); + DEBUG(2, ("realigned %d extended names for '%s' (from)", + NUM_EXT_NAMES(from), from->term_names)); } } } #endif -void _nc_copy_termtype(TERMTYPE *dst, TERMTYPE *src) +void +_nc_copy_termtype(TERMTYPE * dst, TERMTYPE * src) { int i; - *dst = *src; /* ...to copy the sizes and string-tables */ - dst->Booleans = typeMalloc(char, NUM_BOOLEANS(dst)); - dst->Numbers = typeMalloc(short, NUM_NUMBERS(dst)); - dst->Strings = typeMalloc(char *, NUM_STRINGS(dst)); + *dst = *src; /* ...to copy the sizes and string-tables */ + dst->Booleans = typeMalloc(char, NUM_BOOLEANS(dst)); + dst->Numbers = typeMalloc(short, NUM_NUMBERS(dst)); + dst->Strings = typeMalloc(char *, NUM_STRINGS(dst)); /* FIXME: use memcpy for these and similar loops */ - for_each_boolean(i,dst) + for_each_boolean(i, dst) dst->Booleans[i] = src->Booleans[i]; - for_each_number(i,dst) + for_each_number(i, dst) dst->Numbers[i] = src->Numbers[i]; - for_each_string(i,dst) + for_each_string(i, dst) dst->Strings[i] = src->Strings[i]; /* FIXME: we probably should also copy str_table and ext_str_table, @@ -457,6 +473,8 @@ void _nc_copy_termtype(TERMTYPE *dst, TERMTYPE *src) if ((i = NUM_EXT_NAMES(src)) != 0) { dst->ext_Names = typeMalloc(char *, i); memcpy(dst->ext_Names, src->ext_Names, i * sizeof(char *)); + } else { + dst->ext_Names = 0; } #endif diff --git a/lib/libcurses/tinfo/captoinfo.c b/lib/libcurses/tinfo/captoinfo.c index d0e487f779f..8d29df29720 100644 --- a/lib/libcurses/tinfo/captoinfo.c +++ b/lib/libcurses/tinfo/captoinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: captoinfo.c,v 1.6 2000/03/13 23:53:40 millert Exp $ */ +/* $OpenBSD: captoinfo.c,v 1.7 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -94,7 +94,7 @@ #include #include -MODULE_ID("$From: captoinfo.c,v 1.35 2000/03/11 12:27:55 tom Exp $") +MODULE_ID("$From: captoinfo.c,v 1.36 2000/03/19 23:04:26 tom Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ @@ -736,10 +736,9 @@ _nc_infotocap( bufptr = save_char(bufptr, '%'); while (isdigit(*str)) bufptr = save_char(bufptr, *str++); - if (strchr("doxX", *str)) { + if (strchr("doxX.", *str)) { if (*str != 'd') /* termcap doesn't have octal, hex */ return 0; - str++; } break; diff --git a/lib/libcurses/tinfo/comp_parse.c b/lib/libcurses/tinfo/comp_parse.c index e336f915316..9f0afdef140 100644 --- a/lib/libcurses/tinfo/comp_parse.c +++ b/lib/libcurses/tinfo/comp_parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: comp_parse.c,v 1.5 2000/03/13 23:53:40 millert Exp $ */ +/* $OpenBSD: comp_parse.c,v 1.6 2000/03/26 16:45:03 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -54,7 +54,7 @@ #include #include -MODULE_ID("$From: comp_parse.c,v 1.38 2000/03/12 00:14:46 tom Exp $") +MODULE_ID("$From: comp_parse.c,v 1.39 2000/03/25 17:07:30 tom Exp $") static void sanity_check(TERMTYPE *); void (*_nc_check_termtype) (TERMTYPE *) = sanity_check; @@ -176,9 +176,11 @@ _nc_read_entry_source(FILE * fp, char *buf, if (silent) _nc_suppress_warnings = TRUE; /* shut the lexer up, too */ - memset(&thisentry, 0, sizeof(thisentry)); - for (_nc_reset_input(fp, buf); _nc_parse_entry(&thisentry, literal, - silent) != ERR;) { + _nc_reset_input(fp, buf); + for (;;) { + memset(&thisentry, 0, sizeof(thisentry)); + if (_nc_parse_entry(&thisentry, literal, silent) == ERR) + break; if (!isalnum(thisentry.tterm.term_names[0])) _nc_err_abort("terminal names must start with letter or digit"); diff --git a/lib/libcurses/tinfo/comp_scan.c b/lib/libcurses/tinfo/comp_scan.c index dea4b5cc350..0b23157bc8b 100644 --- a/lib/libcurses/tinfo/comp_scan.c +++ b/lib/libcurses/tinfo/comp_scan.c @@ -47,9 +47,10 @@ #include #include +#include #include -MODULE_ID("$From: comp_scan.c,v 1.38 2000/02/13 01:01:26 tom Exp $") +MODULE_ID("$From: comp_scan.c,v 1.41 2000/03/25 17:25:33 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -171,7 +172,11 @@ _nc_get_token(void) if (separator == ':' && ch == ':') ch = next_char(); - if (ch == '.') { + if (ch == '.' +#ifdef NCURSES_EXT_FUNCS + && !_nc_disable_period +#endif + ) { dot_flag = TRUE; DEBUG(8, ("dot-flag set")); @@ -185,7 +190,11 @@ _nc_get_token(void) } /* have to make some punctuation chars legal for terminfo */ - if (!isalnum(ch) && !strchr(terminfo_punct, (char) ch)) { + if (!isalnum(ch) +#ifdef NCURSES_EXT_FUNCS + && !(ch == '.' && _nc_disable_period) +#endif + && !strchr(terminfo_punct, (char) ch)) { _nc_warning("Illegal character (expected alphanumeric or %s) - %s", terminfo_punct, _tracechar((chtype) ch)); _nc_panic_mode(separator); @@ -346,7 +355,7 @@ _nc_get_token(void) break; case '=': - ch = _nc_trans_string(ptr); + ch = _nc_trans_string(ptr, buffer + sizeof(buffer)); if (ch != separator) _nc_warning("Missing separator"); _nc_curr_token.tk_name = buffer; @@ -440,15 +449,18 @@ _nc_get_token(void) */ char -_nc_trans_string(char *ptr) +_nc_trans_string(char *ptr, char *last) { int count = 0; int number; int i, c; chtype ch, last_ch = '\0'; bool ignored = FALSE; + bool long_warning = FALSE; while ((ch = c = next_char()) != (chtype) separator && c != EOF) { + if (ptr == (last - 1)) + break; if ((_nc_syntax == SYN_TERMCAP) && c == '\n') break; if (ch == '^' && last_ch != '%') { @@ -571,8 +583,10 @@ _nc_trans_string(char *ptr) } ignored = FALSE; - if (count > MAXCAPLEN) + if (count > MAXCAPLEN && !long_warning) { _nc_warning("Very long string found. Missing separator?"); + long_warning = TRUE; + } } /* end while */ *ptr = '\0'; diff --git a/lib/libcurses/tinfo/free_ttype.c b/lib/libcurses/tinfo/free_ttype.c index 2b6a053d13c..f21d4ea2282 100644 --- a/lib/libcurses/tinfo/free_ttype.c +++ b/lib/libcurses/tinfo/free_ttype.c @@ -1,4 +1,4 @@ -/* $OpenBSD: free_ttype.c,v 1.2 1999/05/08 20:29:01 millert Exp $ */ +/* $OpenBSD: free_ttype.c,v 1.3 2000/03/26 16:45:04 millert Exp $ */ /**************************************************************************** * Copyright (c) 1999 Free Software Foundation, Inc. * @@ -46,7 +46,7 @@ #include #include -MODULE_ID("$From: free_ttype.c,v 1.2 1999/03/01 00:30:35 tom Exp $") +MODULE_ID("$From: free_ttype.c,v 1.3 2000/03/19 02:03:07 tom Exp $") void _nc_free_termtype(TERMTYPE *ptr) { @@ -64,6 +64,7 @@ void _nc_free_termtype(TERMTYPE *ptr) #if NCURSES_XNAMES bool _nc_user_definable = TRUE; +bool _nc_disable_period = FALSE; /* used by tic -a option */ int use_extended_names(bool flag) { diff --git a/lib/libcurses/tinfo/read_termcap.c b/lib/libcurses/tinfo/read_termcap.c index d127ef7a0fa..45d9bb000cb 100644 --- a/lib/libcurses/tinfo/read_termcap.c +++ b/lib/libcurses/tinfo/read_termcap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read_termcap.c,v 1.6 2000/03/13 23:53:40 millert Exp $ */ +/* $OpenBSD: read_termcap.c,v 1.7 2000/03/26 16:45:04 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -57,7 +57,7 @@ #include #include -MODULE_ID("$From: read_termcap.c,v 1.45 2000/02/13 01:01:26 tom Exp $") +MODULE_ID("$From: read_termcap.c,v 1.46 2000/03/18 21:53:26 tom Exp $") #ifndef PURE_TERMINFO diff --git a/lib/libcurses/tty/lib_vidattr.c b/lib/libcurses/tty/lib_vidattr.c index 8e836442f0f..9a38f0588f5 100644 --- a/lib/libcurses/tty/lib_vidattr.c +++ b/lib/libcurses/tty/lib_vidattr.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_vidattr.c,v 1.3 1999/11/28 17:49:55 millert Exp $ */ +/* $OpenBSD: lib_vidattr.c,v 1.4 2000/03/26 16:45:04 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -66,7 +66,7 @@ #include #include -MODULE_ID("$From: lib_vidattr.c,v 1.24 1999/11/14 02:53:43 tom Exp $") +MODULE_ID("$From: lib_vidattr.c,v 1.26 2000/03/26 02:56:20 tom Exp $"); #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -78,212 +78,217 @@ MODULE_ID("$From: lib_vidattr.c,v 1.24 1999/11/14 02:53:43 tom Exp $") /* if there is no current screen, assume we *can* do color */ #define SetColorsIf(why,old_attr) \ - if (can_color && (1)) { \ + if (can_color && (why)) { \ int old_pair = PAIR_NUMBER(old_attr); \ T(("old pair = %d -- new pair = %d", old_pair, pair)); \ if ((pair != old_pair) \ || (fix_pair0 && (pair == 0)) \ || (reverse ^ ((old_attr & A_REVERSE) != 0))) { \ - _nc_do_color(pair, reverse, outc); \ + _nc_do_color(old_pair, pair, reverse, outc); \ } \ } -int vidputs(attr_t newmode, int (*outc)(int)) +int +vidputs(attr_t newmode, int (*outc) (int)) { -static attr_t previous_attr = A_NORMAL; -attr_t turn_on, turn_off; -int pair; -bool reverse = FALSE; -bool used_ncv = FALSE; -bool can_color = (SP == 0 || SP->_coloron); + static attr_t previous_attr = A_NORMAL; + attr_t turn_on, turn_off; + int pair; + bool reverse = FALSE; + bool used_ncv = FALSE; + bool can_color = (SP == 0 || SP->_coloron); #ifdef NCURSES_EXT_FUNCS -bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color); + bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color); #else #define fix_pair0 FALSE #endif - T((T_CALLED("vidputs(%s)"), _traceattr(newmode))); + T((T_CALLED("vidputs(%s)"), _traceattr(newmode))); - /* this allows us to go on whether or not newterm() has been called */ - if (SP) - previous_attr = SP->_current_attr; + /* this allows us to go on whether or not newterm() has been called */ + if (SP) + previous_attr = SP->_current_attr; - T(("previous attribute was %s", _traceattr(previous_attr))); + T(("previous attribute was %s", _traceattr(previous_attr))); #if !USE_XMC_SUPPORT - if ((SP != 0) - && (magic_cookie_glitch > 0)) - newmode &= ~(SP->_xmc_suppress); + if ((SP != 0) + && (magic_cookie_glitch > 0)) + newmode &= ~(SP->_xmc_suppress); #endif - /* - * If we have a terminal that cannot combine color with video - * attributes, use the colors in preference. - */ - if ((newmode & A_COLOR) - && (no_color_video > 0)) { - static const struct { - attr_t video; - unsigned bit; - } table[] = { - { A_STANDOUT, 1 }, - { A_UNDERLINE, 2 }, - { A_REVERSE, 4 }, - { A_BLINK, 8 }, - { A_DIM, 16 }, - { A_BOLD, 32 }, - { A_INVIS, 64 }, - { A_PROTECT, 128 }, - { A_ALTCHARSET, 256 }, - }; - size_t n; - for (n = 0; n < SIZEOF(table); n++) { - if ((table[n].bit & no_color_video) - && (table[n].video & newmode)) { - used_ncv = TRUE; - if (table[n].video == A_REVERSE) - reverse = TRUE; - else - newmode &= ~table[n].video; - } - } + /* + * If we have a terminal that cannot combine color with video + * attributes, use the colors in preference. + */ + if ((newmode & A_COLOR) + && (no_color_video > 0)) { + /* *INDENT-OFF* */ + static const struct { + attr_t video; + unsigned bit; + } table[] = { + { A_STANDOUT, 1 }, + { A_UNDERLINE, 2 }, + { A_REVERSE, 4 }, + { A_BLINK, 8 }, + { A_DIM, 16 }, + { A_BOLD, 32 }, + { A_INVIS, 64 }, + { A_PROTECT, 128 }, + { A_ALTCHARSET, 256 }, + }; + /* *INDENT-ON* */ + + size_t n; + for (n = 0; n < SIZEOF(table); n++) { + if ((table[n].bit & no_color_video) + && (table[n].video & newmode)) { + used_ncv = TRUE; + if (table[n].video == A_REVERSE) + reverse = TRUE; + else + newmode &= ~table[n].video; + } } + } - if (newmode == previous_attr) - returnCode(OK); + if (newmode == previous_attr) + returnCode(OK); + + pair = PAIR_NUMBER(newmode); + + if (reverse) { + newmode &= ~A_REVERSE; + } - pair = PAIR_NUMBER(newmode); + turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; + turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR; - if (reverse) { - newmode &= ~A_REVERSE; + SetColorsIf(((pair == 0) && !fix_pair0), previous_attr); + + if (newmode == A_NORMAL) { + if ((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode) { + doPut(exit_alt_charset_mode); + previous_attr &= ~A_ALTCHARSET; + } + if (previous_attr) { + doPut(exit_attribute_mode); + previous_attr &= ~A_COLOR; } - turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; - turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR; - - SetColorsIf(pair == 0, previous_attr); - - if (newmode == A_NORMAL) { - if((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode) { - doPut(exit_alt_charset_mode); - previous_attr &= ~A_ALTCHARSET; - } - if (previous_attr) { - doPut(exit_attribute_mode); - if (fix_pair0) _nc_do_color(0, FALSE, _nc_outch); - previous_attr &= ~A_COLOR; - } - - SetColorsIf(pair != 0, previous_attr); - } else if (set_attributes && !used_ncv) { - if (turn_on || turn_off) { - TPUTS_TRACE("set_attributes"); - tputs(tparm(set_attributes, - (newmode & A_STANDOUT) != 0, - (newmode & A_UNDERLINE) != 0, - (newmode & A_REVERSE) != 0, - (newmode & A_BLINK) != 0, - (newmode & A_DIM) != 0, - (newmode & A_BOLD) != 0, - (newmode & A_INVIS) != 0, - (newmode & A_PROTECT) != 0, - (newmode & A_ALTCHARSET) != 0), 1, outc); - previous_attr &= ~A_COLOR; - } - SetColorsIf(pair != 0, previous_attr); - } else { - - T(("turning %s off", _traceattr(turn_off))); - - TurnOff(A_ALTCHARSET, exit_alt_charset_mode); - - if (!SP || SP->_use_rmul) { - TurnOff(A_UNDERLINE, exit_underline_mode); - } - - if (!SP || SP->_use_rmso) { - TurnOff(A_STANDOUT, exit_standout_mode); - } - - if (turn_off && exit_attribute_mode) { - doPut(exit_attribute_mode); - if (fix_pair0) _nc_do_color(0, FALSE, _nc_outch); - turn_on |= (newmode & (chtype)(~A_COLOR)); - previous_attr &= ~A_COLOR; - } - SetColorsIf(pair != 0, previous_attr); - - T(("turning %s on", _traceattr(turn_on))); - - TurnOn (A_ALTCHARSET, enter_alt_charset_mode); - TurnOn (A_BLINK, enter_blink_mode); - TurnOn (A_BOLD, enter_bold_mode); - TurnOn (A_DIM, enter_dim_mode); - TurnOn (A_REVERSE, enter_reverse_mode); - TurnOn (A_STANDOUT, enter_standout_mode); - TurnOn (A_PROTECT, enter_protected_mode); - TurnOn (A_INVIS, enter_secure_mode); - TurnOn (A_UNDERLINE, enter_underline_mode); - TurnOn (A_HORIZONTAL, enter_horizontal_hl_mode); - TurnOn (A_LEFT, enter_left_hl_mode); - TurnOn (A_LOW, enter_low_hl_mode); - TurnOn (A_RIGHT, enter_right_hl_mode); - TurnOn (A_TOP, enter_top_hl_mode); - TurnOn (A_VERTICAL, enter_vertical_hl_mode); + SetColorsIf((pair != 0) || fix_pair0, previous_attr); + } else if (set_attributes && !used_ncv) { + if (turn_on || turn_off) { + TPUTS_TRACE("set_attributes"); + tputs(tparm(set_attributes, + (newmode & A_STANDOUT) != 0, + (newmode & A_UNDERLINE) != 0, + (newmode & A_REVERSE) != 0, + (newmode & A_BLINK) != 0, + (newmode & A_DIM) != 0, + (newmode & A_BOLD) != 0, + (newmode & A_INVIS) != 0, + (newmode & A_PROTECT) != 0, + (newmode & A_ALTCHARSET) != 0), 1, outc); + previous_attr &= ~A_COLOR; } + SetColorsIf((pair != 0) || fix_pair0, previous_attr); + } else { - if (reverse) - newmode |= A_REVERSE; + T(("turning %s off", _traceattr(turn_off))); - if (SP) - SP->_current_attr = newmode; - else - previous_attr = newmode; + TurnOff(A_ALTCHARSET, exit_alt_charset_mode); - returnCode(OK); + if (!SP || SP->_use_rmul) { + TurnOff(A_UNDERLINE, exit_underline_mode); + } + + if (!SP || SP->_use_rmso) { + TurnOff(A_STANDOUT, exit_standout_mode); + } + + if (turn_off && exit_attribute_mode) { + doPut(exit_attribute_mode); + turn_on |= (newmode & (chtype) (~A_COLOR)); + previous_attr &= ~A_COLOR; + } + SetColorsIf((pair != 0) || fix_pair0, previous_attr); + + T(("turning %s on", _traceattr(turn_on))); + /* *INDENT-OFF* */ + TurnOn(A_ALTCHARSET, enter_alt_charset_mode); + TurnOn(A_BLINK, enter_blink_mode); + TurnOn(A_BOLD, enter_bold_mode); + TurnOn(A_DIM, enter_dim_mode); + TurnOn(A_REVERSE, enter_reverse_mode); + TurnOn(A_STANDOUT, enter_standout_mode); + TurnOn(A_PROTECT, enter_protected_mode); + TurnOn(A_INVIS, enter_secure_mode); + TurnOn(A_UNDERLINE, enter_underline_mode); + TurnOn(A_HORIZONTAL, enter_horizontal_hl_mode); + TurnOn(A_LEFT, enter_left_hl_mode); + TurnOn(A_LOW, enter_low_hl_mode); + TurnOn(A_RIGHT, enter_right_hl_mode); + TurnOn(A_TOP, enter_top_hl_mode); + TurnOn(A_VERTICAL, enter_vertical_hl_mode); + /* *INDENT-ON* */ + + } + + if (reverse) + newmode |= A_REVERSE; + + if (SP) + SP->_current_attr = newmode; + else + previous_attr = newmode; + + returnCode(OK); } -int vidattr(attr_t newmode) +int +vidattr(attr_t newmode) { - T((T_CALLED("vidattr(%s)"), _traceattr(newmode))); + T((T_CALLED("vidattr(%s)"), _traceattr(newmode))); - returnCode(vidputs(newmode, _nc_outch)); + returnCode(vidputs(newmode, _nc_outch)); } -chtype termattrs(void) +chtype +termattrs(void) { - chtype attrs = A_NORMAL; + chtype attrs = A_NORMAL; - if (enter_alt_charset_mode) - attrs |= A_ALTCHARSET; + if (enter_alt_charset_mode) + attrs |= A_ALTCHARSET; - if (enter_blink_mode) - attrs |= A_BLINK; + if (enter_blink_mode) + attrs |= A_BLINK; - if (enter_bold_mode) - attrs |= A_BOLD; + if (enter_bold_mode) + attrs |= A_BOLD; - if (enter_dim_mode) - attrs |= A_DIM; + if (enter_dim_mode) + attrs |= A_DIM; - if (enter_reverse_mode) - attrs |= A_REVERSE; + if (enter_reverse_mode) + attrs |= A_REVERSE; - if (enter_standout_mode) - attrs |= A_STANDOUT; + if (enter_standout_mode) + attrs |= A_STANDOUT; - if (enter_protected_mode) - attrs |= A_PROTECT; + if (enter_protected_mode) + attrs |= A_PROTECT; - if (enter_secure_mode) - attrs |= A_INVIS; + if (enter_secure_mode) + attrs |= A_INVIS; - if (enter_underline_mode) - attrs |= A_UNDERLINE; + if (enter_underline_mode) + attrs |= A_UNDERLINE; - if (SP->_coloron) - attrs |= A_COLOR; + if (SP->_coloron) + attrs |= A_COLOR; - return(attrs); + return (attrs); } - diff --git a/lib/libcurses/tty/tty_update.c b/lib/libcurses/tty/tty_update.c index c0b08f631f5..d0f32008f57 100644 --- a/lib/libcurses/tty/tty_update.c +++ b/lib/libcurses/tty/tty_update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_update.c,v 1.7 2000/03/10 01:35:05 millert Exp $ */ +/* $OpenBSD: tty_update.c,v 1.8 2000/03/26 16:45:04 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -72,7 +72,7 @@ #include -MODULE_ID("$From: tty_update.c,v 1.131 2000/02/26 23:22:11 tom Exp $") +MODULE_ID("$From: tty_update.c,v 1.134 2000/03/26 02:17:10 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -360,10 +360,12 @@ can_clear_with(chtype ch) if (!back_color_erase && SP->_coloron) { if (ch & A_COLOR) return FALSE; +#ifdef NCURSES_EXT_FUNCS if (!SP->_default_color) return FALSE; if (SP->_default_fg != C_MASK || SP->_default_bg != C_MASK) return FALSE; +#endif } return ((ch & ~(NONBLANK_ATTR | A_COLOR)) == BLANK); } @@ -1237,7 +1239,7 @@ ClearScreen(chtype blank) #ifdef NCURSES_EXT_FUNCS if (SP->_coloron && !SP->_default_color) { - _nc_do_color(0, FALSE, _nc_outch); + _nc_do_color(COLOR_PAIR(SP->_current_attr), 0, FALSE, _nc_outch); if (!back_color_erase) { fast_clear = FALSE; } @@ -1722,7 +1724,7 @@ _nc_screen_wrap(void) if (SP->_coloron && !SP->_default_color) { SP->_default_color = TRUE; - _nc_do_color(0, FALSE, _nc_outch); + _nc_do_color(-1, 0, FALSE, _nc_outch); SP->_default_color = FALSE; } #endif diff --git a/share/termtypes/termtypes.master b/share/termtypes/termtypes.master index 4a96613e2cd..8e6f00da8e5 100644 --- a/share/termtypes/termtypes.master +++ b/share/termtypes/termtypes.master @@ -1,13 +1,13 @@ ######## TERMINAL TYPE DESCRIPTIONS SOURCE FILE # -# $OpenBSD: termtypes.master,v 1.19 2000/03/23 14:29:35 millert Exp $ +# $OpenBSD: termtypes.master,v 1.20 2000/03/26 16:45:00 millert Exp $ # # This version of terminfo.src is distributed with ncurses. # Report bugs to # bug-ncurses@gnu.org # # Version 10.2.1 -# Date: 2000/03/19 23:06:50 +# Date: 2000/03/26 00:53:29 # terminfo syntax # # Eric S. Raymond (current maintainer) @@ -393,6 +393,7 @@ klone+color|color control for ansi.sys and ISO6429-compatible displays, # This is better than klone+color, it doesn't assume white-on-black as the # default color pair, but many `ANSI' terminals don't grok the cap. ecma+color|color control for ECMA-48-compatible terminals, + AX, colors#8, ncv#3, pairs#64, op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, @@ -2274,11 +2275,8 @@ z340-nam|zstem vt340 terminal emulator 132col 42line (no automatic margins), # CRT is shareware. It implements some xterm features, including mouse. crt|crt-vt220|CRT 2.3 emulating VT220, bce, msgr, - colors#8, pairs#64, - hts=\EH, op=\E[39;49m, setab=\E[4%p1%dm, - setaf=\E[3%p1%dm, setb=\E[4%p1%dm, setf=\E[3%p1%dm, - u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, - use=vt220, + ncv@, + hts=\EH, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, use=vt220, use=ecma+color, # This entry is for Tera Term Pro version 2.3, for MS-Windows 95/NT written by # T. Teranishi dated Mar 10, 1998. It is a free software terminal emulator @@ -2442,7 +2440,7 @@ xterm-r6|xterm-old|xterm X11R6 version, # The name has been changed and some aliases have been removed. xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System), OTbs, am, bce, km, mir, msgr, xenl, - colors#8, cols#80, it#8, lines#24, pairs#64, + cols#80, it#8, lines#24, ncv@, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, @@ -2464,11 +2462,10 @@ xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System), kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khome=\EOH, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, meml=\El, - memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, - rmam=\E[?7l, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, - rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=^O, + memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, + rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>, + rmso=\E[27m, rmul=\E[24m, rs1=^O, rs2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, sc=\E7, - setab=\E[4%p1%dm, setaf=\E[3%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, @@ -2476,6 +2473,7 @@ xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System), smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd, + use=ecma+color, # This is the stock xterm entry supplied with XFree86 3.3, which uses VT100 # codes for F1-F4 except while in VT220 mode. @@ -2660,9 +2658,9 @@ xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold, kterm|kterm kanji terminal emulator (X window system), eslok, hs, acsc@, csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs@, fsl=\E[?F, - kmous=\E[M, op=\E[39;49m, rc=\E8, rmacs@, sc=\E7, smacs@, - tsl=\E[?E\E[?%i%dT, - use=xterm-r6, use=klone+color, + kmous=\E[M, rc=\E8, rmacs@, sc=\E7, smacs@, + tsl=\E[?E\E[?%i%dT, use=xterm-r6, + use=ecma+color, # See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file xterm-nic|xterm with ich/ich1 suppressed for non-curses programs, ich@, ich1@, @@ -2680,7 +2678,7 @@ xterm1|xterm terminal emulator ignoring the alternate screen buffer, # and 27, but they are not present in the terminfo or termcap. color_xterm|cx|cx100|color_xterm color terminal emulator for X, OTbs, am, km, mir, msgr, xenl, - colors#8, cols#80, it#8, lines#65, pairs#64, + cols#80, it#8, lines#65, ncv@, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, @@ -2695,15 +2693,16 @@ color_xterm|cx|cx100|color_xterm color terminal emulator for X, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[7~, kich1=\E[2~, - kmous=\E[M, knp=\E[6~, kpp=\E[5~, op=\E[39;49m, rc=\E8, - rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, - rmcup=\E>\E[?41;1r, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + kmous=\E[M, knp=\E[6~, kpp=\E[5~, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmam=\E[?7l, rmcup=\E>\E[?41;1r, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, rs1=\E(B\017\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<, - sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sc=\E7, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, sgr0=\E[m, smacs=^N, smam=\E[?7h, smcup=\E[?1;41s\E[?1;41h\E=, smir=\E[4h, smso=\E[7m, smul=\E[4m, + use=ecma+color, # The 'nxterm' distributed with Redhat Linux 5.2 is a slight rehack of # xterm-sb_right-ansi-3d, which implements ANSI colors, but does not support @@ -2779,9 +2778,8 @@ rxvt-basic|rxvt terminal base (X Window System), smcup=\E7\E[?47h, smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, rxvt|rxvt terminal emulator (X Window System), - colors#8, pairs#64, - op=\E[39;49m, setab=\E[%p1%{40}%+%dm, - setaf=\E[%p1%{30}%+%dm, sgr0=\E[m\017, use=rxvt-basic, + ncv@, + sgr0=\E[m\017, use=rxvt-basic, use=ecma+color, # These (xtermc and xtermm) are distributed with Solaris. They refer to a # variant of xterm which is apparently no longer supported, but are interesting @@ -2987,7 +2985,7 @@ eterm|gnu emacs term.el terminal emulation, # AX (bool) Does understand ANSI set default fg/bg color # (\E[39m / \E[49m). screen|VT 100/ANSI X3.64 virtual terminal, - OTbs, OTpt, am, km, mir, msgr, xenl, AX, G0, + OTbs, OTpt, am, km, mir, msgr, xenl, G0, colors#8, cols#80, it#8, lines#24, pairs#64, acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, @@ -3454,7 +3452,7 @@ nwp517-w|nwp-517-w|nwp-517 vt200 132 cols 50 rows, # Corrected Sun Aug 9 1998 by Alexander V. Lukyanov dtterm|CDE desktop terminal, am, mir, msgr, xenl, xon, - colors#8, cols#80, it#8, lines#24, lm#0, pairs#64, + cols#80, it#8, lines#24, lm#0, ncv@, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, @@ -3473,13 +3471,13 @@ dtterm|CDE desktop terminal, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, - kslt=\E[4~, nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, - rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmso=\E[22;27m, - rmul=\E[24m, sc=\E7, setab=\E[%p1%{40}%+%dm, - setaf=\E[%p1%{30}%+%dm, + kslt=\E[4~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmso=\E[22;27m, rmul=\E[24m, + sc=\E7, sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, + use=ecma+color, #### Non-Unix Consoles # @@ -18361,6 +18359,10 @@ v3220|LANPAR Vision II model 3220/3221/3222, # * update OTxx capabilities for changes on 2000/3/4. # * revert part of vt220 change (request by Todd C Miller for OpenBSD) # +# 2000/3/26 +# * move screen's AX extension to ecma+color, modify several entries to +# use that, adjusting ncv as needed -TD +# # The following sets edit modes for GNU EMACS. # Local Variables: # fill-prefix:"\t" diff --git a/usr.bin/infocmp/infocmp.1tbl b/usr.bin/infocmp/infocmp.1tbl index 227a9174c01..a459e412528 100644 --- a/usr.bin/infocmp/infocmp.1tbl +++ b/usr.bin/infocmp/infocmp.1tbl @@ -1,5 +1,5 @@ '\" t -.\" $OpenBSD: infocmp.1tbl,v 1.7 2000/03/13 23:53:41 millert Exp $ +.\" $OpenBSD: infocmp.1tbl,v 1.8 2000/03/26 16:45:04 millert Exp $ .\" .\"*************************************************************************** .\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * @@ -29,7 +29,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: infocmp.1m,v 1.23 2000/03/12 02:52:56 tom Exp $ +.\" $From: infocmp.1m,v 1.24 2000/03/19 03:03:31 tom Exp $ .TH infocmp 1 "" .ds n 5 .ds d /usr/share/terminfo @@ -223,15 +223,19 @@ by also specifying \fB-r\fR. \fB-G\fR Display constant literals in decimal form rather than their character equivalents. +.TP +\fB-a\fR +tells \fBinfocmp\fP to retain commented-out capabilities rather than discarding +them. Capabilities are commented by prefixing them with a period. .TP 5 \fB-q\fR Make the comparison listing shorter by omitting subheadings, and using -"-" for absent capabilities, "@" for cancelled rather than "NULL". +"-" for absent capabilities, "@" for canceled rather than "NULL". .TP 5 \fB-R\fR\fIsubset\fR Restrict output to a given subset. This option is for use with archaic -versions of terminfo like those on SVr1, Ultrix, or HP/UX that don't support -the full set of SVR4/XSI Curses terminfo; and outright broken ports like AIX +versions of terminfo like those on SVr1, Ultrix, or HP/UX that do not support +the full set of SVR4/XSI Curses terminfo; and variants such as AIX that have their own extensions incompatible with SVr4/XSI. Available terminfo subsets are "SVr1", "Ultrix", "HP", and "AIX"; see \fBterminfo\fR(\*n) for details. You can also choose the subset "BSD" which selects only capabilities @@ -345,6 +349,7 @@ The \fB-G\fR, \fB-R\fR, \fB-T\fR, +\fB-a\fR, \fB-e\fR, \fB-f\fR, \fB-g\fR, diff --git a/usr.bin/infocmp/infocmp.c b/usr.bin/infocmp/infocmp.c index f684a048bd9..064e928d8d6 100644 --- a/usr.bin/infocmp/infocmp.c +++ b/usr.bin/infocmp/infocmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: infocmp.c,v 1.9 2000/03/13 23:53:41 millert Exp $ */ +/* $OpenBSD: infocmp.c,v 1.10 2000/03/26 16:45:04 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,7 +43,7 @@ #include #include -MODULE_ID("$From: infocmp.c,v 1.52 2000/03/12 02:34:09 tom Exp $") +MODULE_ID("$From: infocmp.c,v 1.54 2000/03/19 02:56:14 tom Exp $") #define L_CURL "{" #define R_CURL "}" @@ -68,9 +68,9 @@ static int termcount; /* count of terminal entries */ static bool limited = TRUE; /* "-r" option is not set */ static bool quiet = FALSE; -static char *bool_sep = ":"; -static char *s_absent = "NULL"; -static char *s_cancel = "NULL"; +static const char *bool_sep = ":"; +static const char *s_absent = "NULL"; +static const char *s_cancel = "NULL"; static const char *tversion; /* terminfo version selected */ static int itrace; /* trace flag for debugging */ static int mwidth = 60; @@ -285,7 +285,7 @@ print_uses(ENTRY * ep, FILE * fp) } } -static char * +static const char * dump_boolean(int val) /* display the value of a boolean capability */ { @@ -903,6 +903,9 @@ usage(void) ," -R subset (see manpage)" ," -T eliminate size limits (test)" ," -V print version" +#if NCURSES_XNAMES + ," -a with -F, list commented-out caps" +#endif ," -c list common capabilities" ," -d list different capabilities" ," -e format output for C initializer" @@ -1118,8 +1121,14 @@ main(int argc, char *argv[]) /* where is the terminfo database location going to default to? */ restdir = firstdir = 0; - while ((c = getopt(argc, argv, "deEcCfFGgIinlLpqrR:s:uv:Vw:A:B:1T")) != EOF) + while ((c = getopt(argc, argv, "adeEcCfFGgIinlLpqrR:s:uv:Vw:A:B:1T")) != EOF) switch (c) { +#if NCURSES_XNAMES + case 'a': + _nc_disable_period = TRUE; + use_extended_names(TRUE); + break; +#endif case 'd': compare = C_DIFFERENCE; break; diff --git a/usr.bin/tic/captoinfo.1tbl b/usr.bin/tic/captoinfo.1tbl index 7beafe674e4..ddff93bcb86 100644 --- a/usr.bin/tic/captoinfo.1tbl +++ b/usr.bin/tic/captoinfo.1tbl @@ -1,8 +1,8 @@ '\" t -.\" $OpenBSD: captoinfo.1tbl,v 1.4 1999/01/18 18:57:52 millert Exp $ +.\" $OpenBSD: captoinfo.1tbl,v 1.5 2000/03/26 16:45:04 millert Exp $ .\" .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: captoinfo.1m,v 1.13 1998/12/26 19:57:11 tom Exp $ +.\" $From: captoinfo.1m,v 1.14 2000/03/19 02:20:28 tom Exp $ .TH captoinfo 1 "" .ds n 5 .ds d /usr/share/terminfo @@ -175,6 +175,7 @@ capabilities \fBmeml\fR (memory lock) and \fBmemu\fR (memory unlock). These will be discarded with a warning message. .SH NOTES This utility is actually a link to \fItic\fR(1), running in \fI-I\fR mode. +You can use other \fItic\fR options such as \fB-f\fR and \fB-x\fR. The trace option isn't identical to SVr4's. Under SVr4, instead of following the -v with a trace level n, you repeat it n times. diff --git a/usr.bin/tic/infotocap.1 b/usr.bin/tic/infotocap.1 index 48418b580a1..68c6724fe04 100644 --- a/usr.bin/tic/infotocap.1 +++ b/usr.bin/tic/infotocap.1 @@ -1,7 +1,7 @@ '\" t -.\" $OpenBSD: infotocap.1,v 1.1 1999/12/12 04:49:19 millert Exp $ +.\" $OpenBSD: infotocap.1,v 1.2 2000/03/26 16:45:04 millert Exp $ .\"*************************************************************************** -.\" Copyright (c) 1999 Free Software Foundation, Inc. * +.\" Copyright (c) 1999,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -28,7 +28,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: infotocap.1m,v 1.1 1999/12/11 19:25:27 tom Exp $ +.\" $From: infotocap.1m,v 1.2 2000/03/19 02:19:49 tom Exp $ .TH infotocap 1M "" .ds n 5 .ds d /usr/share/terminfo @@ -61,6 +61,7 @@ change the output to \fIwidth\fR characters. Compiled terminal description database. .SH NOTES This utility is actually a link to \fItic\fR(1M), running in \fI-C\fR mode. +You can use other \fItic\fR options such as \fB-f\fR and \fB-x\fR. .SH SEE ALSO \fBcurses\fR(3X), \fBtic\fR(1M), diff --git a/usr.bin/tic/tic.1 b/usr.bin/tic/tic.1 index df0946cda4f..9cf07865de0 100644 --- a/usr.bin/tic/tic.1 +++ b/usr.bin/tic/tic.1 @@ -1,7 +1,7 @@ -.\" $OpenBSD: tic.1,v 1.9 2000/01/08 06:26:24 millert Exp $ +.\" $OpenBSD: tic.1,v 1.10 2000/03/26 16:45:04 millert Exp $ .\" .\"*************************************************************************** -.\" Copyright (c) 1998,1999 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -28,7 +28,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: tic.1m,v 1.25 1999/03/07 02:07:06 tom Exp $ +.\" $From: tic.1m,v 1.26 2000/03/19 02:18:18 tom Exp $ .TH tic 1 "" .ds n 5 .ds d /usr/share/terminfo @@ -43,6 +43,7 @@ I\ N\ R\ T\ +a\ c\ f\ r\ @@ -74,8 +75,14 @@ Libraries that read terminfo entries are expected to check for a TERMINFO directory first, look at \fI$HOME/.terminfo\fR if TERMINFO is not set, and finally look in \fI\*d\fR. .TP +\fB-a\fR +tells \fBtic\fP to retain commented-out capabilities rather than discarding +them. Capabilities are commented by prefixing them with a period. +This sets the \fB-x\fR option, because it treats the commented-out +entries as user-defined names. +.TP \fB-c\fR -specifies to only check \fIfile\fR for errors, including syntax problems and +tells \fBtic\fP to only check \fIfile\fR for errors, including syntax problems and bad use links. If you specify \fB-C\fR (\fB-I\fR) with this option, the code will print warnings about entries which, after use resolution, are more than 1023 (4096) bytes long. Due to a fixed buffer length in older termcap @@ -173,6 +180,9 @@ are written, and the number of entries which are compiled. .TP \fB-x\fR Treat unknown capabilities as user-defined. +That is, if you supply a capability name which \fBtic\fP does not recognize, +it will infer its type (boolean, number or string) from the syntax and +make an extended table entry for that. .TP \fIfile\fR contains one or more \fBterminfo\fR terminal descriptions in source @@ -253,16 +263,17 @@ The error messages from this \fBtic\fR have the same format as GNU C error messages, and can be parsed by GNU Emacs's compile facility. The -\fB-o\fR, +\fB-C\fR, \fB-G\fR, \fB-I\fR, -\fB-C\fR, \fB-N\fR, \fB-R\fR, +\fB-T\fR, +\fB-a\fR, \fB-e\fR, \fB-f\fR, \fB-g\fR, -\fB-T\fR, +\fB-o\fR, \fB-r\fR, \fB-s\fR and \fB-x\fR diff --git a/usr.bin/tic/tic.c b/usr.bin/tic/tic.c index a637a663a53..8e926dcbfbf 100644 --- a/usr.bin/tic/tic.c +++ b/usr.bin/tic/tic.c @@ -42,7 +42,7 @@ #include #include -MODULE_ID("$From: tic.c,v 1.64 2000/03/11 21:45:07 tom Exp $") +MODULE_ID("$From: tic.c,v 1.67 2000/03/19 02:08:10 tom Exp $") const char *_nc_progname = "tic"; @@ -91,6 +91,9 @@ usage(void) " -N disable smart defaults for source translation", " -R restrict translation to given terminfo/termcap version", " -T remove size-restrictions on compiled description", +#if NCURSES_XNAMES + " -a retain commented-out capabilities (sets -x also)", +#endif " -c check only, validate input without compiling or translating", " -f format complex strings for readability", " -G format %{number} to %'char'", @@ -445,7 +448,7 @@ main(int argc, char *argv[]) * be optional. */ while ((this_opt = getopt(argc, argv, - "0123456789CILNR:TVce:fGgo:rsvwx")) != -1) { + "0123456789CILNR:TVace:fGgo:rsvwx")) != -1) { if (isdigit(this_opt)) { switch (last_opt) { case 'v': @@ -521,6 +524,9 @@ main(int argc, char *argv[]) width = 0; break; #if NCURSES_XNAMES + case 'a': + _nc_disable_period = TRUE; + /* FALLTHRU */ case 'x': use_extended_names(TRUE); break; @@ -652,9 +658,10 @@ main(int argc, char *argv[]) if (!check_only) { if (!infodump && !capdump) { _nc_set_writedir(outdir); - for_entry_list(qp) + for_entry_list(qp) { if (matches(namelst, qp->tterm.term_names)) - write_it(qp); + write_it(qp); + } } else { /* this is in case infotocap() generates warnings */ _nc_curr_col = _nc_curr_line = -1; @@ -757,7 +764,7 @@ similar_sgr(char *a, char *b) } static void -check_sgr(TERMTYPE * tp, char *zero, int num, char *cap, char *name) +check_sgr(TERMTYPE * tp, char *zero, int num, char *cap, const char *name) { char *test = tparm(set_attributes, num == 1, -- 2.20.1