]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_setup.c
ncurses 5.8 - patch 20110307
[ncurses.git] / ncurses / tinfo / lib_setup.c
index 378fd940d04fcf7fdecfe5bcd83c655993a830a0..5fcf2ae3fc32f48c3229455978471fd6043b1249 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -51,7 +51,7 @@
 #include <locale.h>
 #endif
 
-MODULE_ID("$Id: lib_setup.c,v 1.132 2010/12/20 00:26:35 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.135 2011/02/06 01:04:21 tom Exp $")
 
 /****************************************************************************
  *
@@ -546,25 +546,31 @@ _nc_unicode_locale(void)
 NCURSES_EXPORT(int)
 _nc_locale_breaks_acs(TERMINAL * termp)
 {
+    const char *env_name = "NCURSES_NO_UTF8_ACS";
     char *env;
+    int value;
+    int result = 0;
 
-    if ((env = getenv("NCURSES_NO_UTF8_ACS")) != 0) {
-       return atoi(env);
+    if ((env = getenv(env_name)) != 0) {
+       result = _nc_getenv_num(env_name);
+    } else if ((value = tigetnum("U8")) >= 0) {
+       result = value;         /* use extension feature */
     } else if ((env = getenv("TERM")) != 0) {
-       if (strstr(env, "linux"))
-           return 1;           /* always broken */
-       if (strstr(env, "screen") != 0
-           && ((env = getenv("TERMCAP")) != 0
-               && strstr(env, "screen") != 0)
-           && strstr(env, "hhII00") != 0) {
+       if (strstr(env, "linux")) {
+           result = 1;         /* always broken */
+       } else if (strstr(env, "screen") != 0
+                  && ((env = getenv("TERMCAP")) != 0
+                      && strstr(env, "screen") != 0)
+                  && strstr(env, "hhII00") != 0) {
            if (CONTROL_N(enter_alt_charset_mode) ||
                CONTROL_O(enter_alt_charset_mode) ||
                CONTROL_N(set_attributes) ||
-               CONTROL_O(set_attributes))
-               return 1;
+               CONTROL_O(set_attributes)) {
+               result = 1;
+           }
        }
     }
-    return 0;
+    return result;
 }
 
 NCURSES_EXPORT(int)