summaryrefslogtreecommitdiffstats
path: root/debian/patches/upstream-39d41d0810.diff
blob: 8b8abb7aa56286821929c3a942455b33ca1d2077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
From b77cfc8d2b4d0c894793efaf106b37c17d29d2d0 Mon Sep 17 00:00:00 2001
From: Nicholas Marriott <nicholas.marriott@gmail.com>
Date: Fri, 28 Apr 2023 06:44:40 +0100
Subject: [PATCH 2/4] Use ncurses' new tparm_s function (added in 6.4-20230424)
 instead of tparm so it does not object to string arguments in capabilities it
 doesn't already know.

---
 configure.ac |  4 ++++
 tty-term.c   | 48 +++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2b8b3b11ac..3c3c187393 100644
--- a/configure.ac
+++ b/configure.ac
@@ -344,6 +344,10 @@ else
 		AC_MSG_ERROR("curses not found")
 	fi
 fi
+AC_CHECK_FUNCS([ \
+	tiparm \
+	tiparm_s \
+])
 
 # Look for utempter.
 AC_ARG_ENABLE(
diff --git a/tty-term.c b/tty-term.c
index 32dd849ac7..18b174208d 100644
--- a/tty-term.c
+++ b/tty-term.c
@@ -764,7 +764,13 @@ tty_term_string_i(struct tty_term *term, enum tty_code_code code, int a)
 {
 	const char	*x = tty_term_string(term, code), *s;
 
-	s = tparm((char *)x, a);
+#if defined(HAVE_TIPARM_S)
+	s = tiparm_s(1, 0, x, a);
+#elif defined(HAVE_TIPARM)
+	s = tiparm(x, a);
+#else
+	s = tparm((char *)x, a, 0, 0, 0, 0, 0, 0, 0, 0);
+#endif
 	if (s == NULL)
 		fatalx("could not expand %s", tty_term_codes[code].name);
 	return (s);
@@ -775,19 +781,31 @@ tty_term_string_ii(struct tty_term *term, enum tty_code_code code, int a, int b)
 {
 	const char	*x = tty_term_string(term, code), *s;
 
-	s = tparm((char *)x, a, b);
+#if defined(HAVE_TIPARM_S)
+	s = tiparm_s(2, 0, x, a, b);
+#elif defined(HAVE_TIPARM)
+	s = tiparm(x, a, b);
+#else
+	s = tparm((char *)x, a, b, 0, 0, 0, 0, 0, 0, 0);
+#endif
 	if (s == NULL)
 		fatalx("could not expand %s", tty_term_codes[code].name);
 	return (s);
 }
 
 const char *
-tty_term_string_iii(struct tty_term *term, enum tty_code_code code, int a, int b,
-    int c)
+tty_term_string_iii(struct tty_term *term, enum tty_code_code code, int a,
+    int b, int c)
 {
 	const char	*x = tty_term_string(term, code), *s;
 
-	s = tparm((char *)x, a, b, c);
+#if defined(HAVE_TIPARM_S)
+	s = tiparm_s(3, 0, x, a, b, c);
+#elif defined(HAVE_TIPARM)
+	s = tiparm(x, a, b, c);
+#else
+	s = tparm((char *)x, a, b, c, 0, 0, 0, 0, 0, 0);
+#endif
 	if (s == NULL)
 		fatalx("could not expand %s", tty_term_codes[code].name);
 	return (s);
@@ -798,19 +816,31 @@ tty_term_string_s(struct tty_term *term, enum tty_code_code code, const char *a)
 {
 	const char	*x = tty_term_string(term, code), *s;
 
-	s = tparm((char *)x, (long)a);
+#if defined(HAVE_TIPARM_S)
+	s = tiparm_s(1, 1, x, a);
+#elif defined(HAVE_TIPARM)
+	s = tiparm(x, a);
+#else
+	s = tparm((char *)x, (long)a, 0, 0, 0, 0, 0, 0, 0, 0);
+#endif
 	if (s == NULL)
 		fatalx("could not expand %s", tty_term_codes[code].name);
 	return (s);
 }
 
 const char *
-tty_term_string_ss(struct tty_term *term, enum tty_code_code code, const char *a,
-    const char *b)
+tty_term_string_ss(struct tty_term *term, enum tty_code_code code,
+    const char *a, const char *b)
 {
 	const char	*x = tty_term_string(term, code), *s;
 
-	s = tparm((char *)x, (long)a, (long)b);
+#if defined(HAVE_TIPARM_S)
+	s = tiparm_s(2, 3, x, a, b);
+#elif defined(HAVE_TIPARM)
+	s = tiparm(x, a, b);
+#else
+	s = tparm((char *)x, (long)a, b, 0, 0, 0, 0, 0, 0, 0);
+#endif
 	if (s == NULL)
 		fatalx("could not expand %s", tty_term_codes[code].name);
 	return (s);
-- 
2.39.2