summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-12-27 17:23:01 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-12-27 17:23:01 -0800
commitc8a0d38ad4b04b6b54fa9e633c24f21eca0cd239 (patch)
tree3dbee7d51f8cacef731cf713a39567a39d884da8
parent80e7db667d3a667fe014ac0bda561148f129f2c1 (diff)
downloadncurses-c8a0d38ad4b04b6b54fa9e633c24f21eca0cd239.tar.gz
ncurses-c8a0d38ad4b04b6b54fa9e633c24f21eca0cd239.tar.bz2
ncurses-c8a0d38ad4b04b6b54fa9e633c24f21eca0cd239.zip
apply ncurses-5.9-20120303.patch
-rw-r--r--NEWS18
-rw-r--r--dist.mk4
-rw-r--r--include/term_entry.h6
-rw-r--r--man/terminfo.head7
-rw-r--r--man/terminfo.tail37
-rw-r--r--ncurses/base/lib_mouse.c16
-rw-r--r--ncurses/base/lib_printw.c36
-rw-r--r--ncurses/curses.priv.h8
-rw-r--r--ncurses/tinfo/alloc_ttype.c22
-rw-r--r--ncurses/tinfo/lib_setup.c6
-rw-r--r--test/demo_termcap.c53
11 files changed, 153 insertions, 60 deletions
diff --git a/NEWS b/NEWS
index 8ad5a14..bd9a03a 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.1867 2012/02/29 01:10:25 tom Exp $
+-- $Id: NEWS,v 1.1873 2012/03/01 09:53:21 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,22 @@ 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.
+20120303
+ + minor tidying of terminfo.tail, clarify reason for limitation
+ regarding mapping of \0 to \200
+ + minor improvement to _nc_copy_termtype(), using memcpy to replace
+ loops.
+ + fix no-leaks checking in test/demo_termcap.c to account for multiple
+ calls to setupterm().
+ + modified the libgpm change to show previous load as a problem in the
+ debug-trace.
+ > merge some patches from OpenSUSE rpm (Werner Fink):
+ + ncurses-5.7-printw.dif, fixes for varargs handling in lib_printw.c
+ + ncurses-5.7-gpm.dif, do not dlopen libgpm if already loaded by
+ runtime linker
+ + ncurses-5.6-fallback.dif, do not free arrays and strings from static
+ fallback entries
+
20120228
+ fix breakage in tic/infocmp from 20120225 (report by Werner Fink).
diff --git a/dist.mk b/dist.mk
index 3bc4953..77d627d 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.861 2012/02/29 01:09:10 tom Exp $
+# $Id: dist.mk,v 1.862 2012/02/29 10:02:11 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 = 5
NCURSES_MINOR = 9
-NCURSES_PATCH = 20120228
+NCURSES_PATCH = 20120303
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
diff --git a/include/term_entry.h b/include/term_entry.h
index 1074f16..a3c11d9 100644
--- a/include/term_entry.h
+++ b/include/term_entry.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2011,2012 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 @@
* and: Thomas E. Dickey 1998-on *
****************************************************************************/
-/* $Id: term_entry.h,v 1.40 2011/10/08 21:00:41 tom Exp $ */
+/* $Id: term_entry.h,v 1.41 2012/02/29 11:57:03 tom Exp $ */
/*
* term_entry.h -- interface to entry-manipulation code
@@ -150,7 +150,7 @@ extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool);
/* alloc_ttype.c: elementary allocation code */
extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *);
-extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, TERMTYPE *);
+extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *);
/* free_ttype.c: elementary allocation code */
extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *);
diff --git a/man/terminfo.head b/man/terminfo.head
index da8284c..f6399ce 100644
--- a/man/terminfo.head
+++ b/man/terminfo.head
@@ -1,5 +1,5 @@
.\"***************************************************************************
-.\" Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+.\" Copyright (c) 1998-2010,2012 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,10 +26,13 @@
.\" authorization. *
.\"***************************************************************************
.\"
-.\" $Id: terminfo.head,v 1.18 2010/07/31 16:08:48 tom Exp $
+.\" $Id: terminfo.head,v 1.19 2012/03/01 09:51:23 tom Exp $
.TH terminfo 5 "" "" "File Formats"
.ds n 5
.ds d @TERMINFO@
+.de bP
+.IP \(bu 4
+..
.SH NAME
terminfo \- terminal capability data base
.SH SYNOPSIS
diff --git a/man/terminfo.tail b/man/terminfo.tail
index a3ee0a8..26aa685 100644
--- a/man/terminfo.tail
+++ b/man/terminfo.tail
@@ -1,4 +1,4 @@
-.\" $Id: terminfo.tail,v 1.55 2011/12/17 23:19:59 tom Exp $
+.\" $Id: terminfo.tail,v 1.57 2012/03/01 12:02:54 tom Exp $
.\" Beginning of terminfo.tail file
.\" This file is part of ncurses.
.\" See "terminfo.head" for copyright.
@@ -75,14 +75,29 @@ map to an \s-1ESCAPE\s0 character,
\fB^x\fR maps to a control-x for any appropriate x, and the sequences
\fB\en \el \er \et \eb \ef \es\fR give
a newline, line-feed, return, tab, backspace, form-feed, and space.
-Other escapes include \fB\e^\fR for \fB^\fR,
+Other escapes include
+.bP
+\fB\e^\fR for \fB^\fR,
+.bP
\fB\e\e\fR for \fB\e\fR,
+.bP
\fB\e\fR, for comma,
+.bP
\fB\e:\fR for \fB:\fR,
+.bP
and \fB\e0\fR for null.
-(\fB\e0\fR will produce \e200, which does not terminate a string but behaves
+.IP
+\fB\e0\fR will produce \e200, which does not terminate a string but behaves
as a null character on most terminals, providing CS7 is specified.
-See stty(1).)
+See stty(1).
+.IP
+The reason for this quirk is to maintain binary compatibility of the
+compiled terminfo files with other implementations,
+e.g., the SVr4 systems, which document this.
+Compiled terminfo files use null-terminated strings, with no lengths.
+Modifying this would require a new binary format,
+which would not work with other implementations.
+.PP
Finally, characters may be given as three octal digits after a \fB\e\fR.
.PP
A delay in milliseconds may appear anywhere in a string capability, enclosed in
@@ -593,6 +608,7 @@ Other terminals, such as the Concept 100 and the Perkin Elmer Owl, make
a distinction between typed and untyped blanks on the screen, shifting
upon an insert or delete only to an untyped blank on the screen which is
either eliminated, or expanded to two untyped blanks.
+.PP
You can determine the
kind of terminal you have by clearing the screen and then typing
text separated by cursor motions.
@@ -608,6 +624,7 @@ shifts over to the \*(lqdef\*(rq which then move together around the end of the
current line and onto the next as you insert, you have the second type of
terminal, and should give the capability \fBin\fR, which stands for
\*(lqinsert null\*(rq.
+.PP
While these are two logically separate attributes (one line versus multi-line
insert mode, and special treatment of untyped spaces) we have seen no
terminals whose insert mode cannot be described with the single attribute.
@@ -1570,19 +1587,15 @@ length of the entry as it exists in /etc/termcap, minus the
backslash-newline pairs, which \fBtgetent()\fP strips out while reading it.
Some termcap libraries strip off the final newline, too (GNU termcap does not).
Now suppose:
-.TP 5
-*
+.bP
a termcap entry before expansion is more than 1023 bytes long,
-.TP 5
-*
+.bP
and the application has only allocated a 1k buffer,
-.TP 5
-*
+.bP
and the termcap library (like the one in BSD/OS 1.1 and GNU) reads
the whole entry into the buffer, no matter what its length, to see
if it is the entry it wants,
-.TP 5
-*
+.bP
and \fBtgetent()\fP is searching for a terminal type that either is the
long entry, appears in the termcap file after the long entry, or
does not appear in the file at all (so that \fBtgetent()\fP has to search
diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c
index 840d341..f4ad054 100644
--- a/ncurses/base/lib_mouse.c
+++ b/ncurses/base/lib_mouse.c
@@ -84,7 +84,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_mouse.c,v 1.136 2012/02/22 22:40:24 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.138 2012/02/29 10:38:46 tom Exp $")
#include <tic.h>
@@ -397,11 +397,19 @@ enable_xterm_mouse(SCREEN *sp, int enable)
#if USE_GPM_SUPPORT
static bool
-allow_gpm_mouse(void)
+allow_gpm_mouse(SCREEN *sp)
{
bool result = FALSE;
- /* GPM does printf's without checking if stdout is a terminal */
+#if USE_WEAK_SYMBOLS
+ /* Danger Robinson: do not use dlopen for libgpm if already loaded */
+ if ((Gpm_Wgetch)) {
+ if (!sp->_mouse_gpm_loaded) {
+ T(("GPM library was already dlopen'd, not by us"));
+ }
+ } else
+#endif
+ /* GPM does printf's without checking if stdout is a terminal */
if (isatty(fileno(stdout))) {
char *list = getenv("NCURSES_GPM_TERMS");
char *env = getenv("TERM");
@@ -527,7 +535,7 @@ initialize_mousetype(SCREEN *sp)
/* Try gpm first, because gpm may be configured to run in xterm */
#if USE_GPM_SUPPORT
- if (allow_gpm_mouse()) {
+ if (allow_gpm_mouse(sp)) {
if (!sp->_mouse_gpm_loaded) {
#ifdef HAVE_LIBDL
load_gpm_library(sp);
diff --git a/ncurses/base/lib_printw.c b/ncurses/base/lib_printw.c
index 963181d..530e713 100644
--- a/ncurses/base/lib_printw.c
+++ b/ncurses/base/lib_printw.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2012 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 <curses.priv.h>
-MODULE_ID("$Id: lib_printw.c,v 1.20 2009/10/24 22:07:03 tom Exp $")
+MODULE_ID("$Id: lib_printw.c,v 1.21 2012/02/29 10:11:53 Werner.Fink Exp $")
NCURSES_EXPORT(int)
printw(const char *fmt,...)
@@ -48,10 +48,12 @@ printw(const char *fmt,...)
int code;
#ifdef TRACE
- va_start(argp, fmt);
+ va_list argq;
+ va_copy(argq, argp);
+ va_start(argq, fmt);
T((T_CALLED("printw(%s%s)"),
- _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
- va_end(argp);
+ _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
+ va_end(argq);
#endif
va_start(argp, fmt);
@@ -68,10 +70,12 @@ wprintw(WINDOW *win, const char *fmt,...)
int code;
#ifdef TRACE
- va_start(argp, fmt);
+ va_list argq;
+ va_copy(argq, argp);
+ va_start(argq, fmt);
T((T_CALLED("wprintw(%p,%s%s)"),
- (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
- va_end(argp);
+ (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
+ va_end(argq);
#endif
va_start(argp, fmt);
@@ -88,10 +92,12 @@ mvprintw(int y, int x, const char *fmt,...)
int code;
#ifdef TRACE
- va_start(argp, fmt);
+ va_list argq;
+ va_copy(argq, argp);
+ va_start(argq, fmt);
T((T_CALLED("mvprintw(%d,%d,%s%s)"),
- y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
- va_end(argp);
+ y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
+ va_end(argq);
#endif
if ((code = move(y, x)) != ERR) {
@@ -109,10 +115,12 @@ mvwprintw(WINDOW *win, int y, int x, const char *fmt,...)
int code;
#ifdef TRACE
- va_start(argp, fmt);
+ va_list argq;
+ va_copy(argq, argp);
+ va_start(argq, fmt);
T((T_CALLED("mvwprintw(%d,%d,%p,%s%s)"),
- y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
- va_end(argp);
+ y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
+ va_end(argq);
#endif
if ((code = wmove(win, y, x)) != ERR) {
diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h
index 67dcdcf..e535a49 100644
--- a/ncurses/curses.priv.h
+++ b/ncurses/curses.priv.h
@@ -34,7 +34,7 @@
****************************************************************************/
/*
- * $Id: curses.priv.h,v 1.496 2012/02/22 22:10:37 tom Exp $
+ * $Id: curses.priv.h,v 1.498 2012/02/29 10:38:18 tom Exp $
*
* curses.priv.h
*
@@ -500,6 +500,9 @@ NCURSES_EXPORT(int *) _nc_ptr_Escdelay (SCREEN *);
# endif
# define _declare(name) __extension__ extern __typeof__(name) name
# define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak))
+#else
+# undef USE_WEAK_SYMBOLS
+# define USE_WEAK_SYMBOLS 0
#endif
#endif
@@ -698,6 +701,9 @@ typedef struct {
#if USE_GPM_SUPPORT
#undef buttons /* term.h defines this, and gpm uses it! */
#include <gpm.h>
+#if USE_WEAK_SYMBOLS
+weak_symbol(Gpm_Wgetch);
+#endif
#ifdef HAVE_LIBDL
/* link dynamically to GPM */
diff --git a/ncurses/tinfo/alloc_ttype.c b/ncurses/tinfo/alloc_ttype.c
index b02cb9c..1371077 100644
--- a/ncurses/tinfo/alloc_ttype.c
+++ b/ncurses/tinfo/alloc_ttype.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2010,2012 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 *
@@ -42,7 +42,7 @@
#include <tic.h>
-MODULE_ID("$Id: alloc_ttype.c,v 1.22 2010/12/19 00:24:09 tom Exp $")
+MODULE_ID("$Id: alloc_ttype.c,v 1.24 2012/03/01 01:21:56 tom Exp $")
#if NCURSES_XNAMES
/*
@@ -473,7 +473,7 @@ _nc_align_termtype(TERMTYPE *to, TERMTYPE *from)
#endif
NCURSES_EXPORT(void)
-_nc_copy_termtype(TERMTYPE *dst, TERMTYPE *src)
+_nc_copy_termtype(TERMTYPE *dst, const TERMTYPE *src)
{
unsigned i;
@@ -482,13 +482,15 @@ _nc_copy_termtype(TERMTYPE *dst, TERMTYPE *src)
dst->Numbers = typeMalloc(short, NUM_NUMBERS(dst));
dst->Strings = typeMalloc(char *, NUM_STRINGS(dst));
- /* FIXME: use memcpy for these and similar loops */
- for_each_boolean(i, dst)
- dst->Booleans[i] = src->Booleans[i];
- for_each_number(i, dst)
- dst->Numbers[i] = src->Numbers[i];
- for_each_string(i, dst)
- dst->Strings[i] = src->Strings[i];
+ memcpy(dst->Booleans,
+ src->Booleans,
+ NUM_BOOLEANS(dst) * sizeof(dst->Booleans[0]));
+ memcpy(dst->Numbers,
+ src->Numbers,
+ NUM_NUMBERS(dst) * sizeof(dst->Numbers[0]));
+ memcpy(dst->Strings,
+ src->Strings,
+ NUM_STRINGS(dst) * sizeof(dst->Strings[0]));
/* FIXME: we probably should also copy str_table and ext_str_table,
* but tic and infocmp are not written to exploit that (yet).
diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c
index de4cb45..ab27eb1 100644
--- a/ncurses/tinfo/lib_setup.c
+++ b/ncurses/tinfo/lib_setup.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2011,2012 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 <locale.h>
#endif
-MODULE_ID("$Id: lib_setup.c,v 1.142 2011/10/22 16:13:06 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.143 2012/02/29 11:50:19 Werner.Fink Exp $")
/****************************************************************************
*
@@ -666,7 +666,7 @@ TINFO_SETUP_TERM(TERMINAL ** tp,
const TERMTYPE *fallback = _nc_fallback(tname);
if (fallback) {
- termp->type = *fallback;
+ _nc_copy_termtype(&(termp->type),fallback);
status = TGETENT_YES;
}
}
diff --git a/test/demo_termcap.c b/test/demo_termcap.c
index a3733c6..b14454d 100644
--- a/test/demo_termcap.c
+++ b/test/demo_termcap.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2005-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 2005-2011,2012 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: demo_termcap.c,v 1.14 2011/01/15 21:41:27 tom Exp $
+ * $Id: demo_termcap.c,v 1.17 2012/03/01 01:09:30 tom Exp $
*
* A simple demo of the termcap interface.
*/
@@ -55,6 +55,28 @@ static bool s_opt = FALSE;
#define isCapName(c) (isgraph(c) && strchr("^#=:\\", c) == 0)
+#if NO_LEAKS && USE_CODE_LISTS
+
+#define MYSCR struct _myscr
+MYSCR {
+ MYSCR *next;
+ TERMINAL *term;
+};
+
+static MYSCR *my_screens;
+
+static void
+save_screen(void)
+{
+ MYSCR *obj = malloc(sizeof(MYSCR));
+ obj->next = my_screens;
+ obj->term = cur_term;
+ my_screens = obj;
+}
+#else
+#define save_screen() /* nothing */
+#endif
+
static void
dumpit(NCURSES_CONST char *cap)
{
@@ -159,7 +181,7 @@ brute_force(const char *name)
#if USE_CODE_LISTS
static void
-demo_terminfo(NCURSES_CONST char *name)
+demo_termcap(NCURSES_CONST char *name)
{
unsigned n;
NCURSES_CONST char *cap;
@@ -170,6 +192,7 @@ demo_terminfo(NCURSES_CONST char *name)
#else
setterm(name);
#endif
+ save_screen();
if (b_opt) {
for (n = 0;; ++n) {
@@ -204,7 +227,7 @@ usage(void)
{
static const char *msg[] =
{
- "Usage: demo_terminfo [options] [terminal]",
+ "Usage: demo_termcap [options] [terminal]",
"",
"If no options are given, print all (boolean, numeric, string)",
"capabilities for the given terminal, using short names.",
@@ -285,17 +308,31 @@ main(int argc, char *argv[])
for (repeat = 0; repeat < r_opt; ++repeat) {
if (optind < argc) {
for (n = optind; n < argc; ++n) {
- demo_terminfo(argv[n]);
+ demo_termcap(argv[n]);
}
} else if ((name = getenv("TERM")) != 0) {
- demo_terminfo(name);
+ demo_termcap(name);
} else {
static char dumb[] = "dumb";
- demo_terminfo(dumb);
+ demo_termcap(dumb);
}
}
- }
+#if NO_LEAKS
+ /*
+ * ncurses' tgetent() interface caches some entries and its no-leaks
+ * code discards those. The calls to setupterm() on the other hand
+ * are not cached, and each call allocates a chunk of memory, even
+ * if the same terminal type is requested repeatedly.
+ */
+ while (my_screens != 0) {
+ MYSCR *next = my_screens->next;
+ del_curterm(my_screens->term);
+ free(my_screens);
+ my_screens = next;
+ }
#endif
+ }
+#endif /* USE_CODE_LISTS */
ExitProgram(EXIT_SUCCESS);
}