From 1b52f47cf285d5f3835bce7ad73f360bd327d4e8 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 6 Jul 2007 21:52:38 +0000 Subject: 23665: autoloading of module features and related tweaks --- Src/Modules/terminfo.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'Src/Modules/terminfo.c') diff --git a/Src/Modules/terminfo.c b/Src/Modules/terminfo.c index d324c3a6c..63cbd2abc 100644 --- a/Src/Modules/terminfo.c +++ b/Src/Modules/terminfo.c @@ -129,10 +129,10 @@ static struct builtin bintab[] = { /**/ static HashNode -getterminfo(UNUSED(HashTable ht), char *name) +getterminfo(UNUSED(HashTable ht), const char *name) { int len, num; - char *tistr; + char *tistr, *nameu; Param pm = NULL; /* This depends on the termcap stuff in init.c */ @@ -141,21 +141,22 @@ getterminfo(UNUSED(HashTable ht), char *name) if ((termflags & TERM_UNKNOWN) && (isset(INTERACTIVE) || !init_term())) return NULL; - unmetafy(name, &len); + nameu = dupstring(name); + unmetafy(nameu, &len); pm = (Param) hcalloc(sizeof(struct param)); - pm->node.nam = dupstring(name); + pm->node.nam = nameu; pm->node.flags = PM_READONLY; - if (((num = tigetnum(name)) != -1) && (num != -2)) { + if (((num = tigetnum(nameu)) != -1) && (num != -2)) { pm->u.val = num; pm->node.flags |= PM_INTEGER; pm->gsu.i = &nullsetinteger_gsu; - } else if ((num = tigetflag(name)) != -1) { + } else if ((num = tigetflag(nameu)) != -1) { pm->u.str = num ? dupstring("yes") : dupstring("no"); pm->node.flags |= PM_SCALAR; pm->gsu.s = &nullsetscalar_gsu; - } else if ((tistr = (char *)tigetstr(name)) != NULL && tistr != (char *)-1) { + } else if ((tistr = (char *)tigetstr(nameu)) != NULL && tistr != (char *)-1) { pm->u.str = dupstring(tistr); pm->node.flags |= PM_SCALAR; pm->gsu.s = &nullsetscalar_gsu; @@ -298,12 +299,12 @@ static struct features module_features = { NULL, 0, #endif NULL, 0, + NULL, 0, #ifdef USE_TERMINFO_MODULE partab, sizeof(partab)/sizeof(*partab), #else NULL, 0, #endif - NULL, 0, 0 }; @@ -318,7 +319,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -326,7 +327,7 @@ features_(Module m, char ***features) int enables_(Module m, int **enables) { - return handlefeatures(m->nam, &module_features, enables); + return handlefeatures(m, &module_features, enables); } /**/ @@ -349,7 +350,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ -- cgit 1.4.1