libncurses: Import https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.5.tar.gz changes
Change-Id: I3433d30ca01359fd2e3623ede96b531f0b39cbfa
Signed-off-by: micky387 <mickaelsaibi@free.fr>
diff --git a/ncurses/tinfo/trim_sgr0.c b/ncurses/tinfo/trim_sgr0.c
index ec5e2b7..177dcd8 100644
--- a/ncurses/tinfo/trim_sgr0.c
+++ b/ncurses/tinfo/trim_sgr0.c
@@ -1,5 +1,6 @@
/****************************************************************************
- * Copyright (c) 2005-2010,2012 Free Software Foundation, Inc. *
+ * Copyright 2020-2021,2023 Thomas E. Dickey *
+ * Copyright 2005-2012,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 *
@@ -36,22 +37,18 @@
#include <tic.h>
-MODULE_ID("$Id: trim_sgr0.c,v 1.15 2012/12/15 20:57:17 tom Exp $")
+MODULE_ID("$Id: trim_sgr0.c,v 1.22 2023/09/23 18:47:56 tom Exp $")
#undef CUR
#define CUR tp->
-#define CSI 233
-#define ESC 033 /* ^[ */
-#define L_BRACK '['
-
static char *
-set_attribute_9(TERMTYPE *tp, int flag)
+set_attribute_9(TERMTYPE2 *tp, int flag)
{
const char *value;
char *result;
- value = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag);
+ value = TIPARM_9(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag);
if (PRESENT(value))
result = strdup(value);
else
@@ -64,9 +61,9 @@
{
int result = 0;
if (s != 0) {
- if (UChar(s[0]) == CSI)
+ if (UChar(s[0]) == CSI_CHR)
result = 1;
- else if (s[0] == ESC && s[1] == L_BRACK)
+ else if (s[0] == ESC_CHR && s[1] == L_BLOCK)
result = 2;
}
return result;
@@ -221,7 +218,7 @@
}
/*
- * While 'sgr0' is the "same" as termcap 'me', there is a compatibility issue.
+ * While 'sgr0' is the "same" as termcap 'me', there is a compatibility issue.
* The sgr/sgr0 capabilities include setting/clearing alternate character set
* mode. A termcap application cannot use sgr, so sgr0 strings that reset
* alternate character set mode will be misinterpreted. Here, we remove those
@@ -232,7 +229,7 @@
* an error occurs, or the original sgr0 if no change is needed.
*/
NCURSES_EXPORT(char *)
-_nc_trim_sgr0(TERMTYPE *tp)
+_nc_trim_sgr0(TERMTYPE2 *tp)
{
char *result = exit_attribute_mode;
@@ -263,7 +260,7 @@
/*
* If rmacs is a substring of sgr(0), remove that chunk.
*/
- if (exit_alt_charset_mode != 0) {
+ if (PRESENT(exit_alt_charset_mode)) {
TR(TRACE_DATABASE, ("scan for rmacs %s", _nc_visbuf(exit_alt_charset_mode)));
j = strlen(off);
k = strlen(exit_alt_charset_mode);