X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_setup.c;h=d00ecb0ab567dcc2aef0c022e9e3a1354e7dae85;hp=1cc367cd4c4e62c6b40b503a31282d1cf32d7a16;hb=fb24ca09eab8f14b9be7ea60acf174aae46df43d;hpb=8fc9fa113b27e0749e0840fef04c9d4acad4aae7 diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c index 1cc367cd..d00ecb0a 100644 --- a/ncurses/tinfo/lib_setup.c +++ b/ncurses/tinfo/lib_setup.c @@ -52,7 +52,7 @@ #include #endif -MODULE_ID("$Id: lib_setup.c,v 1.119 2009/09/05 20:10:02 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.123 2009/10/31 20:39:36 tom Exp $") /**************************************************************************** * @@ -224,7 +224,7 @@ _nc_handle_sigwinch(SCREEN *sp) NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (NCURSES_SP_DCLx bool f) { - T((T_CALLED("use_env(%p,%d)"), SP_PARM, (int) f)); + T((T_CALLED("use_env(%p,%d)"), (void *) SP_PARM, (int) f)); #if NCURSES_SP_FUNCS if (IsPreScreen(SP_PARM)) { SP_PARM->_use_env = f; @@ -465,35 +465,34 @@ grab_entry(const char *const tn, TERMTYPE *const tp) return (status); } #endif +#endif /* !USE_TERM_DRIVER */ /* -** do_prototype() -** ** Take the real command character out of the CC environment variable ** and substitute it in for the prototype given in 'command_character'. */ -static void -do_prototype(TERMINAL * termp) +void +_nc_tinfo_cmdch(TERMINAL * termp, char proto) { unsigned i; char CC; - char proto; char *tmp; - if ((tmp = getenv("CC")) != 0) { - if ((CC = *tmp) != 0) { - proto = *command_character; - - for_each_string(i, &(termp->type)) { - for (tmp = termp->type.Strings[i]; *tmp; tmp++) { - if (*tmp == proto) - *tmp = CC; - } + /* + * Only use the character if the string is a single character, + * since it is fairly common for developers to set the C compiler + * name as an environment variable - using the same symbol. + */ + if ((tmp = getenv("CC")) != 0 && strlen(tmp) == 1) { + CC = *tmp; + for_each_string(i, &(termp->type)) { + for (tmp = termp->type.Strings[i]; *tmp; tmp++) { + if (*tmp == proto) + *tmp = CC; } } } } -#endif /* !USE_TERM_DRIVER */ /* * Find the locale which is in effect. @@ -602,7 +601,7 @@ TINFO_SETUP_TERM(TERMINAL ** tp, termp = *tp; #else termp = cur_term; - T((T_CALLED("setupterm(%s,%d,%p)"), _nc_visbuf(tname), Filedes, errret)); + T((T_CALLED("setupterm(%s,%d,%p)"), _nc_visbuf(tname), Filedes, (void *) errret)); #endif if (tname == 0) { @@ -706,8 +705,8 @@ TINFO_SETUP_TERM(TERMINAL ** tp, set_curterm(termp); - if (command_character && getenv("CC")) - do_prototype(termp); + if (command_character) + _nc_tinfo_cmdch(termp, *command_character); /* * If an application calls setupterm() rather than initscr() or