Fix output when client is built against termcap.

The pointer passed to tgetstr() must not be reset each time around the loop.
Also some other minor cleanups in term_init().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@428 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2013-11-01 13:06:02 +00:00
parent 8e8a4022f9
commit 456a0061f0
2 changed files with 10 additions and 19 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2c01]
* Fix output when built against termcap. (caf)
* Fix STATUS_NOTIFY so that it appears in the right window. (caf)
* Improve robustness of status formats handling. (caf)

View File

@@ -797,9 +797,6 @@ PROCESS_INFORMATION pi = { 0 };
#endif /* STERM_C */
#endif /* NOT IN WTERM_C */
/*
* term_init: does all terminal initialization... reads termcap info, sets
* the terminal to CBREAK, no ECHO mode. Chooses the best of the terminal
@@ -812,9 +809,9 @@ int termfeatures = 0;
int term_init (char *term)
{
#ifndef WTERM_C
int i;
int desired;
int i;
int desired;
char *termcap2_ptr = termcap2;
#if !defined(__EMX__) && !defined(WINNT) && !defined(GUI)
memset(current_term, 0, sizeof(struct term_struct));
@@ -852,28 +849,20 @@ int term_init (char *term)
for (i = 0; i < numcaps; i++)
{
int ival;
char *cval;
if (tcaps[i].type == CAP_TYPE_INT)
{
ival = Tgetnum(tcaps[i]);
*(int *)tcaps[i].ptr = ival;
*(int *)tcaps[i].ptr = Tgetnum(tcaps[i]);
}
else if (tcaps[i].type == CAP_TYPE_BOOL)
{
ival = Tgetflag(tcaps[i]);
*(int *)tcaps[i].ptr = ival;
*(int *)tcaps[i].ptr = Tgetflag(tcaps[i]);
}
else
{
char *tmp = termcap2;
cval = Tgetstr(tcaps[i], tmp);
char *cval = Tgetstr(tcaps[i], termcap2_ptr);
if (cval == (char *) -1)
*(char **)tcaps[i].ptr = NULL;
else
*(char **)tcaps[i].ptr = cval;
cval = NULL;
*(char **)tcaps[i].ptr = cval;
}
}