]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_setup.c
ncurses 6.1 - patch 20190406
[ncurses.git] / ncurses / tinfo / lib_setup.c
index 16f05ae0b1a201d586cbc0986a1b4e002cfbae58..3d99d9da538dc1b919361581d587b5caf6fef5ff 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * 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            *
@@ -48,7 +48,7 @@
 #include <locale.h>
 #endif
 
-MODULE_ID("$Id: lib_setup.c,v 1.195 2018/09/01 21:16:23 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.199 2019/03/23 23:42:20 tom Exp $")
 
 /****************************************************************************
  *
@@ -715,12 +715,20 @@ TINFO_SETUP_TERM(TERMINAL **tp,
                       "Not enough memory to create terminal structure.\n");
        }
 #if HAVE_SYSCONF
+       {
+           long limit;
 #ifdef LINE_MAX
-       _nc_globals.getstr_limit = LINE_MAX;
+           limit = LINE_MAX;
+#else
+           limit = _nc_globals.getstr_limit;
 #endif
 #ifdef _SC_LINE_MAX
-       _nc_globals.getstr_limit = sysconf(_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));
 
@@ -738,7 +746,9 @@ TINFO_SETUP_TERM(TERMINAL **tp,
 #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
 
@@ -747,7 +757,8 @@ TINFO_SETUP_TERM(TERMINAL **tp,
            const TERMTYPE2 *fallback = _nc_fallback2(tname);
 
            if (fallback) {
-               TerminalType(termp) = *fallback;
+               T(("found fallback entry"));
+               _nc_copy_termtype2(&(TerminalType(termp)), fallback);
                status = TGETENT_YES;
            }
        }