X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_termcap.c;h=5e7430733b5de2a6b1e148faab0ad1a4e875eac5;hp=92cd451b878d9e492e2457eff4f6ee0961878073;hb=a5c5f83f5704909b0fcbfc2668d664cded977ff8;hpb=8fc9fa113b27e0749e0840fef04c9d4acad4aae7 diff --git a/ncurses/tinfo/lib_termcap.c b/ncurses/tinfo/lib_termcap.c index 92cd451b..5e743073 100644 --- a/ncurses/tinfo/lib_termcap.c +++ b/ncurses/tinfo/lib_termcap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 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 * @@ -44,13 +44,11 @@ #include #include -#include - #ifndef CUR #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_termcap.c,v 1.70 2009/08/30 17:16:00 tom Exp $") +MODULE_ID("$Id: lib_termcap.c,v 1.78 2012/02/22 22:34:31 tom Exp $") NCURSES_EXPORT_VAR(char *) UP = 0; NCURSES_EXPORT_VAR(char *) BC = 0; @@ -83,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 @@ -94,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 /* @@ -154,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) @@ -189,7 +187,7 @@ NCURSES_SP_NAME(tgetent) (NCURSES_SP_DCLx char *bufp, const char *name) #endif*/ } - returnCode(errcode); + returnCode(rc); } #if NCURSES_SP_FUNCS @@ -205,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 /*************************************************************************** @@ -226,7 +225,7 @@ NCURSES_SP_NAME(tgetflag) (NCURSES_SP_DCLx NCURSES_CONST char *id) int result = 0; /* Solaris returns zero for missing flag */ int i, j; - T((T_CALLED("tgetflag(%p, %s)"), SP_PARM, id)); + T((T_CALLED("tgetflag(%p, %s)"), (void *) SP_PARM, id)); if (HasTInfoTerminal(SP_PARM)) { TERMTYPE *tp = &(TerminalOf(SP_PARM)->type); struct name_table_entry const *entry_ptr; @@ -278,7 +277,7 @@ NCURSES_SP_NAME(tgetnum) (NCURSES_SP_DCLx NCURSES_CONST char *id) int result = ABSENT_NUMERIC; int i, j; - T((T_CALLED("tgetnum(%p, %s)"), SP_PARM, id)); + T((T_CALLED("tgetnum(%p, %s)"), (void *) SP_PARM, id)); if (HasTInfoTerminal(SP_PARM)) { TERMTYPE *tp = &(TerminalOf(SP_PARM)->type); struct name_table_entry const *entry_ptr; @@ -330,7 +329,7 @@ NCURSES_SP_NAME(tgetstr) (NCURSES_SP_DCLx NCURSES_CONST char *id, char **area) char *result = NULL; int i, j; - T((T_CALLED("tgetstr(%s,%p)"), id, area)); + T((T_CALLED("tgetstr(%s,%p)"), id, (void *) area)); if (HasTInfoTerminal(SP_PARM)) { TERMTYPE *tp = &(TerminalOf(SP_PARM)->type); struct name_table_entry const *entry_ptr; @@ -353,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 @@ -363,7 +362,7 @@ NCURSES_SP_NAME(tgetstr) (NCURSES_SP_DCLx NCURSES_CONST char *id, char **area) } if (area != 0 && *area != 0) { - (void) strcpy(*area, result); + _nc_STRCPY(*area, result, 1024); result = *area; *area += strlen(*area) + 1; }