X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_setup.c;h=e90a5467c4a89838ef8ae5813bb4665f9bfca435;hb=093902b4199bbc1d9afec433759e48344c06ed1a;hp=b7937da2291ccd2c2583e9f6e540337fc14b4fca;hpb=5da4544722decdeb2bfd0c7c4581af0ea62148f9;p=ncurses.git diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c index b7937da2..e90a5467 100644 --- a/ncurses/tinfo/lib_setup.c +++ b/ncurses/tinfo/lib_setup.c @@ -48,7 +48,7 @@ #include #endif -MODULE_ID("$Id: lib_setup.c,v 1.193 2018/06/23 21:35:06 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.196 2018/09/08 20:14:26 tom Exp $") /**************************************************************************** * @@ -543,9 +543,9 @@ _nc_get_locale(void) */ 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("LANG")) != 0 && *env != '\0')) { + || ((env = getenv("LC_ALL")) != 0 && *env != '\0')) { ; } #endif @@ -714,6 +714,24 @@ TINFO_SETUP_TERM(TERMINAL **tp, ret_error0(TGETENT_ERR, "Not enough memory to create terminal structure.\n"); } +#if HAVE_SYSCONF + { + long limit; +#ifdef LINE_MAX + limit = LINE_MAX; +#else + limit = _nc_globals.getstr_limit; +#endif +#ifdef _SC_LINE_MAX + if (limit < sysconf(_SC_LINE_MAX)) + limit = sysconf(_SC_LINE_MAX); +#endif + if (_nc_globals.getstr_limit < (int) limit) + _nc_globals.getstr_limit = (int) limit; + } +#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;