i686-w64-mingw32-gcc: LC_MESSAGES

Lee ler762@gmail.com
Tue Jan 8 21:26:00 GMT 2019


http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
has a note for LC_MESSAGES:
  The functionality described is an extension to the ISO C standard.
  Application developers may make use of an extension as it is
  supported on all POSIX.1-2017-conforming systems.

i686-w64-mingw32-gcc doesn't have LC_MESSAGES defined.
Is that an oversight, something missing in windows, or .. ??


$ cat lcmessages.c
#include <stdio.h>
#include <locale.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, char **argv )
{
  char *s, *lang;
  lang = getenv("LANG");
  printf("  LANG=%s  initial locale: %s\n", lang, setlocale(LC_ALL, NULL));

  s = setlocale(LC_ALL, "");
  printf("after 'setlocale(LC_ALL, \"\");'                 locale=%s\n", s);
#ifdef LC_MESSAGES
  s = setlocale(LC_MESSAGES, "de_DE.utf8");
  printf("after 'setlocale(LC_MESSAGES, \"de_DE.utf8\");'
locale=%s\n", setlocale(LC_ALL, NULL));
#else
  printf("LC_MESSAGES is not defined\n");
#endif
}

$ gcc lcmessages.c

$ ./a
  LANG=en_US.UTF-8  initial locale: C
after 'setlocale(LC_ALL, "");'
locale=C/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8
after 'setlocale(LC_MESSAGES, "de_DE.utf8");'
locale=C/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/de_DE.utf8

$ i686-w64-mingw32-gcc lcmessages.c

$ ./a
  LANG=en_US.UTF-8  initial locale: C
after 'setlocale(LC_ALL, "");'                 locale=English_United States.1252
LC_MESSAGES is not defined

Thanks,
Lee

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list