/****************************************************************************
- * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
#include <locale.h>
#endif
-MODULE_ID("$Id: lib_setup.c,v 1.191 2018/03/04 01:06:34 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.199 2019/03/23 23:42:20 tom Exp $")
/****************************************************************************
*
*/
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
_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);
NCURSES_EXPORT(int)
TINFO_SETUP_TERM(TERMINAL **tp,
- NCURSES_CONST char *tname,
+ const char *tname,
int Filedes,
int *errret,
int reuse)
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;
#else
#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP
status = _nc_setup_tinfo(tname, &TerminalType(termp));
+ T(("_nc_setup_tinfo returns %d", status));
#else
+ T(("no database available"));
status = TGETENT_NO;
#endif
const TERMTYPE2 *fallback = _nc_fallback2(tname);
if (fallback) {
- TerminalType(termp) = *fallback;
+ T(("found fallback entry"));
+ _nc_copy_termtype2(&(TerminalType(termp)), fallback);
status = TGETENT_YES;
}
}
* the same TERMINAL data (see comment).
*/
NCURSES_EXPORT(int)
-_nc_setupterm(NCURSES_CONST char *tname,
+_nc_setupterm(const char *tname,
int Filedes,
int *errret,
int reuse)
* Make cur_term point to the structure.
*/
NCURSES_EXPORT(int)
-setupterm(NCURSES_CONST char *tname, int Filedes, int *errret)
+setupterm(const char *tname, int Filedes, int *errret)
{
START_TRACE();
return _nc_setupterm(tname, Filedes, errret, FALSE);