Re: Texinfo 7.2.90 build with mingw.org's MinGW: cleanups in Info
Eli Zaretskii <[email protected]>
| Newsgroups | gmane.comp.tex.texinfo.bugs |
|---|---|
| Message-ID | <[email protected]> |
> Date: Thu, 15 Jan 2026 03:24:29 +0100 > From: Patrice Dumas <[email protected]> > Cc: [email protected], [email protected] > > On Wed, Jan 14, 2026 at 07:04:07PM +0200, Eli Zaretskii wrote: > > The following problems are with compilation in tta/ > > Thanks for the reports and code, it is committed. Thanks. Here are a few more minor MinGW-related cleanups, which: . remove code no longer needed . move function redirections to where the functions are used . avoid compiler warnings due to mismatch in function signatures . return "UTF-8" when the Windows terminal uses UTF-8 encoding --- ./info/pcterm.c~0 2026-01-01 20:44:32.000000000 +0200 +++ ./info/pcterm.c 2026-01-15 14:12:42.482833700 +0200 @@ -827,33 +827,26 @@ rpl_nl_langinfo (nl_item item) if (item == CODESET) { static char buf[100]; + UINT console_cp = GetConsoleOutputCP (); - /* We need all the help we can get from GNU libiconv, so we - request transliteration as well. */ - sprintf (buf, "CP%u//TRANSLIT", GetConsoleOutputCP ()); + /* The rest of the code wants to see "UTF-8" and nothing else. */ + if (console_cp == CP_UTF8) + memcpy (buf, "UTF-8", sizeof "UTF-8"); + else if (console_cp == CP_UTF7) + sprintf (buf, "CP%u", console_cp); + else + { + /* For non-UTF output encoding, we need all the help we can + get from GNU libiconv, so we request transliteration as + well. */ + sprintf (buf, "CP%u//TRANSLIT", console_cp); + } return buf; } else return nl_langinfo (item); } -#ifndef HAVE_WCWIDTH -/* A replacement for wcwidth. The Gnulib version calls setlocale for - every character Info is about to display, which makes display of - large nodes annoyingly slow. - - Note that the Gnulib version is still compiled and put into - libgnu.a, because the configure script doesn't know about this - replacement. But the linker will not pull the Gnulib version into - the binary, because it resolves the calls to this replacement - function. */ -int -wcwidth (wchar_t wc) -{ - return wc == 0 ? 0 : iswprint (wc) ? 1 : -1; -} -#endif - #endif /* _WIN32 */ /* Turn on reverse video. */ @@ -1019,7 +1012,7 @@ pc_goto_xy (int x, int y) /* Print STRING to the terminal at the current position. */ static void -pc_put_text (char *string) +pc_put_text (const char *string) { if (speech_friendly) fputs (string, stdout); @@ -1049,7 +1042,7 @@ pc_ring_bell (void) /* Print NCHARS from STRING to the terminal at the current position. */ static void -pc_write_chars (char *string, int nchars) +pc_write_chars (const char *string, int nchars) { if (!nchars) return; --- ./info/scan.c~0 2026-01-01 20:44:32.000000000 +0200 +++ ./info/scan.c 2026-01-15 11:41:26.866369500 +0200 @@ -29,6 +29,12 @@ # include <iconv.h> #endif +#ifdef __MINGW32__ +/* MinGW uses a replacement nl_langinfo, see pcterm.c. */ +# define nl_langinfo rpl_nl_langinfo +extern char * rpl_nl_langinfo (nl_item); +#endif + /* Variable which holds the most recent filename parsed as a result of calling info_parse_xxx (). */ char *info_parsed_filename = NULL; --- ./info/util.c~0 2026-01-01 20:44:32.000000000 +0200 +++ ./info/util.c 2026-01-15 11:41:37.002359100 +0200 @@ -18,17 +18,6 @@ #include "info.h" #include "util.h" -#include <wchar.h> -#ifdef __MINGW32__ -/* MinGW uses a replacement nl_langinfo, see pcterm.c. */ -# define nl_langinfo rpl_nl_langinfo -extern char * rpl_nl_langinfo (nl_item); -/* MinGW uses its own replacement wcwidth, see pcterm.c for the - reasons. Since Gnulib's wchar.h might redirect wcwidth to - rpl_wcwidth, we explicitly undo that here. */ -#undef wcwidth -#endif - /* wrapper for asprintf */ static int xvasprintf (char **ptr, const char *template, va_list ap)