From: Thomas E. Dickey Date: Sun, 9 Apr 2017 01:34:02 +0000 (+0000) Subject: ncurses 6.0 - patch 20170408 X-Git-Tag: v6.1~42 X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=a924c24b2535cccdc0f5f991cd8ddcadcfa1f0d2 ncurses 6.0 - patch 20170408 + change logic in wins_nwstr() to avoid addressing data past the output of mbstowcs(). + correct a call to setcchar() in Data_Entry_w() from 20131207 changes. + fix minor memory-leaks in test-programs. + further improve ifdef in term_entry.h for internal definitions not used by tack. --- diff --git a/MANIFEST b/MANIFEST index bcc0bcf1..a2511d16 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1104,6 +1104,7 @@ ./test/echochar.c ./test/edit_field.c ./test/edit_field.h +./test/extended_color.c ./test/filter.c ./test/firework.c ./test/firstlast.c @@ -1162,6 +1163,7 @@ ./test/redraw.c ./test/savescreen.c ./test/savescreen.sh +./test/sp_tinfo.c ./test/tclock.c ./test/test.priv.h ./test/test_add_wchstr.c diff --git a/NEWS b/NEWS index 769aea14..acd62994 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.2794 2017/04/01 20:42:24 tom Exp $ +-- $Id: NEWS,v 1.2799 2017/04/08 22:54:04 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,14 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20170408 + + change logic in wins_nwstr() to avoid addressing data past the output + of mbstowcs(). + + correct a call to setcchar() in Data_Entry_w() from 20131207 changes. + + fix minor memory-leaks in test-programs. + + further improve ifdef in term_entry.h for internal definitions not + used by tack. + 20170401 + minor fixes for vt100+4bsd, e.g., delay in sgr for consistency -TD + add smso for env230, to match sgr -TD diff --git a/VERSION b/VERSION index 5c501347..dd3f3e10 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:9 6.0 20170401 +5:0:9 6.0 20170408 diff --git a/dist.mk b/dist.mk index 9fb361b6..95d78c39 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1154 2017/03/26 13:39:03 tom Exp $ +# $Id: dist.mk,v 1.1155 2017/04/02 10:36:57 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 6 NCURSES_MINOR = 0 -NCURSES_PATCH = 20170401 +NCURSES_PATCH = 20170408 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/form/frm_driver.c b/form/frm_driver.c index 66031d69..45e323f7 100644 --- a/form/frm_driver.c +++ b/form/frm_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc. * + * Copyright (c) 1998-2016,2017 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,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_driver.c,v 1.120 2016/12/24 22:28:28 Leon.Winter Exp $") +MODULE_ID("$Id: frm_driver.c,v 1.121 2017/04/08 22:02:15 tom Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority @@ -4045,7 +4045,7 @@ Data_Entry_w(FORM *form, wchar_t c) cchar_t temp_ch; given[0] = c; - given[1] = 1; + given[1] = 0; setcchar(&temp_ch, given, 0, 0, (void *)0); if ((Field_Has_Option(field, O_BLANK)) && First_Position_In_Current_Field(form) && diff --git a/include/MKterm.h.awk.in b/include/MKterm.h.awk.in index a030c251..3146ee8d 100644 --- a/include/MKterm.h.awk.in +++ b/include/MKterm.h.awk.in @@ -1,355 +1,361 @@ # vile:awkmode -BEGIN { - print "/****************************************************************************" - print " * Copyright (c) 1998-2013,2017 Free Software Foundation, Inc. *" - print " * *" - print " * Permission is hereby granted, free of charge, to any person obtaining a *" - print " * copy of this software and associated documentation files (the *" - print " * \"Software\"), to deal in the Software without restriction, including *" - print " * without limitation the rights to use, copy, modify, merge, publish, *" - print " * distribute, distribute with modifications, sublicense, and/or sell *" - print " * copies of the Software, and to permit persons to whom the Software is *" - print " * furnished to do so, subject to the following conditions: *" - print " * *" - print " * The above copyright notice and this permission notice shall be included *" - print " * in all copies or substantial portions of the Software. *" - print " * *" - print " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS *" - print " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *" - print " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *" - print " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *" - print " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *" - print " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *" - print " * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *" - print " * *" - print " * Except as contained in this notice, the name(s) of the above copyright *" - print " * holders shall not be used in advertising or otherwise to promote the *" - print " * sale, use or other dealings in this Software without prior written *" - print " * authorization. *" - print " ****************************************************************************/" - print "" - print "/****************************************************************************/" - print "/* Author: Zeyd M. Ben-Halim 1992,1995 */" - print "/* and: Eric S. Raymond */" - print "/* and: Thomas E. Dickey 1995-on */" - print "/****************************************************************************/" - print "" - print "/* $Id: MKterm.h.awk.in,v 1.65 2017/03/18 20:05:53 tom Exp $ */" - print "" - print "/*" - print "** term.h -- Definition of struct term" - print "*/" - print "" - print "#ifndef NCURSES_TERM_H_incl" - print "#define NCURSES_TERM_H_incl 1" - print "" - print "#undef NCURSES_VERSION" - print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\"" - print "" - print "#include " - print "" - print "#ifdef __cplusplus" - print "extern \"C\" {" - print "#endif" - print "" - print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H" - print " * definition (based on the system for which this was configured)." - print " */" - print "" - print "#undef NCURSES_CONST" - print "#define NCURSES_CONST @NCURSES_CONST@" - print "" - print "#undef NCURSES_SBOOL" - print "#define NCURSES_SBOOL @NCURSES_SBOOL@" - print "" - print "#undef NCURSES_USE_DATABASE" - print "#define NCURSES_USE_DATABASE @NCURSES_USE_DATABASE@" - print "" - print "#undef NCURSES_USE_TERMCAP" - print "#define NCURSES_USE_TERMCAP @NCURSES_USE_TERMCAP@" - print "" - print "#undef NCURSES_XNAMES" - print "#define NCURSES_XNAMES @NCURSES_XNAMES@" - print "" - print "/* We will use these symbols to hide differences between" - print " * termios/termio/sgttyb interfaces." - print " */" - print "#undef TTY" - print "#undef SET_TTY" - print "#undef GET_TTY" - print "" - print "/* Assume POSIX termio if we have the header and function */" - print "/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */" - print "#if @HAVE_TERMIOS_H@ && @HAVE_TCGETATTR@" - print "" - print "#undef TERMIOS" - print "#define TERMIOS 1" - print "" - print "#include " - print "#define TTY struct termios" - print "" - print "#else /* !HAVE_TERMIOS_H */" - print "" - print "/* #if HAVE_TERMIO_H */" - print "#if @HAVE_TERMIO_H@" - print "" - print "#undef TERMIOS" - print "#define TERMIOS 1" - print "" - print "#include " - print "#define TTY struct termio" - print "" - print "#else /* !HAVE_TERMIO_H */" - print "" - print "#if __MINGW32__" - print "# include " - print "# define TTY struct termios" - print "#else" - print "#undef TERMIOS" - print "#include " - print "#include " - print "#define TTY struct sgttyb" - print "#endif /* MINGW32 */" - print "#endif /* HAVE_TERMIO_H */" - print "" - print "#endif /* HAVE_TERMIOS_H */" - print "" - print "#ifdef TERMIOS" - print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)" - print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)" - print "#else" - print "#define GET_TTY(fd, buf) gtty(fd, buf)" - print "#define SET_TTY(fd, buf) stty(fd, buf)" - print "#endif" - print "" - print "#define NAMESIZE 256" - print "" - print "/* The cast works because TERMTYPE is the first data in TERMINAL */" - print "#define CUR ((TERMTYPE *)(cur_term))->" - print "" - } +BEGIN { + lcurl = "{"; + rcurl = "}"; + print "/****************************************************************************" + print " * Copyright (c) 1998-2013,2017 Free Software Foundation, Inc. *" + print " * *" + print " * Permission is hereby granted, free of charge, to any person obtaining a *" + print " * copy of this software and associated documentation files (the *" + print " * \"Software\"), to deal in the Software without restriction, including *" + print " * without limitation the rights to use, copy, modify, merge, publish, *" + print " * distribute, distribute with modifications, sublicense, and/or sell *" + print " * copies of the Software, and to permit persons to whom the Software is *" + print " * furnished to do so, subject to the following conditions: *" + print " * *" + print " * The above copyright notice and this permission notice shall be included *" + print " * in all copies or substantial portions of the Software. *" + print " * *" + print " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS *" + print " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *" + print " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *" + print " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *" + print " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *" + print " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *" + print " * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *" + print " * *" + print " * Except as contained in this notice, the name(s) of the above copyright *" + print " * holders shall not be used in advertising or otherwise to promote the *" + print " * sale, use or other dealings in this Software without prior written *" + print " * authorization. *" + print " ****************************************************************************/" + print "" + print "/****************************************************************************/" + print "/* Author: Zeyd M. Ben-Halim 1992,1995 */" + print "/* and: Eric S. Raymond */" + print "/* and: Thomas E. Dickey 1995-on */" + print "/****************************************************************************/" + print "" + print "/* $Id: MKterm.h.awk.in,v 1.66 2017/04/03 08:16:54 tom Exp $ */" + print "" + print "/*" + print "** term.h -- Definition of struct term" + print "*/" + print "" + print "#ifndef NCURSES_TERM_H_incl" + print "#define NCURSES_TERM_H_incl 1" + print "" + print "#undef NCURSES_VERSION" + print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\"" + print "" + print "#include " + print "" + print "#ifdef __cplusplus" + printf "extern \"C\" %s\n", lcurl; + print "#endif" + print "" + print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H" + print " * definition (based on the system for which this was configured)." + print " */" + print "" + print "#undef NCURSES_CONST" + print "#define NCURSES_CONST @NCURSES_CONST@" + print "" + print "#undef NCURSES_SBOOL" + print "#define NCURSES_SBOOL @NCURSES_SBOOL@" + print "" + print "#undef NCURSES_USE_DATABASE" + print "#define NCURSES_USE_DATABASE @NCURSES_USE_DATABASE@" + print "" + print "#undef NCURSES_USE_TERMCAP" + print "#define NCURSES_USE_TERMCAP @NCURSES_USE_TERMCAP@" + print "" + print "#undef NCURSES_XNAMES" + print "#define NCURSES_XNAMES @NCURSES_XNAMES@" + print "" + print "/* We will use these symbols to hide differences between" + print " * termios/termio/sgttyb interfaces." + print " */" + print "#undef TTY" + print "#undef SET_TTY" + print "#undef GET_TTY" + print "" + print "/* Assume POSIX termio if we have the header and function */" + print "/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */" + print "#if @HAVE_TERMIOS_H@ && @HAVE_TCGETATTR@" + print "" + print "#undef TERMIOS" + print "#define TERMIOS 1" + print "" + print "#include " + print "#define TTY struct termios" + print "" + print "#else /* !HAVE_TERMIOS_H */" + print "" + print "/* #if HAVE_TERMIO_H */" + print "#if @HAVE_TERMIO_H@" + print "" + print "#undef TERMIOS" + print "#define TERMIOS 1" + print "" + print "#include " + print "#define TTY struct termio" + print "" + print "#else /* !HAVE_TERMIO_H */" + print "" + print "#if __MINGW32__" + print "# include " + print "# define TTY struct termios" + print "#else" + print "#undef TERMIOS" + print "#include " + print "#include " + print "#define TTY struct sgttyb" + print "#endif /* MINGW32 */" + print "#endif /* HAVE_TERMIO_H */" + print "" + print "#endif /* HAVE_TERMIOS_H */" + print "" + print "#ifdef TERMIOS" + print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)" + print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)" + print "#else" + print "#define GET_TTY(fd, buf) gtty(fd, buf)" + print "#define SET_TTY(fd, buf) stty(fd, buf)" + print "#endif" + print "" + print "#define NAMESIZE 256" + print "" + print "/* The cast works because TERMTYPE is the first data in TERMINAL */" + print "#define CUR ((TERMTYPE *)(cur_term))->" + print "" +} -$2 == "%%-STOP-HERE-%%" { - print "" - printf "#define BOOLWRITE %d\n", BoolCount - printf "#define NUMWRITE %d\n", NumberCount - printf "#define STRWRITE %d\n", StringCount - print "" - print "/* older synonyms for some capabilities */" - print "#define beehive_glitch no_esc_ctlc" - print "#define teleray_glitch dest_tabs_magic_smso" - print "#define micro_char_size micro_col_size" - print "" - print "#ifdef __INTERNAL_CAPS_VISIBLE" - } +$2 == "%%-STOP-HERE-%%" { + print "" + printf "#define BOOLWRITE %d\n", BoolCount + printf "#define NUMWRITE %d\n", NumberCount + printf "#define STRWRITE %d\n", StringCount + print "" + print "/* older synonyms for some capabilities */" + print "#define beehive_glitch no_esc_ctlc" + print "#define teleray_glitch dest_tabs_magic_smso" + print "#define micro_char_size micro_col_size" + print "" + print "#ifdef __INTERNAL_CAPS_VISIBLE" +} -/^#/ {next;} +/^#/ { + next; +} -$1 == "acs_chars" {acsindex = StringCount} +$1 == "acs_chars" { + acsindex = StringCount; +} -$3 == "bool" { - printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++ - } +$3 == "bool" { + printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++ +} -$3 == "num" { - printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++ - } +$3 == "num" { + printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++ +} -$3 == "str" { - printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++ - } +$3 == "str" { + printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++ +} -END { - print "#endif /* __INTERNAL_CAPS_VISIBLE */" - print "" - print "" - print "/*" - print " * Predefined terminfo array sizes" - print " */" - printf "#define BOOLCOUNT %d\n", BoolCount - printf "#define NUMCOUNT %d\n", NumberCount - printf "#define STRCOUNT %d\n", StringCount - print "" - print "/* used by code for comparing entries */" - print "#define acs_chars_index ", acsindex - print "" - print "typedef struct termtype { /* in-core form of terminfo data */" - print " char *term_names; /* str_table offset of term names */" - print " char *str_table; /* pointer to string table */" - print " NCURSES_SBOOL *Booleans; /* array of boolean values */" - print " short *Numbers; /* array of integer values */" - print " char **Strings; /* array of string offsets */" - print "" - print "#if NCURSES_XNAMES" - print " char *ext_str_table; /* pointer to extended string table */" - print " char **ext_Names; /* corresponding names */" - print "" - print " unsigned short num_Booleans;/* count total Booleans */" - print " unsigned short num_Numbers; /* count total Numbers */" - print " unsigned short num_Strings; /* count total Strings */" - print "" - print " unsigned short ext_Booleans;/* count extensions to Booleans */" - print " unsigned short ext_Numbers; /* count extensions to Numbers */" - print " unsigned short ext_Strings; /* count extensions to Strings */" - print "#endif /* NCURSES_XNAMES */" - print "" - print "} TERMTYPE;" - print "" - print "/*" - print " * The only reason these structures are visible is for read-only use." - print " * Programs which modify the data are not, never were, portable across" - print " * curses implementations." - print " */" - print "#ifdef NCURSES_INTERNALS" - print "typedef struct term { /* describe an actual terminal */" - print " TERMTYPE type; /* terminal type description */" - print " short Filedes; /* file description being written to */" - print " TTY Ottyb; /* original state of the terminal */" - print " TTY Nttyb; /* current state of the terminal */" - print " int _baudrate; /* used to compute padding */" - print " char * _termname; /* used for termname() */" - print "} TERMINAL;" - print "#else" - print "typedef struct term TERMINAL;" - print "#endif /* NCURSES_INTERNALS */" - print "" - print "" - print "#if @BROKEN_LINKER@ && !@cf_cv_enable_reentrant@" - print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" - print "#elif @cf_cv_enable_reentrant@" - print "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);" - print "#define cur_term NCURSES_PUBLIC_VAR(cur_term())" - print "#else" - print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" - print "#endif" - print "" - print "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@" - print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);" - print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);" - print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);" - print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);" - print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);" - print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);" - print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);" - print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);" - print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);" - print "" - print "#define boolnames NCURSES_PUBLIC_VAR(boolnames())" - print "#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())" - print "#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())" - print "#define numnames NCURSES_PUBLIC_VAR(numnames())" - print "#define numcodes NCURSES_PUBLIC_VAR(numcodes())" - print "#define numfnames NCURSES_PUBLIC_VAR(numfnames())" - print "#define strnames NCURSES_PUBLIC_VAR(strnames())" - print "#define strcodes NCURSES_PUBLIC_VAR(strcodes())" - print "#define strfnames NCURSES_PUBLIC_VAR(strfnames())" - print "" - print "#else" - print "" - print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];" - print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];" - print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];" - print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];" - print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];" - print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];" - print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];" - print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];" - print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];" - print "" - print "#endif" - print "" - print "/*" - print " * These entrypoints are used only by the ncurses utilities such as tic." - print " */" - print "#ifdef NCURSES_INTERNALS" - print "" - print "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);" - print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);" - print "extern NCURSES_EXPORT(void) _nc_init_termtype (TERMTYPE *const);" - print "extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);" - print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);" - print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);" - print "" - print "#endif /* NCURSES_INTERNALS */" - print "" - print "" - print "/*" - print " * These entrypoints are used by tack." - print " */" - print "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);" - print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);" - print "" - print "/* Normal entry points */" - print "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);" - print "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);" - print "" - print "/* miscellaneous entry points */" - print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);" - print "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);" - print "" - print "/* terminfo entry points, also declared in curses.h */" - print "#if !defined(__NCURSES_H)" - print "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);" - print "extern NCURSES_EXPORT_VAR(char) ttytype[];" - print "extern NCURSES_EXPORT(int) putp (const char *);" - print "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);" - print "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);" - print "" - print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */" - print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */" - print "#else" - print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */" - print "extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */" - print "#endif" - print "" - print "extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */" - print "" - print "#endif /* __NCURSES_H */" - print "" - print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */" - print "#if !defined(NCURSES_TERMCAP_H_incl)" - print "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);" - print "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);" - print "extern NCURSES_EXPORT(int) tgetent (char *, const char *);" - print "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);" - print "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);" - print "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));" - print "#endif /* NCURSES_TERMCAP_H_incl */" - print "" - print "/*" - print " * Include curses.h before term.h to enable these extensions." - print " */" - print "#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0)" - print "" - print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *);" - print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *);" - print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *);" - print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *);" - print "" - print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */" - print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...); /* special */" - print "#else" - print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */" - print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...); /* special */" - print "#endif" - print "" - print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */" - print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **);" - print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int);" - print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *);" - print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *);" - print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *);" - print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC);" - print "" - print "extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);" - print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);" - print "" - print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);" - print "#endif /* NCURSES_SP_FUNCS */" - print "" - print "#ifdef __cplusplus" - print "}" - print "#endif" - print "" - print "#endif /* NCURSES_TERM_H_incl */" - } +END { + print "#endif /* __INTERNAL_CAPS_VISIBLE */" + print "" + print "" + print "/*" + print " * Predefined terminfo array sizes" + print " */" + printf "#define BOOLCOUNT %d\n", BoolCount + printf "#define NUMCOUNT %d\n", NumberCount + printf "#define STRCOUNT %d\n", StringCount + print "" + print "/* used by code for comparing entries */" + print "#define acs_chars_index ", acsindex + print "" + print "typedef struct termtype { /* in-core form of terminfo data */" + print " char *term_names; /* str_table offset of term names */" + print " char *str_table; /* pointer to string table */" + print " NCURSES_SBOOL *Booleans; /* array of boolean values */" + print " short *Numbers; /* array of integer values */" + print " char **Strings; /* array of string offsets */" + print "" + print "#if NCURSES_XNAMES" + print " char *ext_str_table; /* pointer to extended string table */" + print " char **ext_Names; /* corresponding names */" + print "" + print " unsigned short num_Booleans;/* count total Booleans */" + print " unsigned short num_Numbers; /* count total Numbers */" + print " unsigned short num_Strings; /* count total Strings */" + print "" + print " unsigned short ext_Booleans;/* count extensions to Booleans */" + print " unsigned short ext_Numbers; /* count extensions to Numbers */" + print " unsigned short ext_Strings; /* count extensions to Strings */" + print "#endif /* NCURSES_XNAMES */" + print "" + print "} TERMTYPE;" + print "" + print "/*" + print " * The only reason these structures are visible is for read-only use." + print " * Programs which modify the data are not, never were, portable across" + print " * curses implementations." + print " */" + print "#ifdef NCURSES_INTERNALS" + print "typedef struct term { /* describe an actual terminal */" + print " TERMTYPE type; /* terminal type description */" + print " short Filedes; /* file description being written to */" + print " TTY Ottyb; /* original state of the terminal */" + print " TTY Nttyb; /* current state of the terminal */" + print " int _baudrate; /* used to compute padding */" + print " char * _termname; /* used for termname() */" + print "} TERMINAL;" + print "#else" + print "typedef struct term TERMINAL;" + print "#endif /* NCURSES_INTERNALS */" + print "" + print "" + print "#if @BROKEN_LINKER@ && !@cf_cv_enable_reentrant@" + print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" + print "#elif @cf_cv_enable_reentrant@" + print "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);" + print "#define cur_term NCURSES_PUBLIC_VAR(cur_term())" + print "#else" + print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" + print "#endif" + print "" + print "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@" + print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);" + print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);" + print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);" + print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);" + print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);" + print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);" + print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);" + print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);" + print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);" + print "" + print "#define boolnames NCURSES_PUBLIC_VAR(boolnames())" + print "#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())" + print "#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())" + print "#define numnames NCURSES_PUBLIC_VAR(numnames())" + print "#define numcodes NCURSES_PUBLIC_VAR(numcodes())" + print "#define numfnames NCURSES_PUBLIC_VAR(numfnames())" + print "#define strnames NCURSES_PUBLIC_VAR(strnames())" + print "#define strcodes NCURSES_PUBLIC_VAR(strcodes())" + print "#define strfnames NCURSES_PUBLIC_VAR(strfnames())" + print "" + print "#else" + print "" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];" + print "" + print "#endif" + print "" + print "/*" + print " * These entrypoints are used only by the ncurses utilities such as tic." + print " */" + print "#ifdef NCURSES_INTERNALS" + print "" + print "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);" + print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);" + print "extern NCURSES_EXPORT(void) _nc_init_termtype (TERMTYPE *const);" + print "extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);" + print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);" + print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);" + print "" + print "#endif /* NCURSES_INTERNALS */" + print "" + print "" + print "/*" + print " * These entrypoints are used by tack." + print " */" + print "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);" + print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);" + print "" + print "/* Normal entry points */" + print "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);" + print "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);" + print "" + print "/* miscellaneous entry points */" + print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);" + print "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);" + print "" + print "/* terminfo entry points, also declared in curses.h */" + print "#if !defined(__NCURSES_H)" + print "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);" + print "extern NCURSES_EXPORT_VAR(char) ttytype[];" + print "extern NCURSES_EXPORT(int) putp (const char *);" + print "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);" + print "" + print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */" + print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */" + print "#else" + print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */" + print "extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */" + print "#endif" + print "" + print "extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */" + print "" + print "#endif /* __NCURSES_H */" + print "" + print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */" + print "#if !defined(NCURSES_TERMCAP_H_incl)" + print "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);" + print "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);" + print "extern NCURSES_EXPORT(int) tgetent (char *, const char *);" + print "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));" + print "#endif /* NCURSES_TERMCAP_H_incl */" + print "" + print "/*" + print " * Include curses.h before term.h to enable these extensions." + print " */" + print "#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0)" + print "" + print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *);" + print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *);" + print "" + print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */" + print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...); /* special */" + print "#else" + print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */" + print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...); /* special */" + print "#endif" + print "" + print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */" + print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **);" + print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int);" + print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *);" + print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC);" + print "" + print "extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);" + print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);" + print "" + print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);" + print "#endif /* NCURSES_SP_FUNCS */" + print "" + print "#ifdef __cplusplus" + printf "%s\n", rcurl; + print "#endif" + print "" + print "#endif /* NCURSES_TERM_H_incl */" +} diff --git a/include/term_entry.h b/include/term_entry.h index b47d9158..c0222d05 100644 --- a/include/term_entry.h +++ b/include/term_entry.h @@ -32,7 +32,7 @@ * and: Thomas E. Dickey 1998-on * ****************************************************************************/ -/* $Id: term_entry.h,v 1.49 2017/03/18 18:52:12 tom Exp $ */ +/* $Id: term_entry.h,v 1.54 2017/04/03 21:36:00 tom Exp $ */ /* * term_entry.h -- interface to entry-manipulation code @@ -40,6 +40,7 @@ #ifndef NCURSES_TERM_ENTRY_H_incl #define NCURSES_TERM_ENTRY_H_incl 1 +/* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -47,46 +48,9 @@ extern "C" { #include - /* - * see db_iterator.c - this enumeration lists the places searched for a - * terminal description and defines the order in which they are searched. - */ - typedef enum { - dbdTIC = 0, /* special, used by tic when writing entry */ -#if NCURSES_USE_DATABASE - dbdEnvOnce, /* the $TERMINFO environment variable */ - dbdHome, /* $HOME/.terminfo */ - dbdEnvList, /* the $TERMINFO_DIRS environment variable */ - dbdCfgList, /* the compiled-in TERMINFO_DIRS value */ - dbdCfgOnce, /* the compiled-in TERMINFO value */ -#endif -#if NCURSES_USE_TERMCAP - dbdEnvOnce2, /* the $TERMCAP environment variable */ - dbdEnvList2, /* the $TERMPATH environment variable */ - dbdCfgList2, /* the compiled-in TERMPATH */ -#endif - dbdLAST - } DBDIRS; - -#define MAX_USES 32 -#define MAX_CROSSLINKS 16 - - typedef struct entry { - TERMTYPE tterm; - unsigned nuses; - struct { - 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; - struct entry *last; - } ENTRY; -/* *INDENT-OFF* */ +/* + * These macros may be used by programs that know about TERMTYPE: + */ #if NCURSES_XNAMES #define NUM_BOOLEANS(tp) (tp)->num_Booleans #define NUM_NUMBERS(tp) (tp)->num_Numbers @@ -115,6 +79,58 @@ extern "C" { #define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names) #define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names) +/* + * The remaining type-definitions and macros are used only internally by the + * ncurses utilities. + */ +#ifdef NCURSES_INTERNALS + +/* + * see db_iterator.c - this enumeration lists the places searched for a + * terminal description and defines the order in which they are searched. + */ +typedef enum { + dbdTIC = 0, /* special, used by tic when writing entry */ +#if NCURSES_USE_DATABASE + dbdEnvOnce, /* the $TERMINFO environment variable */ + dbdHome, /* $HOME/.terminfo */ + dbdEnvList, /* the $TERMINFO_DIRS environment variable */ + dbdCfgList, /* the compiled-in TERMINFO_DIRS value */ + dbdCfgOnce, /* the compiled-in TERMINFO value */ +#endif +#if NCURSES_USE_TERMCAP + dbdEnvOnce2, /* the $TERMCAP environment variable */ + dbdEnvList2, /* the $TERMPATH environment variable */ + dbdCfgList2, /* the compiled-in TERMPATH */ +#endif + dbdLAST +} DBDIRS; + +#define MAX_USES 32 +#define MAX_CROSSLINKS 16 + +typedef struct entry ENTRY; + +typedef struct { + char *name; + ENTRY *link; + long line; +} ENTRY_USES; + +struct entry { + TERMTYPE tterm; + int *XNumbers; /* array of integer values */ + unsigned nuses; + ENTRY_USES uses[MAX_USES]; + int ncrosslinks; + ENTRY *crosslinks[MAX_CROSSLINKS]; + long cstart; + long cend; + long startline; + ENTRY *next; + ENTRY *last; +}; + extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head; extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail; #define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) @@ -131,7 +147,10 @@ extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail; #define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING)) #define ANDMISSING(p,q) \ - {if (PRESENT(p) && !PRESENT(q)) _nc_warning(#p " but no " #q);} + { \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } #define PAIRED(p,q) \ { \ @@ -144,7 +163,6 @@ extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail; /* * These entrypoints are used only by the ncurses utilities such as tic. */ -#ifdef NCURSES_INTERNALS /* alloc_entry.c: elementary allocation code */ extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp); @@ -199,9 +217,10 @@ extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional ' /* free_ttype.c: elementary allocation code */ extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *); -/* *INDENT-ON* */ - #ifdef __cplusplus } #endif -#endif /* NCURSES_TERM_ENTRY_H_incl */ + +/* *INDENT-ON* */ + +#endif /* NCURSES_TERM_ENTRY_H_incl */ diff --git a/ncurses/base/lib_newterm.c b/ncurses/base/lib_newterm.c index deed47fa..24426f6b 100644 --- a/ncurses/base/lib_newterm.c +++ b/ncurses/base/lib_newterm.c @@ -48,7 +48,7 @@ #include -MODULE_ID("$Id: lib_newterm.c,v 1.95 2017/04/01 12:53:35 tom Exp $") +MODULE_ID("$Id: lib_newterm.c,v 1.96 2017/04/02 14:26:18 tom Exp $") #ifdef USE_TERM_DRIVER #define NumLabels InfoOf(SP_PARM).numlabels @@ -76,7 +76,7 @@ _nc_initscr(NCURSES_SP_DCL0) /* for extended XPG4 conformance requires cbreak() at this point */ /* (SVr4 curses does this anyway) */ - T((T_CALLED("_nc_initscr(%p) ->term %p"), (void *) SP_PARM, term)); + T((T_CALLED("_nc_initscr(%p) ->term %p"), (void *) SP_PARM, (void *) term)); if (NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG) == OK) { TTY buf; diff --git a/ncurses/base/lib_set_term.c b/ncurses/base/lib_set_term.c index 8d475b96..854270bc 100644 --- a/ncurses/base/lib_set_term.c +++ b/ncurses/base/lib_set_term.c @@ -47,7 +47,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_set_term.c,v 1.158 2017/04/01 13:51:59 tom Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.159 2017/04/02 14:26:18 tom Exp $") #ifdef USE_TERM_DRIVER #define MaxColors InfoOf(sp).maxcolors @@ -307,7 +307,7 @@ NCURSES_SP_NAME(_nc_setupscreen) ( if (!sp) { sp = _nc_alloc_screen_sp(); - T(("_nc_alloc_screen_sp %p", sp)); + T(("_nc_alloc_screen_sp %p", (void *) sp)); *spp = sp; } if (!sp diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c index c32887d4..2d182622 100644 --- a/ncurses/tinfo/lib_setup.c +++ b/ncurses/tinfo/lib_setup.c @@ -48,7 +48,7 @@ #include #endif -MODULE_ID("$Id: lib_setup.c,v 1.173 2017/04/01 13:48:38 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.174 2017/04/02 14:26:18 tom Exp $") /**************************************************************************** * @@ -825,7 +825,7 @@ new_prescr(void) T((T_CALLED("new_prescr()"))); sp = _nc_alloc_screen_sp(); - T(("_nc_alloc_screen_sp %p", sp)); + T(("_nc_alloc_screen_sp %p", (void *) sp)); if (sp != 0) { sp->rsp = sp->rippedoff; sp->_filtered = _nc_prescreen.filter_mode; diff --git a/ncurses/tinfo/lib_ttyflags.c b/ncurses/tinfo/lib_ttyflags.c index f4450d74..cf065cb6 100644 --- a/ncurses/tinfo/lib_ttyflags.c +++ b/ncurses/tinfo/lib_ttyflags.c @@ -41,7 +41,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_ttyflags.c,v 1.32 2017/04/01 11:48:03 tom Exp $") +MODULE_ID("$Id: lib_ttyflags.c,v 1.33 2017/04/02 14:30:26 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf) @@ -141,7 +141,8 @@ NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_DCL0) int rc = ERR; TERMINAL *termp = TerminalOf(SP_PARM); - T((T_CALLED("def_shell_mode(%p) ->term %p"), (void *) SP_PARM, termp)); + T((T_CALLED("def_shell_mode(%p) ->term %p"), + (void *) SP_PARM, (void *) termp)); if (termp != 0) { #ifdef USE_TERM_DRIVER @@ -179,7 +180,7 @@ NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_DCL0) int rc = ERR; TERMINAL *termp = TerminalOf(SP_PARM); - T((T_CALLED("def_prog_mode(%p) ->term %p"), (void *) SP_PARM, termp)); + T((T_CALLED("def_prog_mode(%p) ->term %p"), (void *) SP_PARM, (void *) termp)); if (termp != 0) { #ifdef USE_TERM_DRIVER @@ -215,7 +216,7 @@ NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_DCL0) int rc = ERR; TERMINAL *termp = TerminalOf(SP_PARM); - T((T_CALLED("reset_prog_mode(%p) ->term %p"), (void *) SP_PARM, termp)); + T((T_CALLED("reset_prog_mode(%p) ->term %p"), (void *) SP_PARM, (void *) termp)); if (termp != 0) { #ifdef USE_TERM_DRIVER @@ -247,7 +248,8 @@ NCURSES_SP_NAME(reset_shell_mode) (NCURSES_SP_DCL0) int rc = ERR; TERMINAL *termp = TerminalOf(SP_PARM); - T((T_CALLED("reset_shell_mode(%p) ->term %p"), (void *) SP_PARM, termp)); + T((T_CALLED("reset_shell_mode(%p) ->term %p"), + (void *) SP_PARM, (void *) termp)); if (termp != 0) { #ifdef USE_TERM_DRIVER diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c index 339c7c82..802b520f 100644 --- a/ncurses/tinfo/parse_entry.c +++ b/ncurses/tinfo/parse_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2016 Free Software Foundation, Inc. * + * Copyright (c) 1998-2016,2017 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 * @@ -47,7 +47,7 @@ #include #include -MODULE_ID("$Id: parse_entry.c,v 1.81 2016/05/28 23:22:52 tom Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.82 2017/04/03 09:00:45 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -206,7 +206,7 @@ _nc_extend_names(ENTRY * entryp, char *name, int token_type) #define MAX_NUMBER 0x7fff /* positive shorts only */ NCURSES_EXPORT(int) -_nc_parse_entry(struct entry *entryp, int literal, bool silent) +_nc_parse_entry(ENTRY *entryp, int literal, bool silent) { int token_type; struct name_table_entry const *entry_ptr; diff --git a/ncurses/widechar/lib_ins_wch.c b/ncurses/widechar/lib_ins_wch.c index 103dfdc4..57f142b7 100644 --- a/ncurses/widechar/lib_ins_wch.c +++ b/ncurses/widechar/lib_ins_wch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2011,2016 Free Software Foundation, Inc. * + * Copyright (c) 2002-2016,2017 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 * @@ -39,7 +39,7 @@ #include -MODULE_ID("$Id: lib_ins_wch.c,v 1.21 2016/05/28 22:32:11 tom Exp $") +MODULE_ID("$Id: lib_ins_wch.c,v 1.22 2017/04/08 22:52:26 tom Exp $") /* * Insert the given character, updating the current location to simplify @@ -119,7 +119,7 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n) NCURSES_SIZE_T oy = win->_cury; NCURSES_SIZE_T ox = win->_curx; - for (cp = wstr; *cp && ((cp - wstr) < n); cp++) { + for (cp = wstr; ((cp - wstr) < n) && *cp; cp++) { int len = wcwidth(*cp); if ((len >= 0 && len != 1) || !is7bits(*cp)) { diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index e4065743..b2710ff9 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.0+20170401) unstable; urgency=low +ncurses6 (6.0+20170408) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 26 Mar 2017 09:39:03 -0400 + -- Thomas E. Dickey Sun, 02 Apr 2017 06:36:57 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index e4065743..b2710ff9 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.0+20170401) unstable; urgency=low +ncurses6 (6.0+20170408) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 26 Mar 2017 09:39:03 -0400 + -- Thomas E. Dickey Sun, 02 Apr 2017 06:36:57 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index c8f7a3ce..29f1d05f 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.0+20170401) unstable; urgency=low +ncurses6 (6.0+20170408) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 26 Mar 2017 09:39:03 -0400 + -- Thomas E. Dickey Sun, 02 Apr 2017 06:36:57 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index e67e1449..c0bfb2c0 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.205 2017/03/26 13:39:03 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.206 2017/04/02 10:36:57 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "0" !define VERSION_YYYY "2017" -!define VERSION_MMDD "0401" +!define VERSION_MMDD "0408" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 0e802ba5..73a2bb40 100644 --- a/package/mingw-ncurses.spec +++ b/package/mingw-ncurses.spec @@ -3,7 +3,7 @@ Summary: shared libraries for terminal handling Name: mingw32-ncurses6 Version: 6.0 -Release: 20170401 +Release: 20170408 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index 3c038cd7..b6ca9aa9 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.0 -Release: 20170401 +Release: 20170408 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/test/bs.c b/test/bs.c index aeb92f30..cb9a333b 100644 --- a/test/bs.c +++ b/test/bs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2014,2016 Free Software Foundation, Inc. * + * Copyright (c) 1998-2016,2017 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 * @@ -34,7 +34,7 @@ * v2.0 featuring strict ANSI/POSIX conformance, November 1993. * v2.1 with ncurses mouse support, September 1995 * - * $Id: bs.c,v 1.64 2016/08/21 00:03:32 tom Exp $ + * $Id: bs.c,v 1.65 2017/04/08 21:06:16 tom Exp $ */ #include @@ -185,6 +185,7 @@ uninitgame(int sig GCC_UNUSED) (void) reset_shell_mode(); (void) echo(); (void) endwin(); + free(your_name); ExitProgram(sig ? EXIT_FAILURE : EXIT_SUCCESS); } @@ -224,7 +225,7 @@ intro(void) (your_name = strdup(tmpname)) != 0) { your_name[0] = (char) toupper(UChar(your_name[0])); } else { - your_name = dftname; + your_name = strdup(dftname); } (void) initscr(); diff --git a/test/demo_new_pair.c b/test/demo_new_pair.c index aef725a0..a0d069c0 100644 --- a/test/demo_new_pair.c +++ b/test/demo_new_pair.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_new_pair.c,v 1.10 2017/03/10 09:47:15 tom Exp $ + * $Id: demo_new_pair.c,v 1.11 2017/04/08 21:48:53 tom Exp $ * * Demonstrate the alloc_pair() function. */ @@ -36,6 +36,10 @@ #if HAVE_ALLOC_PAIR && USE_WIDEC_SUPPORT +#include +#include +#include + #define MAX_BITS 8 /* all but A_ALTCHARSET */ #define MAX_ATTR ((1< @@ -102,7 +102,7 @@ do_init_color(SCREEN *sp, int color, int adjust) static void do_color_set(const char *expected, int pair) { - int i = color_set(pair, NULL); + int i = color_set((short) pair, (void *) &pair); printw("%s (%s)\n", expected, SHOW(i)); if (i != OK) failed("color_set"); diff --git a/test/ins_wide.c b/test/ins_wide.c index a5d3ac76..1bff3a28 100644 --- a/test/ins_wide.c +++ b/test/ins_wide.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2014,2016 Free Software Foundation, Inc. * + * Copyright (c) 2002-2016,2017 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: ins_wide.c,v 1.22 2016/09/10 21:35:02 tom Exp $ + * $Id: ins_wide.c,v 1.23 2017/04/08 22:14:03 tom Exp $ * * Demonstrate the wins_wstr() and wins_wch functions. * Thomas Dickey - 2002/11/23 @@ -391,6 +391,8 @@ test_inserts(int level) } break; default: + if (length >= BUFSIZ - 2) + break; buffer[length++] = (wchar_t) ch; buffer[length] = '\0'; diff --git a/test/inserts.c b/test/inserts.c index c70fe1e3..9ba373f2 100644 --- a/test/inserts.c +++ b/test/inserts.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2012,2016 Free Software Foundation, Inc. * + * Copyright (c) 2002-2016,2017 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: inserts.c,v 1.28 2016/09/10 21:34:42 tom Exp $ + * $Id: inserts.c,v 1.29 2017/04/08 22:20:46 tom Exp $ * * Demonstrate the winsstr() and winsch functions. * Thomas Dickey - 2002/10/19 @@ -320,6 +320,8 @@ test_inserts(int level) beep(); break; } + if (length >= BUFSIZ - 2) + break; buffer[length++] = (char) ch; buffer[length] = '\0'; diff --git a/test/list_keys.c b/test/list_keys.c index 75946950..31c057a0 100644 --- a/test/list_keys.c +++ b/test/list_keys.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: list_keys.c,v 1.18 2017/03/18 22:03:07 tom Exp $ + * $Id: list_keys.c,v 1.19 2017/04/08 22:57:26 tom Exp $ * * Author: Thomas E Dickey * @@ -159,7 +159,7 @@ show_key(const char *name, bool show) } static bool -valid_key(const char *name, TERMINAL ** terms, int count) +valid_key(const char *name, TERMINAL **terms, int count) { bool result = FALSE; if (*name == 'k') { @@ -266,7 +266,7 @@ modified_key(const char *name) } static void -list_keys(TERMINAL ** terms, int count) +list_keys(TERMINAL **terms, int count) { int j, k; int widths0 = 0; @@ -486,6 +486,8 @@ main(int argc, char *argv[]) list_keys(terms, 1); } + free(terms); + ExitProgram(EXIT_SUCCESS); } diff --git a/test/movewindow.c b/test/movewindow.c index 9effda41..91c7266a 100644 --- a/test/movewindow.c +++ b/test/movewindow.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 2006-2013,2017 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: movewindow.c,v 1.39 2013/05/04 19:41:02 tom Exp $ + * $Id: movewindow.c,v 1.40 2017/04/08 23:01:47 tom Exp $ * * Demonstrate move functions for windows and derived windows from the curses * library. @@ -762,5 +762,8 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) wmove(current_win, 0, 0); } endwin(); +#if NO_LEAKS + free(all_windows); +#endif ExitProgram(EXIT_SUCCESS); } diff --git a/test/test_add_wchstr.c b/test/test_add_wchstr.c index 5f78aeb1..58ff87d5 100644 --- a/test/test_add_wchstr.c +++ b/test/test_add_wchstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2010-2014,2016 Free Software Foundation, Inc. * + * Copyright (c) 2009-2016,2017 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_add_wchstr.c,v 1.22 2016/09/10 21:28:40 tom Exp $ + * $Id: test_add_wchstr.c,v 1.23 2017/04/08 23:10:35 tom Exp $ * * Demonstrate the waddwchstr() and wadd_wch functions. * Thomas Dickey - 2009/9/12 @@ -585,6 +585,9 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) test_add_wchstr(0); endwin(); +#if NO_LEAKS + free(temp_buffer); +#endif ExitProgram(EXIT_SUCCESS); } #else diff --git a/test/test_addchstr.c b/test/test_addchstr.c index 9506fdfb..29bf9d5e 100644 --- a/test/test_addchstr.c +++ b/test/test_addchstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2009-2012,2016 Free Software Foundation, Inc. * + * Copyright (c) 2009-2016,2017 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_addchstr.c,v 1.19 2016/09/10 21:29:04 tom Exp $ + * $Id: test_addchstr.c,v 1.20 2017/04/08 23:11:55 tom Exp $ * * Demonstrate the waddchstr() and waddch functions. * Thomas Dickey - 2009/9/12 @@ -515,5 +515,8 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) test_adds(0); endwin(); +#if NO_LEAKS + free(temp_buffer); +#endif ExitProgram(EXIT_SUCCESS); } diff --git a/test/test_instr.c b/test/test_instr.c index 627db08e..e203cc65 100644 --- a/test/test_instr.c +++ b/test/test_instr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007,2010 Free Software Foundation, Inc. * + * Copyright (c) 2007-2010,2017 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_instr.c,v 1.5 2010/05/01 19:13:46 tom Exp $ + * $Id: test_instr.c,v 1.6 2017/04/08 23:21:53 tom Exp $ * * Author: Thomas E Dickey * @@ -85,6 +85,7 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) return FALSE; } + *buffer = '\0'; if (level > 1) { txtbox = newwin(LINES - BASE_Y, COLS - level, BASE_Y, level); box(txtbox, 0, 0); diff --git a/test/test_sgr.c b/test/test_sgr.c index 509033ed..66241b39 100644 --- a/test/test_sgr.c +++ b/test/test_sgr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2015,2016 Free Software Foundation, Inc. * + * Copyright (c) 2015-2016,2017 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 @@ /* * Author: Thomas E. Dickey * - * $Id: test_sgr.c,v 1.8 2016/09/04 23:30:56 tom Exp $ + * $Id: test_sgr.c,v 1.10 2017/04/09 00:27:42 tom Exp $ * * A simple demo of the sgr/sgr0 terminal capabilities. */ @@ -118,7 +118,7 @@ next_dbitem(void) return result; } -#ifdef NO_LEAKS +#if NO_LEAKS static void free_dblist(void) { @@ -286,6 +286,9 @@ brute_force(const char *name) } } } + for (count = 0; count < MAXSGR; ++count) { + free(values[count]); + } } del_curterm(cur_term); } @@ -349,7 +352,7 @@ main(int argc, char *argv[]) printf("%ld distinct values\n", total_values); -#ifdef NO_LEAKS +#if NO_LEAKS free_dblist(); #endif diff --git a/test/worm.c b/test/worm.c index 92bdb254..5f645ac6 100644 --- a/test/worm.c +++ b/test/worm.c @@ -61,7 +61,7 @@ Options: traces will be dumped. The program stops and waits for one character of input at the beginning and end of the interval. - $Id: worm.c,v 1.66 2016/09/17 21:12:30 tom Exp $ + $Id: worm.c,v 1.67 2017/04/09 00:27:42 tom Exp $ */ #include @@ -608,7 +608,7 @@ main(int argc, char *argv[]) Trace(("Cleanup")); cleanup(); -#ifdef NO_LEAKS +#if NO_LEAKS for (y = 0; y < max_refs; y++) { free(refs[y]); }