]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_setup.c
ncurses 6.1 - patch 20180901
[ncurses.git] / ncurses / tinfo / lib_setup.c
index 298f08ecd4a94eb074ef6c254ff032c868075d06..16f05ae0b1a201d586cbc0986a1b4e002cfbae58 100644 (file)
@@ -48,7 +48,7 @@
 #include <locale.h>
 #endif
 
 #include <locale.h>
 #endif
 
-MODULE_ID("$Id: lib_setup.c,v 1.192 2018/04/07 21:10:20 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.195 2018/09/01 21:16:23 tom Exp $")
 
 /****************************************************************************
  *
 
 /****************************************************************************
  *
@@ -543,9 +543,9 @@ _nc_get_locale(void)
      */
     env = setlocale(LC_CTYPE, 0);
 #else
      */
     env = setlocale(LC_CTYPE, 0);
 #else
-    if (((env = getenv("LC_ALL")) != 0 && *env != '\0')
+    if (((env = getenv("LANG")) != 0 && *env != '\0')
        || ((env = getenv("LC_CTYPE")) != 0 && *env != '\0')
        || ((env = getenv("LC_CTYPE")) != 0 && *env != '\0')
-       || ((env = getenv("LANG")) != 0 && *env != '\0')) {
+       || ((env = getenv("LC_ALL")) != 0 && *env != '\0')) {
        ;
     }
 #endif
        ;
     }
 #endif
@@ -560,7 +560,7 @@ NCURSES_EXPORT(int)
 _nc_unicode_locale(void)
 {
     int result = 0;
 _nc_unicode_locale(void)
 {
     int result = 0;
-#if defined(__MINGW32__) && USE_WIDEC_SUPPORT
+#if defined(_WIN32) && USE_WIDEC_SUPPORT
     result = 1;
 #elif HAVE_LANGINFO_CODESET
     char *env = nl_langinfo(CODESET);
     result = 1;
 #elif HAVE_LANGINFO_CODESET
     char *env = nl_langinfo(CODESET);
@@ -714,6 +714,16 @@ TINFO_SETUP_TERM(TERMINAL **tp,
            ret_error0(TGETENT_ERR,
                       "Not enough memory to create terminal structure.\n");
        }
            ret_error0(TGETENT_ERR,
                       "Not enough memory to create terminal structure.\n");
        }
+#if HAVE_SYSCONF
+#ifdef LINE_MAX
+       _nc_globals.getstr_limit = LINE_MAX;
+#endif
+#ifdef _SC_LINE_MAX
+       _nc_globals.getstr_limit = sysconf(_SC_LINE_MAX);
+#endif
+#endif /* HAVE_SYSCONF */
+       T(("using %d for getstr limit", _nc_globals.getstr_limit));
+
 #ifdef USE_TERM_DRIVER
        INIT_TERM_DRIVER();
        TCB = (TERMINAL_CONTROL_BLOCK *) termp;
 #ifdef USE_TERM_DRIVER
        INIT_TERM_DRIVER();
        TCB = (TERMINAL_CONTROL_BLOCK *) termp;