snapshot of project "ncurses", label v6_5_20250111

This commit is contained in:
Thomas E. Dickey 2025-01-12 00:42:58 +00:00
parent c6d02b91c1
commit fcafa79a7c
No known key found for this signature in database
GPG Key ID: CC2AF4472167BE03
38 changed files with 204 additions and 146 deletions

8
NEWS
View File

@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.4226 2025/01/05 00:18:47 tom Exp $
-- $Id: NEWS,v 1.4229 2025/01/11 21:55:20 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@ -46,6 +46,12 @@ 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.
20250111
+ add check for infinite loop in tic's use-resolution.
+ increase limit on use-clauses from 32 to 40, warn but allow entries
which exceed the old limit.
+ add some null-pointer checks after mallocs in test-programs.
20250104
+ modify tput to warn about capabilities which expect parameters where
none are given; also repair the feature where multiple capabilities

View File

@ -1 +1 @@
5:0:10 6.5 20250104
5:0:10 6.5 20250111

View File

@ -26,7 +26,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.1649 2025/01/04 09:55:25 tom Exp $
# $Id: dist.mk,v 1.1650 2025/01/11 12:30:15 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
@ -38,7 +38,7 @@ SHELL = /bin/sh
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 6
NCURSES_MINOR = 5
NCURSES_PATCH = 20250104
NCURSES_PATCH = 20250111
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -1,4 +1,4 @@
/* $Id: curses.wide,v 1.51 2021/05/22 20:28:29 tom Exp $ */
/* $Id: curses.wide,v 1.52 2025/01/12 00:39:32 tom Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
@ -240,7 +240,7 @@ extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /
#define bkgrnd(c) wbkgrnd(stdscr,(c))
#define bkgrndset(c) wbkgrndset(stdscr,(c))
#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br)
#define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),0,0,0,0)
#define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),NULL,NULL,NULL,NULL)
#define echo_wchar(c) wecho_wchar(stdscr,(c))
#define get_wch(c) wget_wch(stdscr,(c))
#define get_wstr(t) wget_wstr(stdscr,(t))

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 2018-2023,2025 Thomas E. Dickey *
* Copyright 1998-2015,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -33,7 +33,7 @@
* and: Thomas E. Dickey 1998-on *
****************************************************************************/
/* $Id: term_entry.h,v 1.64 2023/04/22 13:37:14 tom Exp $ */
/* $Id: term_entry.h,v 1.65 2025/01/11 20:37:28 tom Exp $ */
/*
* term_entry.h -- interface to entry-manipulation code
@ -108,7 +108,8 @@ typedef enum {
dbdLAST
} DBDIRS;
#define MAX_USES 32
#define WARN_MAX_USES 32
#define HARD_MAX_USES 40
#define MAX_CROSSLINKS 16
typedef struct entry ENTRY;
@ -122,7 +123,7 @@ typedef struct {
struct entry {
TERMTYPE2 tterm;
unsigned nuses;
ENTRY_USES uses[MAX_USES];
ENTRY_USES uses[HARD_MAX_USES];
int ncrosslinks;
ENTRY *crosslinks[MAX_CROSSLINKS];
long cstart;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2019-2023,2024 Thomas E. Dickey *
* Copyright 2019-2024,2025 Thomas E. Dickey *
* Copyright 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -42,7 +42,7 @@
#define CUR SP_TERMTYPE
#endif
MODULE_ID("$Id: lib_screen.c,v 1.110 2024/12/07 17:46:49 tom Exp $")
MODULE_ID("$Id: lib_screen.c,v 1.112 2025/01/12 00:31:03 tom Exp $")
#define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */
@ -58,7 +58,7 @@ MODULE_ID("$Id: lib_screen.c,v 1.110 2024/12/07 17:46:49 tom Exp $")
#define ARG_SLIMIT(name) /* nothing */
#endif
#define CUR_SLIMIT _nc_SLIMIT(limit - (size_t) (target - base))
#define CUR_SLIMIT _nc_SLIMIT(limit - (size_t) (target + 1 - base))
#define TOP_SLIMIT _nc_SLIMIT(sizeof(buffer))
/*
@ -917,7 +917,7 @@ putwin(WINDOW *win, FILE *filep)
* ncurses is compiled with wide-character support, and also may depend
* on the version of ncurses, e.g., if the WINDOW structure is extended.
*/
if (win != 0) {
if (win != NULL) {
size_t len = (size_t) (win->_maxx + 1);
int y;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2022,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -57,7 +57,7 @@
#undef CUR
#define CUR SP_TERMTYPE
MODULE_ID("$Id: lib_set_term.c,v 1.191 2024/12/15 00:04:13 tom Exp $")
MODULE_ID("$Id: lib_set_term.c,v 1.192 2025/01/12 00:41:56 tom Exp $")
#ifdef USE_TERM_DRIVER
#define MaxColors InfoOf(sp).maxcolors
@ -362,8 +362,8 @@ NCURSES_SP_NAME(_nc_setupscreen) (
}
#else
if (!_nc_alloc_screen()
|| ((SP->_acs_map = typeCalloc(chtype, ACS_LEN)) == 0)
|| ((SP->_screen_acs_map = typeCalloc(bool, ACS_LEN)) == 0)) {
|| ((SP->_acs_map = typeCalloc(chtype, ACS_LEN)) == NULL)
|| ((SP->_screen_acs_map = typeCalloc(bool, ACS_LEN)) == NULL)) {
returnCode(ERR);
}
@ -373,7 +373,7 @@ NCURSES_SP_NAME(_nc_setupscreen) (
sp->_next_screen = _nc_screen_chain;
_nc_screen_chain = sp;
if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0) {
if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == NULL) {
returnCode(ERR);
}
#endif

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -35,7 +35,7 @@
****************************************************************************/
/*
* $Id: curses.priv.h,v 1.698 2024/12/15 00:04:23 tom Exp $
* $Id: curses.priv.h,v 1.699 2025/01/12 00:41:56 tom Exp $
*
* curses.priv.h
*
@ -2329,7 +2329,7 @@ extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *);
/* current screen is private data; avoid possible linking conflicts too */
extern NCURSES_EXPORT_VAR(SCREEN *) SP;
#define CURRENT_SCREEN SP
#define _nc_alloc_screen() ((SP = _nc_alloc_screen_sp()) != 0)
#define _nc_alloc_screen() ((SP = _nc_alloc_screen_sp()) != NULL)
#define _nc_set_screen(sp) SP = sp
#endif

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2013,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -48,7 +48,7 @@
#include <tic.h>
MODULE_ID("$Id: alloc_entry.c,v 1.81 2024/12/07 21:12:53 tom Exp $")
MODULE_ID("$Id: alloc_entry.c,v 1.82 2025/01/11 20:37:19 tom Exp $")
#define ABSENT_OFFSET -1
#define CANCELLED_OFFSET -2
@ -140,7 +140,7 @@ _nc_wrap_entry(ENTRY * const ep, bool copy_strings)
/* copy the string parts to allocated storage, preserving pointers to it */
{
int offsets[MAX_ENTRY_SIZE / sizeof(short)];
int useoffsets[MAX_USES];
int useoffsets[HARD_MAX_USES];
unsigned i, n;
unsigned nuses;
TERMTYPE2 *tp;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -48,7 +48,7 @@
#include <tic.h>
MODULE_ID("$Id: comp_parse.c,v 1.136 2024/12/07 21:12:53 tom Exp $")
MODULE_ID("$Id: comp_parse.c,v 1.138 2025/01/12 00:36:01 tom Exp $")
static void sanity_check2(TERMTYPE2 *, bool);
NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2;
@ -99,7 +99,7 @@ skip_index(char *name)
{
char *bar = strchr(name, '|');
if (bar != 0 && (bar - name) == 2)
if (bar != NULL && (bar - name) == 2)
name = bar + 1;
return name;
@ -538,12 +538,18 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
*/
if (fullresolve) {
do {
bool attempts;
bool progress;
ENTRY merged;
attempts = FALSE;
progress = FALSE;
keepgoing = FALSE;
for_entry_list(qp) {
if (qp->nuses > 0) {
attempts = TRUE;
DEBUG(2, ("%s: attempting merge of %d entries",
_nc_first_name(qp->tterm.term_names),
qp->nuses));
@ -599,16 +605,33 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
#endif
qp->tterm = merged.tterm;
_nc_wrap_entry(qp, TRUE);
progress = TRUE;
/*
* We know every entry is resolvable because name resolution
* didn't bomb. So go back for another pass.
* Every entry should be resolvable because name resolution
* did not fail. Continue if we have just made a change,
* or another entry may be changeable.
*/
/* FALLTHRU */
incomplete:
keepgoing = TRUE;
}
}
/*
* If we went all the way through the list without making any
* changes, while there were remaining use-linkages, something went
* wrong. Give up.
*/
if (!progress && attempts) {
for_entry_list(qp) {
for (i = 0; i < qp->nuses; ++i) {
_nc_warning("problem with use=%s", qp->uses[i].name);
}
}
_nc_warning("merge failed, infinite loop");
return FALSE;
}
} while
(keepgoing);

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 2006-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -44,7 +44,7 @@
#include <hashed_db.h>
#endif
MODULE_ID("$Id: db_iterator.c,v 1.52 2024/12/07 18:23:25 tom Exp $")
MODULE_ID("$Id: db_iterator.c,v 1.53 2025/01/12 00:41:56 tom Exp $")
#define HaveTicDirectory _nc_globals.have_tic_directory
#define KeepTicDirectory _nc_globals.keep_tic_directory
@ -335,9 +335,9 @@ _nc_first_db(DBDIRS * state, int *offset)
#if NCURSES_USE_TERMCAP
values[dbdEnvOnce2] = cache_getenv("TERMCAP", dbdEnvOnce2);
/* only use $TERMCAP if it is an absolute path */
if (values[dbdEnvOnce2] != 0
if (values[dbdEnvOnce2] != NULL
&& *values[dbdEnvOnce2] != '/') {
values[dbdEnvOnce2] = 0;
values[dbdEnvOnce2] = NULL;
}
values[dbdEnvList2] = cache_getenv("TERMPATH", dbdEnvList2);
#endif /* NCURSES_USE_TERMCAP */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2019-2020,2024 Thomas E. Dickey *
* Copyright 2019-2024,2025 Thomas E. Dickey *
* Copyright 2006-2011,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -37,7 +37,7 @@
#if USE_HASHED_DB
MODULE_ID("$Id: hashed_db.c,v 1.21 2024/11/30 21:16:41 tom Exp $")
MODULE_ID("$Id: hashed_db.c,v 1.22 2025/01/11 23:52:18 tom Exp $")
#if HASHED_DB_API >= 2
static DBC *cursor;
@ -55,7 +55,7 @@ static MYCONN *connections;
static void
cleanup(void)
{
while (connections != 0) {
while (connections != NULL) {
_nc_db_close(connections->db);
}
}
@ -63,10 +63,10 @@ cleanup(void)
static DB *
find_connection(const char *path, bool modify)
{
DB *result = 0;
DB *result = NULL;
MYCONN *p;
for (p = connections; p != 0; p = p->next) {
for (p = connections; p != NULL; p = p->next) {
if (!strcmp(p->path, path) && p->modify == modify) {
result = p->db;
break;
@ -81,9 +81,9 @@ drop_connection(DB * db)
{
MYCONN *p, *q;
for (p = connections, q = 0; p != 0; q = p, p = p->next) {
for (p = connections, q = NULL; p != NULL; q = p, p = p->next) {
if (p->db == db) {
if (q != 0)
if (q != NULL)
q->next = p->next;
else
connections = p->next;
@ -124,7 +124,7 @@ _nc_db_open(const char *path, bool modify)
DB *result = NULL;
int code;
if (connections == 0)
if (connections == NULL)
atexit(cleanup);
if ((result = find_connection(path, modify)) == NULL) {
@ -165,7 +165,7 @@ _nc_db_open(const char *path, bool modify)
modify ? (O_CREAT | O_RDWR) : O_RDONLY,
0644,
DB_HASH,
NULL)) == 0) {
NULL)) == NULL) {
code = errno;
} else {
code = 0;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2024 Thomas E. Dickey *
* Copyright 2020-2024,2025 Thomas E. Dickey *
* Copyright 1998-2003,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -29,7 +29,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_termname.c,v 1.14 2024/12/07 20:05:27 tom Exp $")
MODULE_ID("$Id: lib_termname.c,v 1.15 2025/01/12 00:41:56 tom Exp $")
NCURSES_EXPORT(char *)
NCURSES_SP_NAME(termname) (NCURSES_SP_DCL0)
@ -43,7 +43,7 @@ NCURSES_SP_NAME(termname) (NCURSES_SP_DCL0)
name = TerminalOf(SP_PARM)->_termname;
}
#else
if (cur_term != 0)
if (cur_term != NULL)
name = cur_term->_termname;
#endif

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2020,2023 Thomas E. Dickey *
* Copyright 2018-2023,2025 Thomas E. Dickey *
* Copyright 2000-2008,2012 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -36,7 +36,7 @@
#include <ctype.h>
#include <termcap.h>
MODULE_ID("$Id: lib_tgoto.c,v 1.23 2023/04/16 17:19:40 tom Exp $")
MODULE_ID("$Id: lib_tgoto.c,v 1.24 2025/01/12 00:41:56 tom Exp $")
#if !PURE_TERMINFO
static bool
@ -44,7 +44,7 @@ is_termcap(const char *string)
{
bool result = TRUE;
if (string == 0 || *string == '\0') {
if (string == NULL || *string == '\0') {
result = FALSE; /* tparm() handles empty strings */
} else {
while ((*string != '\0') && result) {
@ -89,13 +89,13 @@ tgoto_internal(const char *string, int x, int y)
while (*string != 0) {
if ((used + need) > length) {
length += (used + need);
if ((result = typeRealloc(char, length, result)) == 0) {
if ((result = typeRealloc(char, length, result)) == NULL) {
length = 0;
break;
}
}
if (*string == '%') {
const char *fmt = 0;
const char *fmt = NULL;
switch (*++string) {
case '\0':
@ -122,7 +122,7 @@ tgoto_internal(const char *string, int x, int y)
* and \r, but I don't see that it could work -TD
*/
if (*value == 0) {
if (BC != 0) {
if (BC != NULL) {
*value += 1;
need_BC = TRUE;
} else {
@ -166,11 +166,11 @@ tgoto_internal(const char *string, int x, int y)
*value -= 2 * (*value % 16);
break;
}
if (fmt != 0) {
if (fmt != NULL) {
_nc_SPRINTF(result + used, _nc_SLIMIT(length - used)
fmt, *value++);
used += strlen(result + used);
fmt = 0;
fmt = NULL;
}
if (value - param > 2) {
value = param + 2;
@ -181,7 +181,7 @@ tgoto_internal(const char *string, int x, int y)
}
string++;
}
if (result != 0) {
if (result != NULL) {
if (need_BC) {
_nc_STRCPY(result + used, BC, length - used);
used += strlen(BC);

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -52,7 +52,7 @@
#include <termcap.h> /* ospeed */
#include <tic.h>
MODULE_ID("$Id: lib_tputs.c,v 1.115 2024/12/07 21:04:53 tom Exp $")
MODULE_ID("$Id: lib_tputs.c,v 1.116 2025/01/12 00:41:56 tom Exp $")
NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */
NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
@ -319,7 +319,7 @@ NCURSES_SP_NAME(tputs) (NCURSES_SP_DCLx
#if NCURSES_SP_FUNCS
(SP_PARM != NULL && SP_PARM->_term == NULL)
#else
cur_term == 0
cur_term == NULL
#endif
) {
always_delay = FALSE;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2024 Thomas E. Dickey *
* Copyright 2020-2024,2025 Thomas E. Dickey *
* Copyright 1998-2013,2016 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -34,7 +34,7 @@
#include <curses.priv.h>
#include <tic.h>
MODULE_ID("$Id: name_match.c,v 1.26 2024/12/07 21:24:18 tom Exp $")
MODULE_ID("$Id: name_match.c,v 1.27 2025/01/12 00:41:56 tom Exp $")
#define FirstName _nc_globals.first_name
@ -44,7 +44,7 @@ skip_index(const char *name)
{
if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) {
const char *bar = strchr(name, '|');
if (bar != 0 && (bar - name) == 2)
if (bar != NULL && (bar - name) == 2)
name = bar + 1;
}
return name;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -48,7 +48,7 @@
#include <ctype.h>
#include <tic.h>
MODULE_ID("$Id: parse_entry.c,v 1.112 2024/12/07 21:13:36 tom Exp $")
MODULE_ID("$Id: parse_entry.c,v 1.113 2025/01/11 20:19:34 tom Exp $")
#ifdef LINT
static short const parametrized[] =
@ -379,10 +379,15 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent)
_nc_warning("invalid name for use-clause \"%s\"",
_nc_curr_token.tk_valstring);
continue;
} else if (entryp->nuses >= MAX_USES) {
} else if (entryp->nuses >= HARD_MAX_USES) {
_nc_warning("too many use-clauses, ignored \"%s\"",
_nc_curr_token.tk_valstring);
continue;
} else if (entryp->nuses >= WARN_MAX_USES) {
_nc_warning("possibly too many use-clauses (%d vs %d), \"%s\"",
entryp->nuses,
WARN_MAX_USES,
_nc_curr_token.tk_valstring);
}
if ((saved = _nc_save_str(_nc_curr_token.tk_valstring)) != NULL) {
entryp->uses[entryp->nuses].name = saved;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -42,7 +42,7 @@
#include <tic.h>
MODULE_ID("$Id: read_entry.c,v 1.174 2024/12/07 21:02:00 tom Exp $")
MODULE_ID("$Id: read_entry.c,v 1.175 2025/01/11 23:52:18 tom Exp $")
#define MyNumber(n) (short) LOW_MSB(n)
@ -797,13 +797,13 @@ _nc_read_tic_entry(char *filename,
} else
#if USE_HASHED_DB
if (make_db_filename(filename, limit, path)
&& (capdbp = _nc_db_open(filename, FALSE)) != 0) {
&& (capdbp = _nc_db_open(filename, FALSE)) != NULL) {
DBT key, data;
int reccnt = 0;
char *save = strdup(name);
if (save == 0)
if (save == NULL)
returnDB(code);
memset(&key, 0, sizeof(key));

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2021,2023 Thomas E. Dickey *
* Copyright 2018-2023,2025 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -57,7 +57,7 @@
#include <sys/types.h>
#include <tic.h>
MODULE_ID("$Id: read_termcap.c,v 1.104 2023/06/24 21:53:16 tom Exp $")
MODULE_ID("$Id: read_termcap.c,v 1.105 2025/01/12 00:42:58 tom Exp $")
#if !PURE_TERMINFO
@ -72,7 +72,7 @@ get_termpath(void)
{
const char *result;
if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == 0)
if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == NULL)
result = TERMPATH;
TR(TRACE_DATABASE, ("TERMPATH is %s", result));
return result;
@ -720,7 +720,7 @@ get_tc_token(char **srcp, int *endp)
int ch;
bool found = FALSE;
char *s, *base;
char *tok = 0;
char *tok = NULL;
*endp = TRUE;
for (s = base = *srcp; *s != '\0';) {
@ -749,7 +749,7 @@ get_tc_token(char **srcp, int *endp)
}
/* malformed entry may end without a ':' */
if (tok == 0 && found) {
if (tok == NULL && found) {
tok = base;
}
@ -768,7 +768,7 @@ copy_tc_token(char *dst, const char *src, size_t len)
continue;
}
if (--len == 0) {
dst = 0;
dst = NULL;
break;
}
*dst++ = (char) ch;
@ -813,13 +813,13 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
if (cp == NULL) {
_nc_safe_strcpy(&desc, get_termpath());
} else if (!_nc_is_abs_path(cp)) { /* TERMCAP holds an entry */
if ((termpath = get_termpath()) != 0) {
if ((termpath = get_termpath()) != NULL) {
_nc_safe_strcat(&desc, termpath);
} else {
char temp[PBUFSIZ];
temp[0] = 0;
if ((home = getenv("HOME")) != 0 && *home != '\0'
&& strchr(home, ' ') == 0
if ((home = getenv("HOME")) != NULL && *home != '\0'
&& strchr(home, ' ') == NULL
&& strlen(home) < sizeof(temp) - 10) { /* setup path */
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"%s/", home); /* $HOME first */
@ -850,7 +850,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
}
}
}
*fname = 0; /* mark end of vector */
*fname = NULL; /* mark end of vector */
#if !HAVE_BSD_CGETENT
(void) _nc_cgetset(0);
#endif
@ -875,7 +875,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
pd = bp;
ps = dummy;
while (!endflag && (tok = get_tc_token(&ps, &endflag)) != 0) {
while (!endflag && (tok = get_tc_token(&ps, &endflag)) != NULL) {
bool ignore = FALSE;
for (n = 1; n < count; n++) {
@ -889,7 +889,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
if (ignore != TRUE) {
list[count++] = tok;
pd = copy_tc_token(pd, tok, (size_t) (TBUFSIZ - (2 + pd - bp)));
if (pd == 0) {
if (pd == NULL) {
i = -1;
break;
}
@ -901,7 +901,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
FreeIfNeeded(dummy);
FreeIfNeeded(the_source);
the_source = 0;
the_source = NULL;
/* This is not related to the BSD cgetent(), but to fake up a suitable
* filename for ncurses' error reporting. (If we are not using BSD
@ -917,7 +917,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
if (_nc_access(temp, R_OK) == 0) {
_nc_safe_strcpy(&desc, pathvec[i]);
}
if ((the_source = strdup(temp)) != 0)
if ((the_source = strdup(temp)) != NULL)
*sourcename = the_source;
#else
if ((the_source = strdup(pathvec[i])) != 0)
@ -966,7 +966,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE2 *const tp)
#endif
#if USE_GETCAP
char *p, tc[TBUFSIZ];
char *tc_buf = 0;
char *tc_buf = NULL;
#define MY_SIZE sizeof(tc) - 1
int status;
static char *source;
@ -982,7 +982,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE2 *const tp)
return TGETENT_NO;
}
if (use_terminfo_vars() && (p = getenv("TERMCAP")) != 0
if (use_terminfo_vars() && (p = getenv("TERMCAP")) != NULL
&& !_nc_is_abs_path(p) && _nc_name_match(p, tn, "|:")) {
/* TERMCAP holds a termcap entry */
tc_buf = strdup(p);
@ -996,7 +996,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE2 *const tp)
_nc_set_source(source);
tc_buf = tc;
}
if (tc_buf == 0)
if (tc_buf == NULL)
return (TGETENT_ERR);
_nc_read_entry_source((FILE *) 0, tc_buf, FALSE, TRUE, NULLHOOK);
if (tc_buf != tc)
@ -1144,7 +1144,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE2 *const tp)
free(copied);
#endif /* USE_GETCAP */
if (_nc_head == 0)
if (_nc_head == NULL)
return (TGETENT_ERR);
/* resolve all use references */

View File

@ -1,8 +1,8 @@
ncurses6td (6.5+20250104) unstable; urgency=low
ncurses6td (6.5+20250111) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 29 Dec 2024 04:55:25 -0500
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 11 Jan 2025 07:30:15 -0500
ncurses6 (5.9+20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6td (6.5+20250104) unstable; urgency=low
ncurses6td (6.5+20250111) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 29 Dec 2024 04:55:25 -0500
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 11 Jan 2025 07:30:15 -0500
ncurses6 (5.9+20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6td (6.5+20250104) unstable; urgency=low
ncurses6td (6.5+20250111) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 29 Dec 2024 04:55:25 -0500
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 11 Jan 2025 07:30:15 -0500
ncurses6 (5.9+20120608) unstable; urgency=low

View File

@ -1,4 +1,4 @@
; $Id: mingw-ncurses.nsi,v 1.683 2025/01/04 09:55:25 tom Exp $
; $Id: mingw-ncurses.nsi,v 1.684 2025/01/11 12:30:15 tom Exp $
; TODO add examples
; TODO bump ABI to 6
@ -10,7 +10,7 @@
!define VERSION_MAJOR "6"
!define VERSION_MINOR "5"
!define VERSION_YYYY "2025"
!define VERSION_MMDD "0104"
!define VERSION_MMDD "0111"
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
!define MY_ABI "5"

View File

@ -3,7 +3,7 @@
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 6.5
Release: 20250104
Release: 20250111
License: X11
Group: Development/Libraries
URL: https://invisible-island.net/ncurses/

View File

@ -1,7 +1,7 @@
Summary: shared libraries for terminal handling
Name: ncurses6
Version: 6.5
Release: 20250104
Release: 20250111
License: X11
Group: Development/Libraries
URL: https://invisible-island.net/ncurses/

View File

@ -1,7 +1,7 @@
Summary: Curses library with POSIX thread support.
Name: ncursest6
Version: 6.5
Release: 20250104
Release: 20250111
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -49,7 +49,7 @@
#include <parametrized.h>
#include <transform.h>
MODULE_ID("$Id: tic.c,v 1.331 2024/12/07 23:19:49 tom Exp $")
MODULE_ID("$Id: tic.c,v 1.332 2025/01/11 23:52:18 tom Exp $")
#define STDIN_NAME "<stdin>"
@ -601,7 +601,7 @@ valid_db_path(const char *nominal)
|| access(result, R_OK | W_OK) != 0) {
DEBUG(1, ("...not a writable file"));
free(result);
result = 0;
result = NULL;
}
#else
if (!S_ISDIR(sb.st_mode)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2013,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -45,7 +45,7 @@
#include <hashed_db.h>
#endif
MODULE_ID("$Id: toe.c,v 1.92 2024/12/07 22:12:53 tom Exp $")
MODULE_ID("$Id: toe.c,v 1.94 2025/01/12 00:36:48 tom Exp $")
#define isDotname(name) (!strcmp(name, ".") || !strcmp(name, ".."))
@ -374,10 +374,10 @@ show_termcap(int db_index, int db_limit, char *buffer, DescHook hook)
memset(&data, 0, sizeof(data));
data.term_names = strmalloc(buffer);
while ((next = strtok(list, "|")) != 0) {
while ((next = strtok(list, "|")) != NULL) {
if (next != last)
hook(db_index, db_limit, next, &data);
list = 0;
list = NULL;
}
free(data.term_names);
}
@ -502,7 +502,7 @@ typelist(int eargc, char *eargv[],
(void) printf("#\n#%s:\n#\n", eargv[i]);
if (make_db_name(filename, eargv[i], sizeof(filename))) {
if ((capdbp = _nc_db_open(filename, FALSE)) != 0) {
if ((capdbp = _nc_db_open(filename, FALSE)) != NULL) {
DBT key, data;
int code;
@ -536,13 +536,13 @@ typelist(int eargc, char *eargv[],
#if HAVE_BSD_CGETENT
{
CGETENT_CONST char *db_array[2];
char *buffer = 0;
char *buffer = NULL;
if (verbosity)
(void) printf("#\n#%s:\n#\n", eargv[i]);
db_array[0] = eargv[i];
db_array[1] = 0;
db_array[1] = NULL;
if (cgetfirst(&buffer, db_array) > 0) {
if (is_termcap(buffer)) {

View File

@ -47,7 +47,7 @@
#include <transform.h>
#include <tty_settings.h>
MODULE_ID("$Id: tput.c,v 1.109 2025/01/05 00:10:46 tom Exp $")
MODULE_ID("$Id: tput.c,v 1.110 2025/01/12 00:36:15 tom Exp $")
#define PUTS(s) fputs(s, stdout)
@ -219,7 +219,7 @@ tput_cmd(int fd, TTY * settings, int argc, char **argv, int *used)
const struct name_table_entry *np;
termcap = TRUE;
if ((np = _nc_find_entry(name, _nc_get_hash_table(termcap))) != 0) {
if ((np = _nc_find_entry(name, _nc_get_hash_table(termcap))) != NULL) {
switch (np->nte_type) {
case BOOLEAN:
name = boolnames[np->nte_index];

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 2005-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -27,7 +27,7 @@
* authorization. *
****************************************************************************/
/*
* $Id: demo_altkeys.c,v 1.18 2024/12/07 23:02:27 tom Exp $
* $Id: demo_altkeys.c,v 1.19 2025/01/11 14:54:49 tom Exp $
*
* Demonstrate the define_key() function.
* Thomas Dickey - 2005/10/22
@ -138,9 +138,11 @@ main(int argc, char *argv[])
if ((value = keybound(n, 0)) != NULL) {
size_t need = strlen(value) + 2;
char *temp = typeMalloc(char, need);
_nc_SPRINTF(temp, _nc_SLIMIT(need) "\033%s", value);
define_key(temp, n + MY_KEYS);
free(temp);
if (temp != NULL) {
_nc_SPRINTF(temp, _nc_SLIMIT(need) "\033%s", value);
define_key(temp, n + MY_KEYS);
free(temp);
}
free(value);
}
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2019-2023,2024 Thomas E. Dickey *
* Copyright 2019-2024,2025 Thomas E. Dickey *
* Copyright 2005-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -30,7 +30,7 @@
/*
* Author: Thomas E. Dickey
*
* $Id: demo_termcap.c,v 1.73 2024/12/07 22:27:13 tom Exp $
* $Id: demo_termcap.c,v 1.74 2025/01/11 14:54:49 tom Exp $
*
* A simple demo of the termcap interface.
*/
@ -107,9 +107,12 @@ static long total_s_values;
static char *
make_dbitem(const char *const p, const char *const q)
{
size_t need = strlen(e_opt) + 2 + (size_t) (p - q);
size_t diff = (size_t) (p - q);
size_t need = strlen(e_opt) + 2 + diff;
char *result = malloc(need);
_nc_SPRINTF(result, _nc_SLIMIT(need) "%s=%.*s", e_opt, (int) (p - q), q);
if (result != NULL) {
_nc_SPRINTF(result, _nc_SLIMIT(need) "%s=%.*s", e_opt, (int) diff, q);
}
return result;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2019-2023,2024 Thomas E. Dickey *
* Copyright 2019-2024,2025 Thomas E. Dickey *
* Copyright 2009-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -30,7 +30,7 @@
/*
* Author: Thomas E. Dickey
*
* $Id: demo_terminfo.c,v 1.62 2024/12/07 22:27:13 tom Exp $
* $Id: demo_terminfo.c,v 1.63 2025/01/11 14:54:49 tom Exp $
*
* A simple demo of the terminfo interface.
*/
@ -98,9 +98,12 @@ static long total_s_values;
static char *
make_dbitem(const char *const p, const char *const q)
{
size_t need = strlen(e_opt) + 2 + (size_t) (p - q);
size_t diff = (size_t) (p - q);
size_t need = strlen(e_opt) + 2 + diff;
char *result = malloc(need);
_nc_SPRINTF(result, _nc_SLIMIT(need) "%s=%.*s", e_opt, (int) (p - q), q);
if (result != NULL) {
_nc_SPRINTF(result, _nc_SLIMIT(need) "%s=%.*s", e_opt, (int) diff, q);
}
return result;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020-2023,2024 Thomas E. Dickey *
* Copyright 2020-2024,2025 Thomas E. Dickey *
* *
* 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: dup_field.c,v 1.12 2024/12/07 22:32:11 tom Exp $
* $Id: dup_field.c,v 1.13 2025/01/11 14:54:49 tom Exp $
*
* Demonstrate dup_field().
*/
@ -96,8 +96,10 @@ my_help_edit_field(void)
name = commands[n].help;
need = 5 + strlen(code) + strlen(name);
msg = typeMalloc(char, need);
_nc_SPRINTF(msg, _nc_SLIMIT(need) "%s -- %s", code, name);
msgs[used++] = msg;
if (msg != NULL) {
_nc_SPRINTF(msg, _nc_SLIMIT(need) "%s -- %s", code, name);
msgs[used++] = msg;
}
}
msgs[used++] =
strdup("Arrow keys move within a field as you would expect.");

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2019-2020,2024 Thomas E. Dickey *
* Copyright 2019-2024,2025 Thomas E. Dickey *
* Copyright 2003-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -27,7 +27,7 @@
* authorization. *
****************************************************************************/
/*
* $Id: edit_field.c,v 1.33 2024/12/07 22:22:51 tom Exp $
* $Id: edit_field.c,v 1.34 2025/01/11 14:54:49 tom Exp $
*
* A wrapper for form_driver() which keeps track of the user's editing changes
* for each field, and makes the resulting length available as a
@ -193,8 +193,10 @@ help_edit_field(void)
name = commands[n].help;
need = 5 + strlen(code) + strlen(name);
msg = typeMalloc(char, need);
_nc_SPRINTF(msg, _nc_SLIMIT(need) "%s -- %s", code, name);
msgs[used++] = msg;
if (msg != NULL) {
_nc_SPRINTF(msg, _nc_SLIMIT(need) "%s -- %s", code, name);
msgs[used++] = msg;
}
}
msgs[used++] =
strdup("Arrow keys move within a field as you would expect.");

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 2006-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -30,7 +30,7 @@
/*
* Author: Thomas E. Dickey, 2006
*
* $Id: foldkeys.c,v 1.14 2024/12/21 17:25:16 tom Exp $
* $Id: foldkeys.c,v 1.15 2025/01/11 14:54:49 tom Exp $
*
* Demonstrate a method for altering key definitions at runtime.
*
@ -155,6 +155,8 @@ demo_foldkeys(void)
&second,
final) == 3
&& *final != ';'
&& first >= 0
&& first < 1024
&& (need = strlen(info[j].value)) != 0
&& (value = malloc(need + 8)) != NULL) {
(void) need; /* _nc_SLIMIT is normally nothing */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020-2023,2024 Thomas E. Dickey *
* Copyright 2020-2024,2025 Thomas E. Dickey *
* *
* 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: move_field.c,v 1.20 2024/12/07 22:33:32 tom Exp $
* $Id: move_field.c,v 1.21 2025/01/11 14:54:49 tom Exp $
*
* Demonstrate move_field().
*/
@ -96,8 +96,10 @@ my_help_edit_field(void)
name = commands[n].help;
need = 5 + strlen(code) + strlen(name);
msg = typeMalloc(char, need);
_nc_SPRINTF(msg, _nc_SLIMIT(need) "%s -- %s", code, name);
msgs[used++] = msg;
if (msg != NULL) {
_nc_SPRINTF(msg, _nc_SLIMIT(need) "%s -- %s", code, name);
msgs[used++] = msg;
}
}
msgs[used++] =
strdup("Arrow keys move within a field as you would expect.");

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 2006-2013,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -27,7 +27,7 @@
* authorization. *
****************************************************************************/
/*
* $Id: movewindow.c,v 1.57 2024/12/07 22:33:32 tom Exp $
* $Id: movewindow.c,v 1.58 2025/01/11 14:54:49 tom Exp $
*
* Demonstrate move functions for windows and derived windows from the curses
* library.
@ -658,12 +658,16 @@ show_help(WINDOW *current)
char **msgs = typeCalloc(char *, SIZEOF(help) + 1);
size_t n;
size_t used;
for (n = 0; n < SIZEOF(help); ++n) {
for (n = used = 0; n < SIZEOF(help); ++n) {
size_t need = (21 + strlen(help[n].msg));
msgs[n] = typeMalloc(char, need);
_nc_SPRINTF(msgs[n], _nc_SLIMIT(need)
"%-20s%s", keyname(help[n].key), help[n].msg);
char *msg = typeMalloc(char, need);
if (msg != NULL) {
_nc_SPRINTF(msg, _nc_SLIMIT(need)
"%-20s%s", keyname(help[n].key), help[n].msg);
msgs[used++] = msg;
}
}
popup_msg2(current, msgs);
for (n = 0; n < SIZEOF(help); ++n) {

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2019-2023,2024 Thomas E. Dickey *
* Copyright 2019-2024,2025 Thomas E. Dickey *
* Copyright 2015-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -30,7 +30,7 @@
/*
* Author: Thomas E. Dickey
*
* $Id: test_sgr.c,v 1.26 2024/12/07 22:48:21 tom Exp $
* $Id: test_sgr.c,v 1.27 2025/01/11 14:54:49 tom Exp $
*
* A simple demo of the sgr/sgr0 terminal capabilities.
*/
@ -63,9 +63,12 @@ static long total_values;
static char *
make_dbitem(const char *const p, const char *const q)
{
size_t need = strlen(e_opt) + 2 + (size_t) (p - q);
size_t diff = (size_t) (p - q);
size_t need = strlen(e_opt) + 2 + diff;
char *result = malloc(need);
_nc_SPRINTF(result, _nc_SLIMIT(need) "%s=%.*s", e_opt, (int) (p - q), q);
if (result != NULL) {
_nc_SPRINTF(result, _nc_SLIMIT(need) "%s=%.*s", e_opt, (int) diff, q);
}
return result;
}