Hello Werner,
> you've added the following code to groff's src/include/lib.h:
>
> #ifdef HAVE_SETLOCALE
> #include <locale.h>
> #else
> #define setlocale(category, locale) do {} while(0)
> #endif
>
> but this doesn't work if `HAVE_SETLOCALE' isn't defined, because in
> preconv.cpp we have this:
>
> setlocale(LC_ALL, "");
> char *locale = setlocale(LC_CTYPE, NULL); // <----
> if (!locale || !strcmp(locale, "C") || !strcmp(locale, "POSIX"))
> default_encoding = "latin1";
> else
> default_encoding = locale_charset();
>
> What do you recommend as a fix?
I would introduce a macro that reflects the semantics that you want to
use in preconv.cpp. Let's call it 'getlocale'.
#ifdef HAVE_SETLOCALE
#include <locale.h>
#define getlocale(category) setlocale(category, NULL)
#else
#define setlocale(category, locale) (void)(category, locale)
#define getlocale(category) ((void)(category), "C")
#endif
Bruno
_______________________________________________
Groff mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/groff