]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_termcap.c
ncurses 5.9 - patch 20111022
[ncurses.git] / ncurses / tinfo / lib_termcap.c
index bd84a094fb66583317964dd358f3b3ebc7d9d735..4d42307519f1fbe0f5d47f7404f037908c703ec2 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            *
@@ -48,7 +48,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_termcap.c,v 1.72 2010/01/23 17:57:43 tom Exp $")
+MODULE_ID("$Id: lib_termcap.c,v 1.76 2011/10/22 17:12:41 tom Exp $")
 
 NCURSES_EXPORT_VAR(char *) UP = 0;
 NCURSES_EXPORT_VAR(char *) BC = 0;
@@ -81,7 +81,7 @@ NCURSES_EXPORT_VAR(char *) BC = 0;
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(tgetent) (NCURSES_SP_DCLx char *bufp, const char *name)
 {
-    int errcode = ERR;
+    int rc = ERR;
     int n;
     bool found_cache = FALSE;
 #ifdef USE_TERM_DRIVER
@@ -92,12 +92,12 @@ NCURSES_SP_NAME(tgetent) (NCURSES_SP_DCLx char *bufp, const char *name)
     T((T_CALLED("tgetent()")));
 
     TINFO_SETUP_TERM(&termp, (NCURSES_CONST char *) name,
-                    STDOUT_FILENO, &errcode, TRUE);
+                    STDOUT_FILENO, &rc, TRUE);
 
 #ifdef USE_TERM_DRIVER
     if (termp == 0 ||
        !((TERMINAL_CONTROL_BLOCK *) termp)->drv->isTerminfo)
-       return (errcode);
+       returnCode(rc);
 #endif
 
     /*
@@ -152,7 +152,7 @@ NCURSES_SP_NAME(tgetent) (NCURSES_SP_DCLx char *bufp, const char *name)
     BC = 0;
     FIX_SGR0 = 0;              /* don't free it - application may still use */
 
-    if (errcode == 1) {
+    if (rc == 1) {
 
        if (cursor_left)
            if ((backspaces_with_bs = (char) !strcmp(cursor_left, "\b")) == 0)
@@ -187,7 +187,7 @@ NCURSES_SP_NAME(tgetent) (NCURSES_SP_DCLx char *bufp, const char *name)
 #endif*/
 
     }
-    returnCode(errcode);
+    returnCode(rc);
 }
 
 #if NCURSES_SP_FUNCS
@@ -203,10 +203,11 @@ static bool
 same_tcname(const char *a, const char *b)
 {
     fprintf(stderr, "compare(%s,%s)\n", a, b);
-    return !strncmp(a, b, 2);
+    return !strncmp(a, b, (size_t) 2);
 }
+
 #else
-#define same_tcname(a,b) !strncmp(a,b,2)
+#define same_tcname(a,b) !strncmp(a, b, (size_t) 2)
 #endif
 
 /***************************************************************************
@@ -351,7 +352,7 @@ NCURSES_SP_NAME(tgetstr) (NCURSES_SP_DCLx NCURSES_CONST char *id, char **area)
 #endif
        if (j >= 0) {
            result = tp->Strings[j];
-           TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(result)));
+           TR(TRACE_DATABASE, ("found match %d: %s", j, _nc_visbuf(result)));
            /* setupterm forces canceled strings to null */
            if (VALID_STRING(result)) {
                if (result == exit_attribute_mode