]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_setup.c
ncurses 5.9 - patch 20120903
[ncurses.git] / ncurses / tinfo / lib_setup.c
index ff5857b3730990d33e767d4df9cc8e5aa44eace6..51030b6b4f03069c280ccb85bd4aa63301979012 100644 (file)
@@ -48,7 +48,7 @@
 #include <locale.h>
 #endif
 
-MODULE_ID("$Id: lib_setup.c,v 1.147 2012/07/14 23:59:26 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.149 2012/09/03 16:19:14 tom Exp $")
 
 /****************************************************************************
  *
@@ -304,7 +304,7 @@ _nc_get_screensize(SCREEN *sp,
     *linep = (int) lines;
     *colp = (int) columns;
 
-    if (_nc_prescreen.use_env) {
+    if (_nc_prescreen.use_env || _nc_prescreen.use_tioctl) {
        int value;
 
 #ifdef __EMX__
@@ -340,33 +340,35 @@ _nc_get_screensize(SCREEN *sp,
        }
 #endif /* HAVE_SIZECHANGE */
 
-       if (_nc_prescreen.use_tioctl) {
+       if (_nc_prescreen.use_env) {
+           if (_nc_prescreen.use_tioctl) {
+               /*
+                * If environment variables are used, update them.
+                */
+               if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) {
+                   _nc_setenv_num("LINES", *linep);
+               }
+               if (_nc_getenv_num("COLUMNS") > 0) {
+                   _nc_setenv_num("COLUMNS", *colp);
+               }
+           }
+
            /*
-            * If environment variables are used, update them.
+            * Finally, look for environment variables.
+            *
+            * Solaris lets users override either dimension with an environment
+            * variable.
             */
-           if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) {
-               _nc_setenv_num("LINES", *linep);
+           if ((value = _nc_getenv_num("LINES")) > 0) {
+               *linep = value;
+               T(("screen size: environment LINES = %d", *linep));
            }
-           if (_nc_getenv_num("COLUMNS") > 0) {
-               _nc_setenv_num("COLUMNS", *colp);
+           if ((value = _nc_getenv_num("COLUMNS")) > 0) {
+               *colp = value;
+               T(("screen size: environment COLUMNS = %d", *colp));
            }
        }
 
-       /*
-        * Finally, look for environment variables.
-        *
-        * Solaris lets users override either dimension with an environment
-        * variable.
-        */
-       if ((value = _nc_getenv_num("LINES")) > 0) {
-           *linep = value;
-           T(("screen size: environment LINES = %d", *linep));
-       }
-       if ((value = _nc_getenv_num("COLUMNS")) > 0) {
-           *colp = value;
-           T(("screen size: environment COLUMNS = %d", *colp));
-       }
-
        /* if we can't get dynamic info about the size, use static */
        if (*linep <= 0) {
            *linep = (int) lines;
@@ -544,7 +546,9 @@ NCURSES_EXPORT(int)
 _nc_unicode_locale(void)
 {
     int result = 0;
-#if HAVE_LANGINFO_CODESET
+#if defined(__MINGW32__) && USE_WIDEC_SUPPORT
+    result = 1;
+#elif HAVE_LANGINFO_CODESET
     char *env = nl_langinfo(CODESET);
     result = !strcmp(env, "UTF-8");
     T(("_nc_unicode_locale(%s) ->%d", env, result));