mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 17:24:50 +01:00
17481 (Karl Tomlinson): get/set for terminfo and termcap parameters
This commit is contained in:
parent
5445efbb91
commit
3ad5e3e7fe
3 changed files with 39 additions and 18 deletions
|
@ -1,3 +1,9 @@
|
|||
2002-10-07 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 17482 (Karl Tomlinson): Src/Modules/termcap.c,
|
||||
Src/Modules/terminfo.c: resolve confusion over use of get/set
|
||||
functions for special parameters. Copied from 4.0.
|
||||
|
||||
2002-10-06 Bart Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 17760: Src/lex.c Src/parse.c: Fix case-pattern parsing bug in sh
|
||||
|
|
|
@ -236,10 +236,6 @@ gettermcap(HashTable ht, char *name)
|
|||
pm = (Param) zhalloc(sizeof(struct param));
|
||||
pm->nam = dupstring(name);
|
||||
pm->flags = PM_READONLY;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
pm->sets.ifn = NULL;
|
||||
pm->gets.ifn = intgetfn;
|
||||
pm->unsetfn = NULL;
|
||||
pm->ct = 0;
|
||||
pm->env = NULL;
|
||||
|
@ -251,10 +247,15 @@ gettermcap(HashTable ht, char *name)
|
|||
/* logic in the following cascade copied from echotc, above */
|
||||
|
||||
if ((num = tgetnum(name)) != -1) {
|
||||
pm->sets.ifn = NULL;
|
||||
pm->gets.ifn = intgetfn;
|
||||
pm->u.val = num;
|
||||
pm->flags |= PM_INTEGER;
|
||||
return (HashNode) pm;
|
||||
}
|
||||
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
switch (ztgetflag(name)) {
|
||||
case -1:
|
||||
break;
|
||||
|
@ -338,10 +339,6 @@ scantermcap(HashTable ht, ScanFunc func, int flags)
|
|||
#endif
|
||||
|
||||
pm = (Param) zhalloc(sizeof(struct param));
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
pm->sets.ifn = NULL;
|
||||
pm->gets.ifn = intgetfn;
|
||||
pm->unsetfn = NULL;
|
||||
pm->ct = 0;
|
||||
pm->env = NULL;
|
||||
|
@ -350,6 +347,9 @@ scantermcap(HashTable ht, ScanFunc func, int flags)
|
|||
u = buf;
|
||||
|
||||
pm->flags = PM_READONLY | PM_SCALAR;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
|
||||
for (capcode = (char **)boolcodes; *capcode; capcode++) {
|
||||
if ((num = ztgetflag(*capcode)) != -1) {
|
||||
pm->u.str = num ? dupstring("yes") : dupstring("no");
|
||||
|
@ -359,6 +359,9 @@ scantermcap(HashTable ht, ScanFunc func, int flags)
|
|||
}
|
||||
|
||||
pm->flags = PM_READONLY | PM_INTEGER;
|
||||
pm->sets.ifn = NULL;
|
||||
pm->gets.ifn = intgetfn;
|
||||
|
||||
for (capcode = (char **)numcodes; *capcode; capcode++) {
|
||||
if ((num = tgetnum(*capcode)) != -1) {
|
||||
pm->u.val = num;
|
||||
|
@ -368,6 +371,9 @@ scantermcap(HashTable ht, ScanFunc func, int flags)
|
|||
}
|
||||
|
||||
pm->flags = PM_READONLY | PM_SCALAR;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
|
||||
for (capcode = (char **)strcodes; *capcode; capcode++) {
|
||||
if ((tcstr = (char *)tgetstr(*capcode,&u)) != NULL &&
|
||||
tcstr != (char *)-1) {
|
||||
|
|
|
@ -175,10 +175,6 @@ getterminfo(HashTable ht, char *name)
|
|||
pm = (Param) zhalloc(sizeof(struct param));
|
||||
pm->nam = dupstring(name);
|
||||
pm->flags = PM_READONLY;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
pm->sets.ifn = NULL;
|
||||
pm->gets.ifn = intgetfn;
|
||||
pm->unsetfn = NULL;
|
||||
pm->ct = 0;
|
||||
pm->env = NULL;
|
||||
|
@ -189,21 +185,29 @@ getterminfo(HashTable ht, char *name)
|
|||
if (((num = tigetnum(name)) != -1) && (num != -2)) {
|
||||
pm->u.val = num;
|
||||
pm->flags |= PM_INTEGER;
|
||||
pm->sets.ifn = NULL;
|
||||
pm->gets.ifn = intgetfn;
|
||||
}
|
||||
else if ((num = tigetflag(name)) != -1) {
|
||||
pm->u.str = num ? dupstring("yes") : dupstring("no");
|
||||
pm->flags |= PM_SCALAR;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
}
|
||||
else if ((tistr = (char *)tigetstr(name)) != NULL && tistr != (char *)-1)
|
||||
{
|
||||
pm->u.str = dupstring(tistr);
|
||||
pm->flags |= PM_SCALAR;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* zwarn("no such capability: %s", name, 0); */
|
||||
pm->u.str = dupstring("");
|
||||
pm->flags |= PM_UNSET;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
}
|
||||
return (HashNode) pm;
|
||||
}
|
||||
|
@ -287,10 +291,6 @@ scanterminfo(HashTable ht, ScanFunc func, int flags)
|
|||
#endif
|
||||
|
||||
pm = (Param) zhalloc(sizeof(struct param));
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
pm->sets.ifn = NULL;
|
||||
pm->gets.ifn = intgetfn;
|
||||
pm->unsetfn = NULL;
|
||||
pm->ct = 0;
|
||||
pm->env = NULL;
|
||||
|
@ -298,6 +298,9 @@ scanterminfo(HashTable ht, ScanFunc func, int flags)
|
|||
pm->old = NULL;
|
||||
|
||||
pm->flags = PM_READONLY | PM_SCALAR;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
|
||||
for (capname = (char **)boolnames; *capname; capname++) {
|
||||
if ((num = tigetflag(*capname)) != -1) {
|
||||
pm->u.str = num ? dupstring("yes") : dupstring("no");
|
||||
|
@ -305,8 +308,11 @@ scanterminfo(HashTable ht, ScanFunc func, int flags)
|
|||
func((HashNode) pm, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pm->flags = PM_READONLY | PM_INTEGER;
|
||||
pm->sets.ifn = NULL;
|
||||
pm->gets.ifn = intgetfn;
|
||||
|
||||
for (capname = (char **)numnames; *capname; capname++) {
|
||||
if (((num = tigetnum(*capname)) != -1) && (num != -2)) {
|
||||
pm->u.val = num;
|
||||
|
@ -314,8 +320,11 @@ scanterminfo(HashTable ht, ScanFunc func, int flags)
|
|||
func((HashNode) pm, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pm->flags = PM_READONLY | PM_SCALAR;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
|
||||
for (capname = (char **)strnames; *capname; capname++) {
|
||||
if ((tistr = (char *)tigetstr(*capname)) != NULL &&
|
||||
tistr != (char *)-1) {
|
||||
|
|
Loading…
Reference in a new issue