mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
24120: termcap string memory allocation was screwy
This commit is contained in:
parent
0c59f29ddc
commit
0d04d4c312
2 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,8 @@
|
|||
2007-11-26 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 24120: Src/init.c: memory allocation for termcap strings
|
||||
was screwy, in particular when terminal couldn't move left.
|
||||
|
||||
* c.f. users/12248: Doc/Zsh/.distfiles: zshcalsys.1 was missing
|
||||
from distribution.
|
||||
|
||||
|
|
|
@ -598,19 +598,22 @@ init_term(void)
|
|||
if (tccan(TCUP))
|
||||
termflags &= ~TERM_NOUP;
|
||||
else {
|
||||
zsfree(tcstr[TCUP]);
|
||||
tcstr[TCUP] = NULL;
|
||||
termflags |= TERM_NOUP;
|
||||
}
|
||||
|
||||
/* most termcaps don't define "bc" because they use \b. */
|
||||
if (!tccan(TCBACKSPACE)) {
|
||||
zsfree(tcstr[TCBACKSPACE]);
|
||||
tcstr[TCBACKSPACE] = ztrdup("\b");
|
||||
tclen[TCBACKSPACE] = 1;
|
||||
}
|
||||
|
||||
/* if there's no termcap entry for cursor left, use backspace. */
|
||||
if (!tccan(TCLEFT)) {
|
||||
tcstr[TCLEFT] = tcstr[TCBACKSPACE];
|
||||
zsfree(tcstr[TCLEFT]);
|
||||
tcstr[TCLEFT] = ztrdup(tcstr[TCBACKSPACE]);
|
||||
tclen[TCLEFT] = tclen[TCBACKSPACE];
|
||||
}
|
||||
|
||||
|
@ -629,6 +632,7 @@ init_term(void)
|
|||
|
||||
/* if there's no termcap entry for clear, use ^L. */
|
||||
if (!tccan(TCCLEARSCREEN)) {
|
||||
zsfree(tcstr[TCCLEARSCREEN]);
|
||||
tcstr[TCCLEARSCREEN] = ztrdup("\14");
|
||||
tclen[TCCLEARSCREEN] = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue