summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/ncurses/files/0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/ncurses/files/0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch')
-rw-r--r--meta/recipes-core/ncurses/files/0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch499
1 files changed, 499 insertions, 0 deletions
diff --git a/meta/recipes-core/ncurses/files/0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch b/meta/recipes-core/ncurses/files/0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch
new file mode 100644
index 0000000000..121db6bffe
--- /dev/null
+++ b/meta/recipes-core/ncurses/files/0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch
@@ -0,0 +1,499 @@
1From 135d37072755704b8d018e5de74e62ff3f28c930 Mon Sep 17 00:00:00 2001
2From: Thomas E. Dickey <dickey@invisible-island.net>
3Date: Sun, 5 Nov 2023 05:54:54 +0530
4Subject: [PATCH] Updating reset code - ncurses 6.4 - patch 20231104
5
6+ modify reset command to avoid altering clocal if the terminal uses a
7 modem (prompted by discussion with Werner Fink, Michal Suchanek,
8 OpenSUSE #1201384, Debian #60377).
9+ build-fixes for --with-caps variations.
10+ correct a couple of section-references in INSTALL.
11
12Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
13
14Upstream-Status: Backport [https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff;h=135d37072755704b8d018e5de74e62ff3f28c930]
15
16Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
17---
18 INSTALL | 8 +-
19 include/curses.events | 2 +-
20 ncurses/tinfo/lib_tparm.c | 2 +
21 progs/reset_cmd.c | 281 +++++++++++++++++++++-----------------
22 progs/tabs.c | 10 +-
23 progs/tic.c | 4 +
24 6 files changed, 176 insertions(+), 131 deletions(-)
25
26diff --git a/INSTALL b/INSTALL
27index d9c1dd12..d0a39af0 100644
28--- a/INSTALL
29+++ b/INSTALL
30@@ -47,7 +47,7 @@ If you are converting from BSD curses and do not have root access, be sure
31 to read the BSD CONVERSION NOTES section below.
32
33 If you are trying to build applications using gpm with ncurses,
34-read the USING NCURSES WITH GPM section below.
35+read the USING GPM section below.
36
37 If you are cross-compiling, see the note below on BUILDING WITH A CROSS-COMPILER.
38
39@@ -79,7 +79,7 @@ INSTALLATION PROCEDURE:
40 The --prefix option to configure changes the root directory for installing
41 ncurses. The default is normally in subdirectories of /usr/local, except
42 for systems where ncurses is normally installed as a system library (see
43- "IF YOU ARE A SYSTEM INTEGRATOR"). Use --prefix=/usr to replace your
44+ "FOR SYSTEM INTEGRATORS"). Use --prefix=/usr to replace your
45 default curses distribution.
46
47 The package gets installed beneath the --prefix directory as follows:
48@@ -176,7 +176,7 @@ INSTALLATION PROCEDURE:
49 You can make curses and terminfo fall back to an existing file of termcap
50 definitions by configuring with --enable-termcap. If you do this, the
51 library will search /etc/termcap before the terminfo database, and will
52- also interpret the contents of the TERM environment variable. See the
53+ also interpret the contents of the $TERM environment variable. See the
54 section BSD CONVERSION NOTES below.
55
56 3. Type `make'. Ignore any warnings, no error messages should be produced.
57@@ -1231,7 +1231,7 @@ CONFIGURE OPTIONS:
58 Specify a search-list of terminfo directories which will be compiled
59 into the ncurses library (default: DATADIR/terminfo)
60
61- This is a colon-separated list, like the TERMINFO_DIRS environment
62+ This is a colon-separated list, like the $TERMINFO_DIRS environment
63 variable.
64
65 --with-termlib[=XXX]
66diff --git a/include/curses.events b/include/curses.events
67index 25a2583f..468bde18 100644
68--- a/include/curses.events
69+++ b/include/curses.events
70@@ -50,6 +50,6 @@ typedef struct
71 extern NCURSES_EXPORT(int) wgetch_events (WINDOW *, _nc_eventlist *) GCC_DEPRECATED(experimental option); /* experimental */
72 extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *) GCC_DEPRECATED(experimental option); /* experimental */
73
74-#define KEY_EVENT 0633 /* We were interrupted by an event */
75+#define KEY_EVENT 0634 /* We were interrupted by an event */
76
77 #endif /* NCURSES_WGETCH_EVENTS */
78diff --git a/ncurses/tinfo/lib_tparm.c b/ncurses/tinfo/lib_tparm.c
79index a10a3877..cd972c0f 100644
80--- a/ncurses/tinfo/lib_tparm.c
81+++ b/ncurses/tinfo/lib_tparm.c
82@@ -1113,8 +1113,10 @@ check_string_caps(TPARM_DATA *data, const char *string)
83 want_type = 2; /* function key #1, transmit string #2 */
84 else if (CHECK_CAP(plab_norm))
85 want_type = 2; /* label #1, show string #2 */
86+#ifdef pkey_plab
87 else if (CHECK_CAP(pkey_plab))
88 want_type = 6; /* function key #1, type string #2, show string #3 */
89+#endif
90 #if NCURSES_XNAMES
91 else {
92 char *check;
93diff --git a/progs/reset_cmd.c b/progs/reset_cmd.c
94index eff3af72..aec4b077 100644
95--- a/progs/reset_cmd.c
96+++ b/progs/reset_cmd.c
97@@ -75,6 +75,9 @@ MODULE_ID("$Id: reset_cmd.c,v 1.28 2021/10/02 18:08:44 tom Exp $")
98 # endif
99 #endif
100
101+#define set_flags(target, mask) target |= mask
102+#define clear_flags(target, mask) target &= ~((unsigned)(mask))
103+
104 static FILE *my_file;
105
106 static bool use_reset = FALSE; /* invoked as reset */
107@@ -188,6 +191,79 @@ out_char(int c)
108 #define reset_char(item, value) \
109 tty_settings->c_cc[item] = CHK(tty_settings->c_cc[item], value)
110
111+/*
112+ * Simplify ifdefs
113+ */
114+#ifndef BSDLY
115+#define BSDLY 0
116+#endif
117+#ifndef CRDLY
118+#define CRDLY 0
119+#endif
120+#ifndef ECHOCTL
121+#define ECHOCTL 0
122+#endif
123+#ifndef ECHOKE
124+#define ECHOKE 0
125+#endif
126+#ifndef ECHOPRT
127+#define ECHOPRT 0
128+#endif
129+#ifndef FFDLY
130+#define FFDLY 0
131+#endif
132+#ifndef IMAXBEL
133+#define IMAXBEL 0
134+#endif
135+#ifndef IUCLC
136+#define IUCLC 0
137+#endif
138+#ifndef IXANY
139+#define IXANY 0
140+#endif
141+#ifndef NLDLY
142+#define NLDLY 0
143+#endif
144+#ifndef OCRNL
145+#define OCRNL 0
146+#endif
147+#ifndef OFDEL
148+#define OFDEL 0
149+#endif
150+#ifndef OFILL
151+#define OFILL 0
152+#endif
153+#ifndef OLCUC
154+#define OLCUC 0
155+#endif
156+#ifndef ONLCR
157+#define ONLCR 0
158+#endif
159+#ifndef ONLRET
160+#define ONLRET 0
161+#endif
162+#ifndef ONOCR
163+#define ONOCR 0
164+#endif
165+#ifndef OXTABS
166+#define OXTABS 0
167+#endif
168+#ifndef TAB3
169+#define TAB3 0
170+#endif
171+#ifndef TABDLY
172+#define TABDLY 0
173+#endif
174+#ifndef TOSTOP
175+#define TOSTOP 0
176+#endif
177+#ifndef VTDLY
178+#define VTDLY 0
179+#endif
180+#ifndef XCASE
181+#define XCASE 0
182+#endif
183+
184 /*
185 * Reset the terminal mode bits to a sensible state. Very useful after
186 * a child program dies in raw mode.
187@@ -195,6 +271,10 @@ out_char(int c)
188 void
189 reset_tty_settings(int fd, TTY * tty_settings, int noset)
190 {
191+ unsigned mask;
192+#ifdef TIOCMGET
193+ int modem_bits;
194+#endif
195 GET_TTY(fd, tty_settings);
196
197 #ifdef TERMIOS
198@@ -228,106 +308,65 @@ reset_tty_settings(int fd, TTY * tty_settings, int noset)
199 reset_char(VWERASE, CWERASE);
200 #endif
201
202- tty_settings->c_iflag &= ~((unsigned) (IGNBRK
203- | PARMRK
204- | INPCK
205- | ISTRIP
206- | INLCR
207- | IGNCR
208-#ifdef IUCLC
209- | IUCLC
210-#endif
211-#ifdef IXANY
212- | IXANY
213-#endif
214- | IXOFF));
215-
216- tty_settings->c_iflag |= (BRKINT
217- | IGNPAR
218- | ICRNL
219- | IXON
220-#ifdef IMAXBEL
221- | IMAXBEL
222-#endif
223- );
224-
225- tty_settings->c_oflag &= ~((unsigned) (0
226-#ifdef OLCUC
227- | OLCUC
228-#endif
229-#ifdef OCRNL
230- | OCRNL
231-#endif
232-#ifdef ONOCR
233- | ONOCR
234-#endif
235-#ifdef ONLRET
236- | ONLRET
237-#endif
238-#ifdef OFILL
239- | OFILL
240-#endif
241-#ifdef OFDEL
242- | OFDEL
243-#endif
244-#ifdef NLDLY
245- | NLDLY
246-#endif
247-#ifdef CRDLY
248- | CRDLY
249-#endif
250-#ifdef TABDLY
251- | TABDLY
252-#endif
253-#ifdef BSDLY
254- | BSDLY
255-#endif
256-#ifdef VTDLY
257- | VTDLY
258-#endif
259-#ifdef FFDLY
260- | FFDLY
261-#endif
262- ));
263-
264- tty_settings->c_oflag |= (OPOST
265-#ifdef ONLCR
266- | ONLCR
267-#endif
268- );
269-
270- tty_settings->c_cflag &= ~((unsigned) (CSIZE
271- | CSTOPB
272- | PARENB
273- | PARODD
274- | CLOCAL));
275- tty_settings->c_cflag |= (CS8 | CREAD);
276- tty_settings->c_lflag &= ~((unsigned) (ECHONL
277- | NOFLSH
278-#ifdef TOSTOP
279- | TOSTOP
280-#endif
281-#ifdef ECHOPTR
282- | ECHOPRT
283-#endif
284-#ifdef XCASE
285- | XCASE
286-#endif
287- ));
288-
289- tty_settings->c_lflag |= (ISIG
290- | ICANON
291- | ECHO
292- | ECHOE
293- | ECHOK
294-#ifdef ECHOCTL
295- | ECHOCTL
296-#endif
297-#ifdef ECHOKE
298- | ECHOKE
299-#endif
300- );
301-#endif
302+ clear_flags(tty_settings->c_iflag, (IGNBRK
303+ | PARMRK
304+ | INPCK
305+ | ISTRIP
306+ | INLCR
307+ | IGNCR
308+ | IUCLC
309+ | IXANY
310+ | IXOFF));
311+
312+ set_flags(tty_settings->c_iflag, (BRKINT
313+ | IGNPAR
314+ | ICRNL
315+ | IXON
316+ | IMAXBEL));
317+
318+ clear_flags(tty_settings->c_oflag, (0
319+ | OLCUC
320+ | OCRNL
321+ | ONOCR
322+ | ONLRET
323+ | OFILL
324+ | OFDEL
325+ | NLDLY
326+ | CRDLY
327+ | TABDLY
328+ | BSDLY
329+ | VTDLY
330+ | FFDLY));
331+
332+ set_flags(tty_settings->c_oflag, (OPOST
333+ | ONLCR));
334+
335+ mask = (CSIZE | CSTOPB | PARENB | PARODD);
336+#ifdef TIOCMGET
337+ /* leave clocal alone if this appears to use a modem */
338+ if (ioctl(fd, TIOCMGET, &modem_bits) == -1)
339+ mask |= CLOCAL;
340+#else
341+ /* cannot check - use the behavior from tset */
342+ mask |= CLOCAL;
343+#endif
344+ clear_flags(tty_settings->c_cflag, mask);
345+
346+ set_flags(tty_settings->c_cflag, (CS8 | CREAD));
347+ clear_flags(tty_settings->c_lflag, (ECHONL
348+ | NOFLSH
349+ | TOSTOP
350+ | ECHOPRT
351+ | XCASE));
352+
353+ set_flags(tty_settings->c_lflag, (ISIG
354+ | ICANON
355+ | ECHO
356+ | ECHOE
357+ | ECHOK
358+ | ECHOCTL
359+ | ECHOKE));
360+#endif /* TERMIOS */
361
362 if (!noset) {
363 SET_TTY(fd, tty_settings);
364@@ -402,29 +441,23 @@ set_conversions(TTY * tty_settings)
365 #if defined(EXP_WIN32_DRIVER)
366 /* FIXME */
367 #else
368-#ifdef ONLCR
369- tty_settings->c_oflag |= ONLCR;
370-#endif
371- tty_settings->c_iflag |= ICRNL;
372- tty_settings->c_lflag |= ECHO;
373-#ifdef OXTABS
374- tty_settings->c_oflag |= OXTABS;
375-#endif /* OXTABS */
376+ set_flags(tty_settings->c_oflag, ONLCR);
377+ set_flags(tty_settings->c_iflag, ICRNL);
378+ set_flags(tty_settings->c_lflag, ECHO);
379+ set_flags(tty_settings->c_oflag, OXTABS);
380
381 /* test used to be tgetflag("NL") */
382 if (VALID_STRING(newline) && newline[0] == '\n' && !newline[1]) {
383 /* Newline, not linefeed. */
384-#ifdef ONLCR
385- tty_settings->c_oflag &= ~((unsigned) ONLCR);
386-#endif
387- tty_settings->c_iflag &= ~((unsigned) ICRNL);
388+ clear_flags(tty_settings->c_oflag, ONLCR);
389+ clear_flags(tty_settings->c_iflag, ICRNL);
390 }
391-#ifdef OXTABS
392+#if OXTABS
393 /* test used to be tgetflag("pt") */
394 if (VALID_STRING(set_tab) && VALID_STRING(clear_all_tabs))
395- tty_settings->c_oflag &= ~OXTABS;
396+ clear_flags(tty_settings->c_oflag, OXTABS);
397 #endif /* OXTABS */
398- tty_settings->c_lflag |= (ECHOE | ECHOK);
399+ set_flags(tty_settings->c_lflag, (ECHOE | ECHOK));
400 #endif
401 }
402
403@@ -490,7 +523,7 @@ send_init_strings(int fd GCC_UNUSED, TTY * old_settings)
404 bool need_flush = FALSE;
405
406 (void) old_settings;
407-#ifdef TAB3
408+#if TAB3
409 if (old_settings != 0 &&
410 old_settings->c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) {
411 old_settings->c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET);
412@@ -512,22 +545,22 @@ send_init_strings(int fd GCC_UNUSED, TTY * old_settings)
413
414 if (VALID_STRING(clear_margins)) {
415 need_flush |= sent_string(clear_margins);
416- } else
417+ }
418 #if defined(set_lr_margin)
419- if (VALID_STRING(set_lr_margin)) {
420+ else if (VALID_STRING(set_lr_margin)) {
421 need_flush |= sent_string(TIPARM_2(set_lr_margin, 0, columns - 1));
422- } else
423+ }
424 #endif
425 #if defined(set_left_margin_parm) && defined(set_right_margin_parm)
426- if (VALID_STRING(set_left_margin_parm)
427- && VALID_STRING(set_right_margin_parm)) {
428+ else if (VALID_STRING(set_left_margin_parm)
429+ && VALID_STRING(set_right_margin_parm)) {
430 need_flush |= sent_string(TIPARM_1(set_left_margin_parm, 0));
431 need_flush |= sent_string(TIPARM_1(set_right_margin_parm,
432 columns - 1));
433- } else
434+ }
435 #endif
436- if (VALID_STRING(set_left_margin)
437- && VALID_STRING(set_right_margin)) {
438+ else if (VALID_STRING(set_left_margin)
439+ && VALID_STRING(set_right_margin)) {
440 need_flush |= to_left_margin();
441 need_flush |= sent_string(set_left_margin);
442 if (VALID_STRING(parm_right_cursor)) {
443diff --git a/progs/tabs.c b/progs/tabs.c
444index 7378d116..d904330b 100644
445--- a/progs/tabs.c
446+++ b/progs/tabs.c
447@@ -370,7 +370,9 @@ do_set_margin(int margin, bool no_op)
448 }
449 tputs(set_left_margin, 1, putch);
450 }
451- } else if (VALID_STRING(set_left_margin_parm)) {
452+ }
453+#if defined(set_left_margin_parm) && defined(set_right_margin_parm)
454+ else if (VALID_STRING(set_left_margin_parm)) {
455 result = TRUE;
456 if (!no_op) {
457 if (VALID_STRING(set_right_margin_parm)) {
458@@ -379,12 +381,16 @@ do_set_margin(int margin, bool no_op)
459 tputs(TIPARM_2(set_left_margin_parm, margin, max_cols), 1, putch);
460 }
461 }
462- } else if (VALID_STRING(set_lr_margin)) {
463+ }
464+#endif
465+#if defined(set_lr_margin)
466+ else if (VALID_STRING(set_lr_margin)) {
467 result = TRUE;
468 if (!no_op) {
469 tputs(TIPARM_2(set_lr_margin, margin, max_cols), 1, putch);
470 }
471 }
472+#endif
473 return result;
474 }
475
476diff --git a/progs/tic.c b/progs/tic.c
477index 888927e2..78b568fa 100644
478--- a/progs/tic.c
479+++ b/progs/tic.c
480@@ -3142,6 +3142,7 @@ guess_ANSI_VTxx(TERMTYPE2 *tp)
481 * In particular, any ECMA-48 terminal should support these, though the details
482 * for u9 are implementation dependent.
483 */
484+#if defined(user6) && defined(user7) && defined(user8) && defined(user9)
485 static void
486 check_user_6789(TERMTYPE2 *tp)
487 {
488@@ -3177,6 +3178,9 @@ check_user_6789(TERMTYPE2 *tp)
489 break;
490 }
491 }
492+#else
493+#define check_user_6789(tp) /* nothing */
494+#endif
495
496 /* other sanity-checks (things that we don't want in the normal
497 * logic that reads a terminfo entry)
498--
4992.40.0