diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-03-13 23:53:42 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-03-13 23:53:42 +0000 |
commit | 8abf50f462807ac1486ec6dd939cbebd80aefe98 (patch) | |
tree | 3b1a88f7786b55d8801f4954dd7657582bbd867b /lib | |
parent | d975165e0ed6e5da9195594fc631897099795165 (diff) |
update to ncurses-5.0-20000311
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcurses/curses.h | 4 | ||||
-rw-r--r-- | lib/libcurses/shlib_version | 2 | ||||
-rw-r--r-- | lib/libcurses/term.h | 9 | ||||
-rw-r--r-- | lib/libcurses/term_entry.h | 19 | ||||
-rw-r--r-- | lib/libcurses/terminfo.5tbl | 22 | ||||
-rw-r--r-- | lib/libcurses/tinfo/alloc_entry.c | 218 | ||||
-rw-r--r-- | lib/libcurses/tinfo/captoinfo.c | 23 | ||||
-rw-r--r-- | lib/libcurses/tinfo/comp_parse.c | 421 | ||||
-rw-r--r-- | lib/libcurses/tinfo/init_keytry.c | 4 | ||||
-rw-r--r-- | lib/libcurses/tinfo/lib_options.c | 8 | ||||
-rw-r--r-- | lib/libcurses/tinfo/make_keys.c | 4 | ||||
-rw-r--r-- | lib/libcurses/tinfo/parse_entry.c | 8 | ||||
-rw-r--r-- | lib/libcurses/tinfo/read_entry.c | 6 | ||||
-rw-r--r-- | lib/libcurses/tinfo/read_termcap.c | 4 | ||||
-rw-r--r-- | lib/libcurses/tinfo/write_entry.c | 17 |
15 files changed, 389 insertions, 380 deletions
diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index 8bac7690346..b17f89d8f67 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -1,4 +1,4 @@ -/* $OpenBSD: curses.h,v 1.47 2000/03/10 01:35:01 millert Exp $ */ +/* $OpenBSD: curses.h,v 1.48 2000/03/13 23:53:38 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 20000304 +#define NCURSES_VERSION_PATCH 20000311 /* This is defined in more than one ncurses header, for identification */ #undef NCURSES_VERSION diff --git a/lib/libcurses/shlib_version b/lib/libcurses/shlib_version index 9c1551636c5..5b844bbf422 100644 --- a/lib/libcurses/shlib_version +++ b/lib/libcurses/shlib_version @@ -1,2 +1,2 @@ -major=6 +major=7 minor=0 diff --git a/lib/libcurses/term.h b/lib/libcurses/term.h index 1d44050ec54..4011b24e0c7 100644 --- a/lib/libcurses/term.h +++ b/lib/libcurses/term.h @@ -1,7 +1,7 @@ -/* $OpenBSD: term.h,v 1.8 2000/01/08 06:26:25 millert Exp $ */ +/* $OpenBSD: term.h,v 1.9 2000/03/13 23:53:39 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 * @@ -33,7 +33,7 @@ /* and: Eric S. Raymond <esr@snark.thyrsus.com> */ /****************************************************************************/ -/* $From: MKterm.h.awk.in,v 1.36 1999/09/01 22:36:52 Peter.Wemm Exp $ */ +/* $From: MKterm.h.awk.in,v 1.37 2000/03/12 02:40:07 tom Exp $ */ /* ** term.h -- Definition of struct term @@ -691,6 +691,9 @@ extern "C" { #define NUMCOUNT 39 #define STRCOUNT 414 +/* used by code for comparing entries */ +#define acs_chars_index 146 + typedef struct termtype { /* in-core form of terminfo data */ char *term_names; /* str_table offset of term names */ char *str_table; /* pointer to string table */ diff --git a/lib/libcurses/term_entry.h b/lib/libcurses/term_entry.h index 76c23c9fc21..4d42cb32e56 100644 --- a/lib/libcurses/term_entry.h +++ b/lib/libcurses/term_entry.h @@ -1,7 +1,7 @@ -/* $OpenBSD: term_entry.h,v 1.8 1999/05/17 03:03:57 millert Exp $ */ +/* $OpenBSD: term_entry.h,v 1.9 2000/03/13 23:53:39 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 * @@ -33,6 +33,7 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ +/* $From: term_entry.h,v 1.28 2000/03/12 00:44:04 tom Exp $ */ /* * term_entry.h -- interface to entry-manipulation code @@ -48,16 +49,20 @@ extern "C" { #include <term.h> #define MAX_USES 32 +#define MAX_CROSSLINKS 16 typedef struct entry { TERMTYPE tterm; int nuses; struct { - void *parent; /* (char *) or (ENTRY *) */ + char *name; + struct entry *link; long line; } uses[MAX_USES]; + int ncrosslinks; + struct entry *crosslinks[MAX_CROSSLINKS]; long cstart, cend; long startline; struct entry *next; @@ -143,19 +148,13 @@ extern void _nc_write_entry(TERMTYPE *const); /* comp_parse.c: entry list handling */ extern void _nc_read_entry_source(FILE*, char*, int, bool, bool (*)(ENTRY*)); extern bool _nc_entry_match(char *, char *); -extern int _nc_resolve_uses(void); +extern int _nc_resolve_uses(bool); extern void _nc_free_entries(ENTRY *); extern void (*_nc_check_termtype)(TERMTYPE *); /* trace_xnames.c */ extern void _nc_trace_xnames(TERMTYPE *); -#ifdef __OpenBSD__ -/* read_bsd_terminfo.c: terminfo.db reading */ -extern int _nc_read_bsd_terminfo_entry(const char * const, char * const, TERMTYPE *const); -extern int _nc_read_bsd_terminfo_file(const char * const, TERMTYPE *const); -#endif /* __OpenBSD__ */ - #ifdef __cplusplus } #endif diff --git a/lib/libcurses/terminfo.5tbl b/lib/libcurses/terminfo.5tbl index 587bf6b767f..f12d171a732 100644 --- a/lib/libcurses/terminfo.5tbl +++ b/lib/libcurses/terminfo.5tbl @@ -33,7 +33,7 @@ .\"*************************************************************************** .\" .\" $From: terminfo.head,v 1.8 1998/03/11 21:12:53 juergen Exp $ -.\" $OpenBSD: terminfo.5tbl,v 1.6 2000/01/09 05:06:01 millert Exp $ +.\" $OpenBSD: terminfo.5tbl,v 1.7 2000/03/13 23:53:39 millert Exp $ .TH TERMINFO 5 "" "" "File Formats" .ds n 5 .ds d /usr/share/terminfo @@ -1623,7 +1623,7 @@ YI Set page length to #1 hundredth of an inch T} .TE .ad -.\" $From: terminfo.tail,v 1.30 2000/01/08 22:09:12 tom Exp $ +.\" $From: terminfo.tail,v 1.31 2000/03/12 00:36:41 tom Exp $ .\" Beginning of terminfo.tail file .ps +1 .PP @@ -2951,16 +2951,20 @@ capabilities of the form \fBx\fR\fIx\fR. .PP .SS Similar Terminals .PP -If there are two very similar terminals, -one can be defined as being just like the other with certain exceptions. -The string capability \fBuse\fR can be given -with the name of the similar terminal. -The capabilities given before +If there are two very similar terminals, one (the variant) can be defined as +being just like the other (the base) with certain exceptions. In the +definition of the variant, the string capability \fBuse\fR can be given with +the name of the base terminal. The capabilities given before .B use -override those in the terminal type invoked by +override those in the base type named by .BR use . +If there are multiple \fBuse\fR capabilities, they are merged in reverse order. +That is, the rightmost \fBuse\fR reference is processed first, then the one to +its left, and so forth. Capabilities given explicitly in the entry override +those brought in by \fBuse\fR references. +.PP A capability can be canceled by placing \fBxx@\fR to the left of the -capability definition, where xx is the capability. +use reference that imports it, where \fIxx\fP is the capability. For example, the entry .PP 2621-nl, smkx@, rmkx@, use=2621, diff --git a/lib/libcurses/tinfo/alloc_entry.c b/lib/libcurses/tinfo/alloc_entry.c index 3f94b109c31..b019f59ce6e 100644 --- a/lib/libcurses/tinfo/alloc_entry.c +++ b/lib/libcurses/tinfo/alloc_entry.c @@ -1,7 +1,7 @@ -/* $OpenBSD: alloc_entry.c,v 1.2 1999/03/02 06:23:28 millert Exp $ */ +/* $OpenBSD: alloc_entry.c,v 1.3 2000/03/13 23:53:39 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 * @@ -33,7 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * alloc_entry.c -- allocation functions for terminfo entries * @@ -50,149 +49,152 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: alloc_entry.c,v 1.30 1999/03/01 02:03:45 tom Exp $") +MODULE_ID("$From: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $") #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 #define MAX_STRTAB 4096 /* documented maximum entry size */ -static char stringbuf[MAX_STRTAB]; /* buffer for string capabilities */ -static size_t next_free; /* next free character in stringbuf */ +static char stringbuf[MAX_STRTAB]; /* buffer for string capabilities */ +static size_t next_free; /* next free character in stringbuf */ -void _nc_init_entry(TERMTYPE *const tp) +void +_nc_init_entry(TERMTYPE * const tp) /* initialize a terminal type data block */ { -int i; + int i; #if NCURSES_XNAMES - tp->num_Booleans = BOOLCOUNT; - tp->num_Numbers = NUMCOUNT; - tp->num_Strings = STRCOUNT; - tp->ext_Booleans = 0; - tp->ext_Numbers = 0; - tp->ext_Strings = 0; + tp->num_Booleans = BOOLCOUNT; + tp->num_Numbers = NUMCOUNT; + tp->num_Strings = STRCOUNT; + tp->ext_Booleans = 0; + tp->ext_Numbers = 0; + tp->ext_Strings = 0; #endif - if (tp->Booleans == 0) - tp->Booleans = typeMalloc(char,BOOLCOUNT); - if (tp->Numbers == 0) - tp->Numbers = typeMalloc(short,NUMCOUNT); - if (tp->Strings == 0) - tp->Strings = typeMalloc(char *,STRCOUNT); + if (tp->Booleans == 0) + tp->Booleans = typeMalloc(char, BOOLCOUNT); + if (tp->Numbers == 0) + tp->Numbers = typeMalloc(short, NUMCOUNT); + if (tp->Strings == 0) + tp->Strings = typeMalloc(char *, STRCOUNT); - for_each_boolean(i,tp) - tp->Booleans[i] = FALSE; + for_each_boolean(i, tp) + tp->Booleans[i] = FALSE; - for_each_number(i,tp) - tp->Numbers[i] = ABSENT_NUMERIC; + for_each_number(i, tp) + tp->Numbers[i] = ABSENT_NUMERIC; - for_each_string(i,tp) - tp->Strings[i] = ABSENT_STRING; + for_each_string(i, tp) + tp->Strings[i] = ABSENT_STRING; - next_free = 0; + next_free = 0; } -ENTRY *_nc_copy_entry(ENTRY *oldp) +ENTRY * +_nc_copy_entry(ENTRY * oldp) { - ENTRY *newp = typeCalloc(ENTRY,1); + ENTRY *newp = typeCalloc(ENTRY, 1); - if (newp != 0) { - *newp = *oldp; - _nc_copy_termtype(&(newp->tterm), &(oldp->tterm)); - } - return newp; + if (newp != 0) { + *newp = *oldp; + _nc_copy_termtype(&(newp->tterm), &(oldp->tterm)); + } + return newp; } -char *_nc_save_str(const char *const string) +char * +_nc_save_str(const char *const string) /* save a copy of string in the string buffer */ { -size_t old_next_free = next_free; -size_t len = strlen(string) + 1; - - if (next_free + len < MAX_STRTAB) - { - strcpy(&stringbuf[next_free], string); - DEBUG(7, ("Saved string %s", _nc_visbuf(string))); - DEBUG(7, ("at location %d", (int) next_free)); - next_free += len; - } - return(stringbuf + old_next_free); + size_t old_next_free = next_free; + size_t len = strlen(string) + 1; + + if (next_free + len < MAX_STRTAB) { + strcpy(&stringbuf[next_free], string); + DEBUG(7, ("Saved string %s", _nc_visbuf(string))); + DEBUG(7, ("at location %d", (int) next_free)); + next_free += len; + } + return (stringbuf + old_next_free); } -void _nc_wrap_entry(ENTRY *const ep) +void +_nc_wrap_entry(ENTRY * const ep) /* copy the string parts to allocated storage, preserving pointers to it */ { -int offsets[MAX_ENTRY_SIZE/2], useoffsets[MAX_USES]; -int i, n; -TERMTYPE *tp = &(ep->tterm); - - n = tp->term_names - stringbuf; - for_each_string(i, &(ep->tterm)) { - if (tp->Strings[i] == ABSENT_STRING) - offsets[i] = ABSENT_OFFSET; - else if (tp->Strings[i] == CANCELLED_STRING) - offsets[i] = CANCELLED_OFFSET; - else - offsets[i] = tp->Strings[i] - stringbuf; - } + int offsets[MAX_ENTRY_SIZE / 2], useoffsets[MAX_USES]; + int i, n; + TERMTYPE *tp = &(ep->tterm); + + n = tp->term_names - stringbuf; + for_each_string(i, &(ep->tterm)) { + if (tp->Strings[i] == ABSENT_STRING) + offsets[i] = ABSENT_OFFSET; + else if (tp->Strings[i] == CANCELLED_STRING) + offsets[i] = CANCELLED_OFFSET; + else + offsets[i] = tp->Strings[i] - stringbuf; + } - for (i=0; i < ep->nuses; i++) { - if (ep->uses[i].parent == (void *)0) - useoffsets[i] = ABSENT_OFFSET; - else - useoffsets[i] = (char *)(ep->uses[i].parent) - stringbuf; - } + for (i = 0; i < ep->nuses; i++) { + if (ep->uses[i].name == 0) + useoffsets[i] = ABSENT_OFFSET; + else + useoffsets[i] = ep->uses[i].name - stringbuf; + } - if ((tp->str_table = typeMalloc(char, next_free)) == (char *)0) - _nc_err_abort("Out of memory"); - (void) memcpy(tp->str_table, stringbuf, next_free); - - tp->term_names = tp->str_table + n; - for_each_string(i, &(ep->tterm)) { - if (offsets[i] == ABSENT_OFFSET) - tp->Strings[i] = ABSENT_STRING; - else if (offsets[i] == CANCELLED_OFFSET) - tp->Strings[i] = CANCELLED_STRING; - else - tp->Strings[i] = tp->str_table + offsets[i]; - } + if ((tp->str_table = typeMalloc(char, next_free)) == (char *) 0) + _nc_err_abort("Out of memory"); + (void) memcpy(tp->str_table, stringbuf, next_free); + + tp->term_names = tp->str_table + n; + for_each_string(i, &(ep->tterm)) { + if (offsets[i] == ABSENT_OFFSET) + tp->Strings[i] = ABSENT_STRING; + else if (offsets[i] == CANCELLED_OFFSET) + tp->Strings[i] = CANCELLED_STRING; + else + tp->Strings[i] = tp->str_table + offsets[i]; + } #if NCURSES_XNAMES - if ((n = NUM_EXT_NAMES(tp)) != 0) { - unsigned length = 0; - for (i = 0; i < n; i++) { - length += strlen(tp->ext_Names[i]) + 1; - offsets[i] = tp->ext_Names[i] - stringbuf; - } - if ((tp->ext_str_table = typeMalloc(char, length)) == 0) - _nc_err_abort("Out of memory"); - for (i = 0, length = 0; i < n; i++) { - tp->ext_Names[i] = tp->ext_str_table + length; - strcpy(tp->ext_Names[i], stringbuf + offsets[i]); - length += strlen(tp->ext_Names[i]) + 1; - } + if ((n = NUM_EXT_NAMES(tp)) != 0) { + unsigned length = 0; + for (i = 0; i < n; i++) { + length += strlen(tp->ext_Names[i]) + 1; + offsets[i] = tp->ext_Names[i] - stringbuf; + } + if ((tp->ext_str_table = typeMalloc(char, length)) == 0) + _nc_err_abort("Out of memory"); + for (i = 0, length = 0; i < n; i++) { + tp->ext_Names[i] = tp->ext_str_table + length; + strcpy(tp->ext_Names[i], stringbuf + offsets[i]); + length += strlen(tp->ext_Names[i]) + 1; } + } #endif - for (i=0; i < ep->nuses; i++) { - if (useoffsets[i] == ABSENT_OFFSET) - ep->uses[i].parent = (void *)0; - else - ep->uses[i].parent = (char *)(tp->str_table + useoffsets[i]); - } + for (i = 0; i < ep->nuses; i++) { + if (useoffsets[i] == ABSENT_OFFSET) + ep->uses[i].name = 0; + else + ep->uses[i].name = (tp->str_table + useoffsets[i]); + } } -void _nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from) +void +_nc_merge_entry(TERMTYPE * const to, TERMTYPE * const from) /* merge capabilities from `from' entry into `to' entry */ { - int i; + int i; #if NCURSES_XNAMES _nc_align_termtype(to, from); #endif - for_each_boolean(i, from) - { - int mergebool = from->Booleans[i]; + for_each_boolean(i, from) { + int mergebool = from->Booleans[i]; if (mergebool == CANCELLED_BOOLEAN) to->Booleans[i] = FALSE; @@ -200,9 +202,8 @@ void _nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from) to->Booleans[i] = mergebool; } - for_each_number(i, from) - { - int mergenum = from->Numbers[i]; + for_each_number(i, from) { + int mergenum = from->Numbers[i]; if (mergenum == CANCELLED_NUMERIC) to->Numbers[i] = ABSENT_NUMERIC; @@ -215,9 +216,8 @@ void _nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from) * storage. This is OK right now, but will be a problem if we * we ever want to deallocate entries. */ - for_each_string(i, from) - { - char *mergestring = from->Strings[i]; + for_each_string(i, from) { + char *mergestring = from->Strings[i]; if (mergestring == CANCELLED_STRING) to->Strings[i] = ABSENT_STRING; diff --git a/lib/libcurses/tinfo/captoinfo.c b/lib/libcurses/tinfo/captoinfo.c index 44008a41c80..d0e487f779f 100644 --- a/lib/libcurses/tinfo/captoinfo.c +++ b/lib/libcurses/tinfo/captoinfo.c @@ -1,7 +1,7 @@ -/* $OpenBSD: captoinfo.c,v 1.5 1999/12/12 04:49:19 millert Exp $ */ +/* $OpenBSD: captoinfo.c,v 1.6 2000/03/13 23:53:40 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 * @@ -94,7 +94,7 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$From: captoinfo.c,v 1.33 1999/12/12 02:25:56 tom Exp $") +MODULE_ID("$From: captoinfo.c,v 1.35 2000/03/11 12:27:55 tom Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ @@ -645,6 +645,7 @@ _nc_infotocap( char ch1 = 0, ch2 = 0; char *bufptr = init_string(); int len; + bool syntax_error = FALSE; /* we may have to move some trailing mandatory padding up front */ padding = str + strlen(str) - 1; @@ -715,7 +716,7 @@ _nc_infotocap( if (saw_n++ == 0) { bufptr = save_string(bufptr, "%m"); } - } else { + } else { /* cm-style format element */ str++; switch (*str) { case '%': @@ -735,8 +736,11 @@ _nc_infotocap( bufptr = save_char(bufptr, '%'); while (isdigit(*str)) bufptr = save_char(bufptr, *str++); - if (*str != 'd') /* termcap doesn't have octal, hex */ - return 0; + if (strchr("doxX", *str)) { + if (*str != 'd') /* termcap doesn't have octal, hex */ + return 0; + str++; + } break; case 'd': @@ -774,8 +778,9 @@ _nc_infotocap( break; default: - return (0); - + bufptr = save_char(bufptr, *str); + syntax_error = TRUE; + break; } /* endswitch (*str) */ } /* endelse (*str == '%') */ @@ -784,7 +789,7 @@ _nc_infotocap( } /* endwhile (*str) */ - return (my_string); + return (syntax_error ? NULL : my_string); } #ifdef MAIN diff --git a/lib/libcurses/tinfo/comp_parse.c b/lib/libcurses/tinfo/comp_parse.c index 253febbafc2..e336f915316 100644 --- a/lib/libcurses/tinfo/comp_parse.c +++ b/lib/libcurses/tinfo/comp_parse.c @@ -1,7 +1,7 @@ -/* $OpenBSD: comp_parse.c,v 1.4 1999/11/28 17:49:53 millert Exp $ */ +/* $OpenBSD: comp_parse.c,v 1.5 2000/03/13 23:53:40 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 * @@ -33,8 +33,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * comp_parse.c -- parser driver loop and use handling. * @@ -56,10 +54,10 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: comp_parse.c,v 1.36 1999/10/31 00:56:12 tom Exp $") +MODULE_ID("$From: comp_parse.c,v 1.38 2000/03/12 00:14:46 tom Exp $") static void sanity_check(TERMTYPE *); -void (*_nc_check_termtype)(TERMTYPE *) = sanity_check; +void (*_nc_check_termtype) (TERMTYPE *) = sanity_check; /**************************************************************************** * @@ -84,29 +82,30 @@ void (*_nc_check_termtype)(TERMTYPE *) = sanity_check; ENTRY *_nc_head = 0, *_nc_tail = 0; -static void enqueue(ENTRY *ep) +static void +enqueue(ENTRY * ep) /* add an entry to the in-core list */ { - ENTRY *newp = _nc_copy_entry(ep); + ENTRY *newp = _nc_copy_entry(ep); - if (newp == NULL) - _nc_err_abort("Out of memory"); + if (newp == 0) + _nc_err_abort("Out of memory"); - newp->last = _nc_tail; - _nc_tail = newp; + newp->last = _nc_tail; + _nc_tail = newp; - newp->next = (ENTRY *)NULL; - if (newp->last) - newp->last->next = newp; + newp->next = 0; + if (newp->last) + newp->last->next = newp; } -void _nc_free_entries(ENTRY *headp) +void +_nc_free_entries(ENTRY * headp) /* free the allocated storage consumed by list entries */ { - ENTRY *ep, *next; + ENTRY *ep, *next; - for (ep = headp; ep; ep = next) - { + for (ep = headp; ep; ep = next) { /* * This conditional lets us disconnect storage from the list. * To do this, copy an entry out of the list, then null out @@ -118,20 +117,22 @@ void _nc_free_entries(ENTRY *headp) next = ep->next; free(ep); - if (ep == _nc_head) _nc_head = 0; - if (ep == _nc_tail) _nc_tail = 0; + if (ep == _nc_head) + _nc_head = 0; + if (ep == _nc_tail) + _nc_tail = 0; } } -bool _nc_entry_match(char *n1, char *n2) +bool +_nc_entry_match(char *n1, char *n2) /* do any of the aliases in a pair of terminal names match? */ { - char *pstart, *qstart, *pend, *qend; - char nc1[MAX_NAME_SIZE+1], nc2[MAX_NAME_SIZE+1]; - size_t n; + char *pstart, *qstart, *pend, *qend; + char nc1[MAX_NAME_SIZE + 1], nc2[MAX_NAME_SIZE + 1]; + size_t n; - if (strchr(n1, '|') == NULL) - { + if (strchr(n1, '|') == NULL) { if ((n = strlcpy(nc1, n1, sizeof(nc1))) > sizeof(nc1) - 2) n = sizeof(nc1) - 2; nc1[n++] = '|'; @@ -139,8 +140,7 @@ bool _nc_entry_match(char *n1, char *n2) n1 = nc1; } - if (strchr(n2, '|') == NULL) - { + if (strchr(n2, '|') == NULL) { if ((n = strlcpy(nc2, n2, sizeof(nc2))) > sizeof(nc2) - 2) n = sizeof(nc2) - 2; nc2[n++] = '|'; @@ -150,11 +150,11 @@ bool _nc_entry_match(char *n1, char *n2) for (pstart = n1; (pend = strchr(pstart, '|')); pstart = pend + 1) for (qstart = n2; (qend = strchr(qstart, '|')); qstart = qend + 1) - if ((pend-pstart == qend-qstart) - && memcmp(pstart, qstart, (size_t)(pend-pstart)) == 0) - return(TRUE); + if ((pend - pstart == qend - qstart) + && memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0) + return (TRUE); - return(FALSE); + return (FALSE); } /**************************************************************************** @@ -163,21 +163,22 @@ bool _nc_entry_match(char *n1, char *n2) * ****************************************************************************/ -void _nc_read_entry_source(FILE *fp, char *buf, - int literal, bool silent, - bool (*hook)(ENTRY *)) +void +_nc_read_entry_source(FILE * fp, char *buf, + int literal, bool silent, + bool(*hook) (ENTRY *)) /* slurp all entries in the given file into core */ { - ENTRY thisentry; - bool oldsuppress = _nc_suppress_warnings; - int immediate = 0; + ENTRY thisentry; + bool oldsuppress = _nc_suppress_warnings; + int immediate = 0; 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; ) - { + for (_nc_reset_input(fp, buf); _nc_parse_entry(&thisentry, literal, + silent) != ERR;) { if (!isalnum(thisentry.tterm.term_names[0])) _nc_err_abort("terminal names must start with letter or digit"); @@ -186,14 +187,13 @@ void _nc_read_entry_source(FILE *fp, char *buf, * use references to disk, so as to avoid chewing up a lot of * core when the resolution code could fetch entries off disk. */ - if (hook != NULLHOOK && (*hook)(&thisentry)) + if (hook != NULLHOOK && (*hook) (&thisentry)) immediate++; else enqueue(&thisentry); } - if (_nc_tail) - { + if (_nc_tail) { /* set up the head pointer */ for (_nc_head = _nc_tail; _nc_head->last; _nc_head = _nc_head->last) continue; @@ -209,12 +209,13 @@ void _nc_read_entry_source(FILE *fp, char *buf, _nc_suppress_warnings = oldsuppress; } -int _nc_resolve_uses(void) +int +_nc_resolve_uses(bool fullresolve) /* try to resolve all use capabilities */ { - ENTRY *qp, *rp, *lastread = NULL; - bool keepgoing; - int i, j, unresolved, total_unresolved, multiples; + ENTRY *qp, *rp, *lastread = 0; + bool keepgoing; + int i, j, unresolved, total_unresolved, multiples; DEBUG(2, ("RESOLUTION BEGINNING")); @@ -222,48 +223,41 @@ int _nc_resolve_uses(void) * Check for multiple occurrences of the same name. */ multiples = 0; - for_entry_list(qp) - { + for_entry_list(qp) { int matchcount = 0; for_entry_list(rp) if (qp > rp - && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) - { - matchcount++; - if (matchcount == 1) - { - (void) fprintf(stderr, "Name collision between %s", - _nc_first_name(qp->tterm.term_names)); - multiples++; - } - if (matchcount >= 1) - (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); + && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { + matchcount++; + if (matchcount == 1) { + (void) fprintf(stderr, "Name collision between %s", + _nc_first_name(qp->tterm.term_names)); + multiples++; } + if (matchcount >= 1) + (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); + } if (matchcount >= 1) (void) putc('\n', stderr); } if (multiples > 0) - return(FALSE); + return (FALSE); DEBUG(2, ("NO MULTIPLE NAME OCCURRENCES")); /* - * First resolution stage: replace names in use arrays with entry - * pointers. By doing this, we avoid having to do the same name - * match once for each time a use entry is itself unresolved. + * First resolution stage: compute link pointers corresponding to names. */ total_unresolved = 0; _nc_curr_col = -1; - for_entry_list(qp) - { + for_entry_list(qp) { unresolved = 0; - for (i = 0; i < qp->nuses; i++) - { - bool foundit; - char *child = _nc_first_name(qp->tterm.term_names); - char *lookfor = (char *)(qp->uses[i].parent); - long lookline = qp->uses[i].line; + for (i = 0; i < qp->nuses; i++) { + bool foundit; + char *child = _nc_first_name(qp->tterm.term_names); + char *lookfor = qp->uses[i].name; + long lookline = qp->uses[i].line; foundit = FALSE; @@ -272,146 +266,142 @@ int _nc_resolve_uses(void) /* first, try to resolve from in-core records */ for_entry_list(rp) if (rp != qp - && _nc_name_match(rp->tterm.term_names, lookfor, "|")) - { - DEBUG(2, ("%s: resolving use=%s (in core)", - child, lookfor)); + && _nc_name_match(rp->tterm.term_names, lookfor, "|")) { + DEBUG(2, ("%s: resolving use=%s (in core)", + child, lookfor)); - qp->uses[i].parent = rp; - foundit = TRUE; - } + qp->uses[i].link = rp; + foundit = TRUE; + } /* if that didn't work, try to merge in a compiled entry */ - if (!foundit) - { - TERMTYPE thisterm; - char filename[PATH_MAX]; + if (!foundit) { + TERMTYPE thisterm; + char filename[PATH_MAX]; memset(&thisterm, 0, sizeof(thisterm)); - if (_nc_read_entry(lookfor, filename, &thisterm) == 1) - { + if (_nc_read_entry(lookfor, filename, &thisterm) == 1) { DEBUG(2, ("%s: resolving use=%s (compiled)", - child, lookfor)); + child, lookfor)); - rp = typeMalloc(ENTRY,1); - if (rp == NULL) + rp = typeMalloc(ENTRY, 1); + if (rp == 0) _nc_err_abort("Out of memory"); rp->tterm = thisterm; rp->nuses = 0; rp->next = lastread; lastread = rp; - qp->uses[i].parent = rp; + qp->uses[i].link = rp; foundit = TRUE; } } /* no good, mark this one unresolvable and complain */ - if (!foundit) - { + if (!foundit) { unresolved++; total_unresolved++; _nc_curr_line = lookline; _nc_warning("resolution of use=%s failed", lookfor); - qp->uses[i].parent = (ENTRY *)NULL; + qp->uses[i].link = 0; } } } - if (total_unresolved) - { + if (total_unresolved) { /* free entries read in off disk */ _nc_free_entries(lastread); - return(FALSE); + return (FALSE); } DEBUG(2, ("NAME RESOLUTION COMPLETED OK")); /* - * OK, at this point all (char *) references have been successfully - * replaced by (ENTRY *) pointers. Time to do the actual merges. + * OK, at this point all (char *) references in `name' mwmbers + * have been successfully converred to (ENTRY *) pointers in + * `link' members. Time to do the actual merges. */ - do { - TERMTYPE merged; - - keepgoing = FALSE; - - for_entry_list(qp) - { - if (qp->nuses > 0) - { - DEBUG(2, ("%s: attempting merge", _nc_first_name(qp->tterm.term_names))); - /* - * If any of the use entries we're looking for is - * incomplete, punt. We'll catch this entry on a - * subsequent pass. - */ - for (i = 0; i < qp->nuses; i++) - if (((ENTRY *)qp->uses[i].parent)->nuses) - { - DEBUG(2, ("%s: use entry %d unresolved", - _nc_first_name(qp->tterm.term_names), i)); - goto incomplete; - } - - /* - * First, make sure there's no garbage in the merge block. - * as a side effect, copy into the merged entry the name - * field and string table pointer. - */ - _nc_copy_termtype(&merged, &(qp->tterm)); - - /* - * Now merge in each use entry in the proper - * (reverse) order. - */ - for (; qp->nuses; qp->nuses--) - _nc_merge_entry(&merged, - &((ENTRY *)qp->uses[qp->nuses-1].parent)->tterm); - - /* - * Now merge in the original entry. - */ - _nc_merge_entry(&merged, &qp->tterm); - - /* - * Replace the original entry with the merged one. - */ - FreeIfNeeded(qp->tterm.Booleans); - FreeIfNeeded(qp->tterm.Numbers); - FreeIfNeeded(qp->tterm.Strings); - qp->tterm = merged; - - /* - * We know every entry is resolvable because name resolution - * didn't bomb. So go back for another pass. - */ - /* FALLTHRU */ - incomplete: - keepgoing = TRUE; + if (fullresolve) { + do { + TERMTYPE merged; + + keepgoing = FALSE; + + for_entry_list(qp) { + if (qp->nuses > 0) { + DEBUG(2, ("%s: attempting merge", + _nc_first_name(qp->tterm.term_names))); + /* + * If any of the use entries we're looking for is + * incomplete, punt. We'll catch this entry on a + * subsequent pass. + */ + for (i = 0; i < qp->nuses; i++) + if (qp->uses[i].link->nuses) { + DEBUG(2, ("%s: use entry %d unresolved", + _nc_first_name(qp->tterm.term_names), i)); + goto incomplete; + } + + /* + * First, make sure there's no garbage in the + * merge block. as a side effect, copy into + * the merged entry the name field and string + * table pointer. + */ + _nc_copy_termtype(&merged, &(qp->tterm)); + + /* + * Now merge in each use entry in the proper + * (reverse) order. + */ + for (; qp->nuses; qp->nuses--) + _nc_merge_entry(&merged, + &qp->uses[qp->nuses - 1].link->tterm); + + /* + * Now merge in the original entry. + */ + _nc_merge_entry(&merged, &qp->tterm); + + /* + * Replace the original entry with the merged one. + */ + FreeIfNeeded(qp->tterm.Booleans); + FreeIfNeeded(qp->tterm.Numbers); + FreeIfNeeded(qp->tterm.Strings); + qp->tterm = merged; + + /* + * We know every entry is resolvable because name resolution + * didn't bomb. So go back for another pass. + */ + /* FALLTHRU */ + incomplete: + keepgoing = TRUE; + } } - } - } while - (keepgoing); + } while + (keepgoing); - DEBUG(2, ("MERGES COMPLETED OK")); + DEBUG(2, ("MERGES COMPLETED OK")); - /* - * The exit condition of the loop above is such that all entries - * must now be resolved. Now handle cancellations. In a resolved - * entry there should be no cancellation markers. - */ - for_entry_list(qp) - { - for_each_boolean(j, &(qp->tterm)) - if (qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) - qp->tterm.Booleans[j] = FALSE; - for_each_number(j, &(qp->tterm)) - if (qp->tterm.Numbers[j] == CANCELLED_NUMERIC) + /* + * The exit condition of the loop above is such that all entries + * must now be resolved. Now handle cancellations. In a resolved + * entry there should be no cancellation markers. + */ + for_entry_list(qp) { + for_each_boolean(j, &(qp->tterm)) + if (qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) + qp->tterm.Booleans[j] = ABSENT_BOOLEAN; + for_each_number(j, &(qp->tterm)) + if (qp->tterm.Numbers[j] == CANCELLED_NUMERIC) qp->tterm.Numbers[j] = ABSENT_NUMERIC; - for_each_string(j, &(qp->tterm)) - if (qp->tterm.Strings[j] == CANCELLED_STRING) + for_each_string(j, &(qp->tterm)) + if (qp->tterm.Strings[j] == CANCELLED_STRING) qp->tterm.Strings[j] = ABSENT_STRING; + } } /* @@ -423,19 +413,18 @@ int _nc_resolve_uses(void) DEBUG(2, ("RESOLUTION FINISHED")); - if (_nc_check_termtype != 0) - { - _nc_curr_col = -1; - for_entry_list(qp) - { - _nc_curr_line = qp->startline; - _nc_set_type(_nc_first_name(qp->tterm.term_names)); - _nc_check_termtype(&qp->tterm); + if (fullresolve) + if (_nc_check_termtype != 0) { + _nc_curr_col = -1; + for_entry_list(qp) { + _nc_curr_line = qp->startline; + _nc_set_type(_nc_first_name(qp->tterm.term_names)); + _nc_check_termtype(&qp->tterm); + } + DEBUG(2, ("SANITY CHECK FINISHED")); } - DEBUG(2, ("SANITY CHECK FINISHED")); - } - return(TRUE); + return (TRUE); } /* @@ -447,14 +436,14 @@ int _nc_resolve_uses(void) #undef CUR #define CUR tp-> -static void sanity_check(TERMTYPE *tp) +static void +sanity_check(TERMTYPE * tp) { - if (!PRESENT(exit_attribute_mode)) - { -#ifdef __UNUSED__ /* this casts too wide a net */ - bool terminal_entry = !strchr(tp->term_names, '+'); + if (!PRESENT(exit_attribute_mode)) { +#ifdef __UNUSED__ /* this casts too wide a net */ + bool terminal_entry = !strchr(tp->term_names, '+'); if (terminal_entry && - (PRESENT(set_attributes) + (PRESENT(set_attributes) || PRESENT(enter_standout_mode) || PRESENT(enter_underline_mode) || PRESENT(enter_blink_mode) @@ -465,31 +454,31 @@ static void sanity_check(TERMTYPE *tp) || PRESENT(enter_reverse_mode))) _nc_warning("no exit_attribute_mode"); #endif /* __UNUSED__ */ - PAIRED(enter_standout_mode, exit_standout_mode) - PAIRED(enter_underline_mode, exit_underline_mode) + PAIRED(enter_standout_mode, exit_standout_mode) + PAIRED(enter_underline_mode, exit_underline_mode) } - /* listed in structure-member order of first argument */ - PAIRED(enter_alt_charset_mode, exit_alt_charset_mode) - ANDMISSING(enter_alt_charset_mode, acs_chars) - ANDMISSING(exit_alt_charset_mode, acs_chars) - ANDMISSING(enter_blink_mode, exit_attribute_mode) - ANDMISSING(enter_bold_mode, exit_attribute_mode) - PAIRED(exit_ca_mode, enter_ca_mode) - PAIRED(enter_delete_mode, exit_delete_mode) - ANDMISSING(enter_dim_mode, exit_attribute_mode) - PAIRED(enter_insert_mode, exit_insert_mode) - ANDMISSING(enter_secure_mode, exit_attribute_mode) - ANDMISSING(enter_protected_mode, exit_attribute_mode) - ANDMISSING(enter_reverse_mode, exit_attribute_mode) - PAIRED(from_status_line, to_status_line) - PAIRED(meta_off, meta_on) - - PAIRED(prtr_on, prtr_off) - PAIRED(save_cursor, restore_cursor) - PAIRED(enter_xon_mode, exit_xon_mode) - PAIRED(enter_am_mode, exit_am_mode) - ANDMISSING(label_off, label_on) - PAIRED(display_clock, remove_clock) - ANDMISSING(set_color_pair, initialize_pair) + /* listed in structure-member order of first argument */ + PAIRED(enter_alt_charset_mode, exit_alt_charset_mode) + ANDMISSING(enter_alt_charset_mode, acs_chars) + ANDMISSING(exit_alt_charset_mode, acs_chars) + ANDMISSING(enter_blink_mode, exit_attribute_mode) + ANDMISSING(enter_bold_mode, exit_attribute_mode) + PAIRED(exit_ca_mode, enter_ca_mode) + PAIRED(enter_delete_mode, exit_delete_mode) + ANDMISSING(enter_dim_mode, exit_attribute_mode) + PAIRED(enter_insert_mode, exit_insert_mode) + ANDMISSING(enter_secure_mode, exit_attribute_mode) + ANDMISSING(enter_protected_mode, exit_attribute_mode) + ANDMISSING(enter_reverse_mode, exit_attribute_mode) + PAIRED(from_status_line, to_status_line) + PAIRED(meta_off, meta_on) + + PAIRED(prtr_on, prtr_off) + PAIRED(save_cursor, restore_cursor) + PAIRED(enter_xon_mode, exit_xon_mode) + PAIRED(enter_am_mode, exit_am_mode) + ANDMISSING(label_off, label_on) + PAIRED(display_clock, remove_clock) + ANDMISSING(set_color_pair, initialize_pair) } diff --git a/lib/libcurses/tinfo/init_keytry.c b/lib/libcurses/tinfo/init_keytry.c index e19d49dbe43..d4c96517309 100644 --- a/lib/libcurses/tinfo/init_keytry.c +++ b/lib/libcurses/tinfo/init_keytry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_keytry.c,v 1.3 1999/11/28 18:05:38 millert Exp $ */ +/* $OpenBSD: init_keytry.c,v 1.4 2000/03/13 23:53:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1999 Free Software Foundation, Inc. * @@ -34,7 +34,7 @@ /* cursor_visible,cursor_normal,cursor_invisible */ #include <tic.h> /* struct tinfo_fkeys */ -MODULE_ID("$From: init_keytry.c,v 1.2 1999/09/11 17:32:57 Jeffrey.Honig Exp $") +MODULE_ID("$From: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $") /* ** _nc_init_keytry() diff --git a/lib/libcurses/tinfo/lib_options.c b/lib/libcurses/tinfo/lib_options.c index 8641792431a..7a16334c5a2 100644 --- a/lib/libcurses/tinfo/lib_options.c +++ b/lib/libcurses/tinfo/lib_options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_options.c,v 1.6 2000/03/10 01:35:04 millert Exp $ */ +/* $OpenBSD: lib_options.c,v 1.7 2000/03/13 23:53:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -44,7 +44,7 @@ #include <term.h> -MODULE_ID("$From: lib_options.c,v 1.38 2000/02/13 01:01:26 tom Exp $") +MODULE_ID("$From: lib_options.c,v 1.39 2000/03/12 00:19:11 tom Exp $") int idlok(WINDOW *win, bool flag) @@ -52,7 +52,7 @@ idlok(WINDOW *win, bool flag) T((T_CALLED("idlok(%p,%d)"), win, flag)); if (win) { - _nc_idlok = win->_idlok = flag && (has_il() || change_scroll_region); + _nc_idlok = win->_idlok = (flag && (has_il() || change_scroll_region)); returnCode(OK); } else returnCode(ERR); @@ -64,7 +64,7 @@ idcok(WINDOW *win, bool flag) T((T_CALLED("idcok(%p,%d)"), win, flag)); if (win) - _nc_idcok = win->_idcok = flag && has_ic(); + _nc_idcok = win->_idcok = (flag && has_ic()); returnVoid; } diff --git a/lib/libcurses/tinfo/make_keys.c b/lib/libcurses/tinfo/make_keys.c index d85eef5e41a..1f36655815a 100644 --- a/lib/libcurses/tinfo/make_keys.c +++ b/lib/libcurses/tinfo/make_keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: make_keys.c,v 1.5 1999/11/28 18:05:38 millert Exp $ */ +/* $OpenBSD: make_keys.c,v 1.6 2000/03/13 23:53:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998 Free Software Foundation, Inc. * @@ -39,7 +39,7 @@ */ #include <curses.priv.h> -MODULE_ID("$From: make_keys.c,v 1.7 1999/09/11 17:32:57 Jeffrey.Honig Exp $") +MODULE_ID("$From: make_keys.c,v 1.8 2000/03/12 02:55:50 Todd.C.Miller Exp $") #include <names.c> diff --git a/lib/libcurses/tinfo/parse_entry.c b/lib/libcurses/tinfo/parse_entry.c index 2293a69d821..3f03844dc48 100644 --- a/lib/libcurses/tinfo/parse_entry.c +++ b/lib/libcurses/tinfo/parse_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse_entry.c,v 1.5 2000/03/10 01:35:04 millert Exp $ */ +/* $OpenBSD: parse_entry.c,v 1.6 2000/03/13 23:53:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -49,7 +49,7 @@ #define __INTERNAL_CAPS_VISIBLE #include <term_entry.h> -MODULE_ID("$From: parse_entry.c,v 1.42 2000/02/13 01:01:26 tom Exp $") +MODULE_ID("$From: parse_entry.c,v 1.43 2000/03/12 00:09:06 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -257,7 +257,7 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent) token_type = _nc_get_token()) { if (strcmp(_nc_curr_token.tk_name, "use") == 0 || strcmp(_nc_curr_token.tk_name, "tc") == 0) { - entryp->uses[entryp->nuses].parent = (void *) _nc_save_str(_nc_curr_token.tk_valstring); + entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); entryp->uses[entryp->nuses].line = _nc_curr_line; entryp->nuses++; } else { @@ -458,7 +458,7 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent) * have picked up defaults via translation. */ for (i = 0; i < entryp->nuses; i++) - if (!strchr((char *) entryp->uses[i].parent, '+')) + if (!strchr((char *) entryp->uses[i].name, '+')) has_base_entry = TRUE; postprocess_termcap(&entryp->tterm, has_base_entry); diff --git a/lib/libcurses/tinfo/read_entry.c b/lib/libcurses/tinfo/read_entry.c index d5de19e42b6..f4d07feaf50 100644 --- a/lib/libcurses/tinfo/read_entry.c +++ b/lib/libcurses/tinfo/read_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read_entry.c,v 1.8 2000/03/10 01:35:04 millert Exp $ */ +/* $OpenBSD: read_entry.c,v 1.9 2000/03/13 23:53:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,7 +43,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$From: read_entry.c,v 1.66 2000/02/13 01:01:26 tom Exp $") +MODULE_ID("$From: read_entry.c,v 1.67 2000/03/11 12:35:45 tom Exp $") #if !HAVE_TELL #define tell(fd) 0 /* lseek() is POSIX, but not tell() - odd... */ @@ -359,7 +359,9 @@ read_termtype(int fd, TERMTYPE * ptr) { T(("...done reading terminfo bool %d num %d str %d", bool_count, num_count, str_count)); +#if NCURSES_XNAMES TR(TRACE_DATABASE, ("normal: num_Booleans:%d", ptr->num_Booleans)); +#endif } for (i = bool_count; i < BOOLCOUNT; i++) diff --git a/lib/libcurses/tinfo/read_termcap.c b/lib/libcurses/tinfo/read_termcap.c index 07dd5af175e..d127ef7a0fa 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.5 2000/03/10 01:35:04 millert Exp $ */ +/* $OpenBSD: read_termcap.c,v 1.6 2000/03/13 23:53:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -1044,7 +1044,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) return (ERR); /* resolve all use references */ - _nc_resolve_uses(); + _nc_resolve_uses(TRUE); /* find a terminal matching tn, if we can */ #if USE_GETCAP_CACHE diff --git a/lib/libcurses/tinfo/write_entry.c b/lib/libcurses/tinfo/write_entry.c index f73548f95bd..fb9599ddb43 100644 --- a/lib/libcurses/tinfo/write_entry.c +++ b/lib/libcurses/tinfo/write_entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: write_entry.c,v 1.7 2000/03/10 01:35:04 millert Exp $ */ +/* $OpenBSD: write_entry.c,v 1.8 2000/03/13 23:53:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -54,7 +54,7 @@ #define TRACE_OUT(p) /*nothing */ #endif -MODULE_ID("$From: write_entry.c,v 1.51 2000/02/13 01:01:26 tom Exp $") +MODULE_ID("$From: write_entry.c,v 1.52 2000/03/11 12:23:42 tom Exp $") static int total_written; @@ -427,7 +427,7 @@ write_object(FILE * fp, TERMTYPE * tp) boolmax = 0; for (i = 0; i < last_bool; i++) { - if (tp->Booleans[i]) + if (tp->Booleans[i] == TRUE) boolmax = i + 1; } @@ -456,8 +456,15 @@ write_object(FILE * fp, TERMTYPE * tp) /* write out the header */ TRACE_OUT(("Header of %s @%ld", namelist, ftell(fp))); if (fwrite(buf, 12, 1, fp) != 1 - || fwrite(namelist, sizeof(char), namelen, fp) != namelen - || fwrite(tp->Booleans, sizeof(char), boolmax, fp) != boolmax) + || fwrite(namelist, sizeof(char), namelen, fp) != namelen) + return (ERR); + + for (i = 0; i < boolmax; i++) + if (tp->Booleans[i] == TRUE) + buf[i] = TRUE; + else + buf[i] = FALSE; + if (fwrite(buf, sizeof(char), boolmax, fp) != boolmax) return (ERR); if (even_boundary(namelen + boolmax)) |