#include <locale.h>
#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 $")
/****************************************************************************
*
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;
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.
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) {
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