diff options
Diffstat (limited to 'Src/Modules/langinfo.c')
-rw-r--r-- | Src/Modules/langinfo.c | 92 |
1 files changed, 32 insertions, 60 deletions
diff --git a/Src/Modules/langinfo.c b/Src/Modules/langinfo.c index a09c1a0bb..cfbdeed44 100644 --- a/Src/Modules/langinfo.c +++ b/Src/Modules/langinfo.c @@ -30,14 +30,10 @@ #include "langinfo.mdh" #include "langinfo.pro" -static char langinfo_nam[] = "langinfo"; - #ifdef HAVE_LANGINFO_H # include <langinfo.h> #endif -static Param langinfo_pm; - /**/ #ifdef HAVE_NL_LANGINFO @@ -396,46 +392,6 @@ liitem(char *name) } /**/ -static void -shempty(void) -{ -} - -/* Create a simple special hash parameter. */ - -/**/ -static Param -createlihash() -{ - Param pm; - HashTable ht; - - unsetparam(langinfo_nam); - - if (!(pm = createparam(langinfo_nam, PM_SPECIAL|PM_HIDE|PM_HIDEVAL| - PM_REMOVABLE|PM_HASHED))) - return NULL; - - pm->level = pm->old ? locallevel : 0; - pm->gsu.h = &stdhash_gsu; - pm->u.hash = ht = newhashtable(7, langinfo_nam, NULL); - - ht->hash = hasher; - ht->emptytable = (TableFunc) shempty; - ht->filltable = NULL; - ht->addnode = (AddNodeFunc) shempty; - ht->getnode = ht->getnode2 = getlanginfo; - ht->removenode = (RemoveNodeFunc) shempty; - ht->disablenode = NULL; - ht->enablenode = NULL; - ht->freenode = (FreeNodeFunc) shempty; - ht->printnode = printparamnode; - ht->scantab = scanlanginfo; - - return (langinfo_pm = pm); -} - -/**/ static HashNode getlanginfo(UNUSED(HashTable ht), char *name) { @@ -490,9 +446,25 @@ scanlanginfo(UNUSED(HashTable ht), ScanFunc func, int flags) } +static struct paramdef partab[] = { + SPECIALPMDEF("langinfo", 0, NULL, getlanginfo, scanlanginfo) +}; + /**/ #endif /* HAVE_NL_LANGINFO */ +static struct features module_features = { + NULL, 0, + NULL, 0, +#ifdef HAVE_NL_LANGINFO + partab, sizeof(partab)/sizeof(*partab), +#else + NULL, 0, +#endif + NULL, 0, + 0 +}; + /**/ int setup_(UNUSED(Module m)) @@ -502,35 +474,35 @@ setup_(UNUSED(Module m)) /**/ int -boot_(UNUSED(Module m)) +features_(Module m, char ***features) { -#ifdef HAVE_NL_LANGINFO - if (!createlihash()) - return 1; -#else - unsetparam(langinfo_nam); -#endif + *features = featuresarray(m->nam, &module_features); return 0; } /**/ int -cleanup_(UNUSED(Module m)) +enables_(Module m, int **enables) { -#ifdef HAVE_NL_LANGINFO - Param pm; + return handlefeatures(m->nam, &module_features, enables); +} - if ((pm = (Param) paramtab->getnode(paramtab, langinfo_nam)) && - pm == langinfo_pm) { - pm->node.flags &= ~PM_READONLY; - unsetparam_pm(pm, 0, 1); - } -#endif +/**/ +int +boot_(UNUSED(Module m)) +{ return 0; } /**/ int +cleanup_(UNUSED(Module m)) +{ + return setfeatureenables(m->nam, &module_features, NULL); +} + +/**/ +int finish_(UNUSED(Module m)) { return 0; |