diff options
Diffstat (limited to 'Src/Modules')
-rw-r--r-- | Src/Modules/cap.c | 6 | ||||
-rw-r--r-- | Src/Modules/clone.c | 6 | ||||
-rw-r--r-- | Src/Modules/datetime.c | 8 | ||||
-rw-r--r-- | Src/Modules/example.c | 14 | ||||
-rw-r--r-- | Src/Modules/files.c | 6 | ||||
-rw-r--r-- | Src/Modules/langinfo.c | 19 | ||||
-rw-r--r-- | Src/Modules/mapfile.c | 10 | ||||
-rw-r--r-- | Src/Modules/mathfunc.c | 17 | ||||
-rw-r--r-- | Src/Modules/parameter.c | 201 | ||||
-rw-r--r-- | Src/Modules/pcre.c | 10 | ||||
-rw-r--r-- | Src/Modules/regex.c | 6 | ||||
-rw-r--r-- | Src/Modules/socket.c | 6 | ||||
-rw-r--r-- | Src/Modules/stat.c | 6 | ||||
-rw-r--r-- | Src/Modules/system.c | 12 | ||||
-rw-r--r-- | Src/Modules/tcp.c | 6 | ||||
-rw-r--r-- | Src/Modules/termcap.c | 24 | ||||
-rw-r--r-- | Src/Modules/terminfo.c | 23 | ||||
-rw-r--r-- | Src/Modules/zftp.c | 6 | ||||
-rw-r--r-- | Src/Modules/zprof.c | 10 | ||||
-rw-r--r-- | Src/Modules/zpty.c | 6 | ||||
-rw-r--r-- | Src/Modules/zselect.c | 6 | ||||
-rw-r--r-- | Src/Modules/zutil.c | 10 |
22 files changed, 190 insertions, 228 deletions
diff --git a/Src/Modules/cap.c b/Src/Modules/cap.c index 2886c42b4..9d41a4e90 100644 --- a/Src/Modules/cap.c +++ b/Src/Modules/cap.c @@ -141,7 +141,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -149,7 +149,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); } /**/ @@ -163,7 +163,7 @@ boot_(UNUSED(Module m)) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/clone.c b/Src/Modules/clone.c index adab4cb59..6fdf534c0 100644 --- a/Src/Modules/clone.c +++ b/Src/Modules/clone.c @@ -128,7 +128,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -136,7 +136,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); } /**/ @@ -150,7 +150,7 @@ boot_(UNUSED(Module m)) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c index 06bf52046..169369d5f 100644 --- a/Src/Modules/datetime.c +++ b/Src/Modules/datetime.c @@ -161,8 +161,8 @@ static struct paramdef patab[] = { static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, - patab, sizeof(patab)/sizeof(*patab), NULL, 0, + patab, sizeof(patab)/sizeof(*patab), 0 }; @@ -177,7 +177,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -185,7 +185,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); } /**/ @@ -199,7 +199,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/example.c b/Src/Modules/example.c index 88e910814..fa86f260c 100644 --- a/Src/Modules/example.c +++ b/Src/Modules/example.c @@ -165,19 +165,19 @@ static struct builtin bintab[] = { }; static struct conddef cotab[] = { - CONDDEF("len", 0, cond_p_len, 1, 2, 0), CONDDEF("ex", CONDF_INFIX, cond_i_ex, 0, 0, 0), + CONDDEF("len", 0, cond_p_len, 1, 2, 0), }; static struct paramdef patab[] = { + ARRPARAMDEF("exarr", &arrparam), INTPARAMDEF("exint", &intparam), STRPARAMDEF("exstr", &strparam), - ARRPARAMDEF("exarr", &arrparam), }; static struct mathfunc mftab[] = { - NUMMATHFUNC("sum", math_sum, 1, -1, 0), STRMATHFUNC("length", math_length, 0), + NUMMATHFUNC("sum", math_sum, 1, -1, 0), }; static struct funcwrap wrapper[] = { @@ -187,8 +187,8 @@ static struct funcwrap wrapper[] = { static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), cotab, sizeof(cotab)/sizeof(*cotab), - patab, sizeof(patab)/sizeof(*patab), mftab, sizeof(mftab)/sizeof(*mftab), + patab, sizeof(patab)/sizeof(*patab), 0 }; @@ -205,7 +205,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -213,7 +213,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); } /**/ @@ -234,7 +234,7 @@ int cleanup_(Module m) { deletewrapper(m, wrapper); - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/files.c b/Src/Modules/files.c index ba742cc50..0ce6d78d0 100644 --- a/Src/Modules/files.c +++ b/Src/Modules/files.c @@ -725,7 +725,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -733,7 +733,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); } /**/ @@ -747,7 +747,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/langinfo.c b/Src/Modules/langinfo.c index cfbdeed44..f10fdfef5 100644 --- a/Src/Modules/langinfo.c +++ b/Src/Modules/langinfo.c @@ -376,7 +376,7 @@ static nl_item nl_vals[] = { }; static nl_item * -liitem(char *name) +liitem(const char *name) { char **element; nl_item *nlcode; @@ -393,16 +393,17 @@ liitem(char *name) /**/ static HashNode -getlanginfo(UNUSED(HashTable ht), char *name) +getlanginfo(UNUSED(HashTable ht), const char *name) { int len, *elem; - char *listr; + char *listr, *nameu; Param pm = 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 | PM_SCALAR; pm->gsu.s = &nullsetscalar_gsu; @@ -456,12 +457,12 @@ static struct paramdef partab[] = { static struct features module_features = { NULL, 0, NULL, 0, + NULL, 0, #ifdef HAVE_NL_LANGINFO partab, sizeof(partab)/sizeof(*partab), #else NULL, 0, #endif - NULL, 0, 0 }; @@ -476,7 +477,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -484,7 +485,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); } /**/ @@ -498,7 +499,7 @@ boot_(UNUSED(Module m)) int cleanup_(UNUSED(Module m)) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/mapfile.c b/Src/Modules/mapfile.c index fb46df885..d825c7faa 100644 --- a/Src/Modules/mapfile.c +++ b/Src/Modules/mapfile.c @@ -213,7 +213,7 @@ static struct paramdef partab[] = { /**/ static HashNode -getpmmapfile(UNUSED(HashTable ht), char *name) +getpmmapfile(UNUSED(HashTable ht), const char *name) { char *contents; Param pm = NULL; @@ -268,8 +268,8 @@ scanpmmapfile(UNUSED(HashTable ht), ScanFunc func, int flags) static struct features module_features = { NULL, 0, NULL, 0, - partab, sizeof(partab)/sizeof(*partab), NULL, 0, + partab, sizeof(partab)/sizeof(*partab), 0 }; @@ -284,7 +284,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -292,7 +292,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); } /**/ @@ -306,7 +306,7 @@ boot_(UNUSED(Module m)) int cleanup_(UNUSED(Module m)) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/mathfunc.c b/Src/Modules/mathfunc.c index a473476e3..04483b555 100644 --- a/Src/Modules/mathfunc.c +++ b/Src/Modules/mathfunc.c @@ -125,12 +125,6 @@ enum { static struct mathfunc mftab[] = { - /* Functions taking string arguments */ -#ifdef HAVE_ERAND48 - /* here to avoid comma hassle */ - STRMATHFUNC("rand48", math_string, MS_RAND48), -#endif - NUMMATHFUNC("abs", math_func, 1, 1, MF_ABS | BFLAG(BF_FRAC) | TFLAG(TF_NOCONV|TF_NOASS)), NUMMATHFUNC("acos", math_func, 1, 1, MF_ACOS | BFLAG(BF_FRAC)), @@ -167,6 +161,9 @@ static struct mathfunc mftab[] = { NUMMATHFUNC("log1p", math_func, 1, 1, MF_LOG1P | BFLAG(BF_GTRM1)), NUMMATHFUNC("logb", math_func, 1, 1, MF_LOGB | BFLAG(BF_NONZ)), NUMMATHFUNC("nextafter", math_func, 2, 2, MF_NEXTAFTER), +#ifdef HAVE_ERAND48 + STRMATHFUNC("rand48", math_string, MS_RAND48), +#endif NUMMATHFUNC("rint", math_func, 1, 1, MF_RINT), NUMMATHFUNC("scalb", math_func, 2, 2, MF_SCALB | TFLAG(TF_INT2)), #ifdef HAVE_SIGNGAM @@ -564,8 +561,8 @@ math_string(UNUSED(char *name), char *arg, int id) static struct features module_features = { NULL, 0, NULL, 0, - NULL, 0, mftab, sizeof(mftab)/sizeof(*mftab), + NULL, 0, 0 }; @@ -580,7 +577,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -588,7 +585,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); } /**/ @@ -602,7 +599,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c index 9112e64f1..3c7264a09 100644 --- a/Src/Modules/parameter.c +++ b/Src/Modules/parameter.c @@ -93,7 +93,7 @@ paramtypestr(Param pm) /**/ static HashNode -getpmparameter(UNUSED(HashTable ht), char *name) +getpmparameter(UNUSED(HashTable ht), const char *name) { Param rpm, pm = NULL; @@ -199,7 +199,7 @@ static const struct gsu_scalar pmcommand_gsu = /**/ static HashNode -getpmcommand(UNUSED(HashTable ht), char *name) +getpmcommand(UNUSED(HashTable ht), const char *name) { Cmdnam cmd; Param pm = NULL; @@ -372,7 +372,7 @@ static const struct gsu_scalar pmdisfunction_gsu = /**/ static HashNode -getfunction(UNUSED(HashTable ht), char *name, int dis) +getfunction(UNUSED(HashTable ht), const char *name, int dis) { Shfunc shf; Param pm = NULL; @@ -416,14 +416,14 @@ getfunction(UNUSED(HashTable ht), char *name, int dis) /**/ static HashNode -getpmfunction(HashTable ht, char *name) +getpmfunction(HashTable ht, const char *name) { return getfunction(ht, name, 0); } /**/ static HashNode -getpmdisfunction(HashTable ht, char *name) +getpmdisfunction(HashTable ht, const char *name) { return getfunction(ht, name, DISABLED); } @@ -542,7 +542,7 @@ functracegetfn(UNUSED(Param pm)) /**/ static HashNode -getbuiltin(UNUSED(HashTable ht), char *name, int dis) +getbuiltin(UNUSED(HashTable ht), const char *name, int dis) { Param pm = NULL; Builtin bn; @@ -566,14 +566,14 @@ getbuiltin(UNUSED(HashTable ht), char *name, int dis) /**/ static HashNode -getpmbuiltin(HashTable ht, char *name) +getpmbuiltin(HashTable ht, const char *name) { return getbuiltin(ht, name, 0); } /**/ static HashNode -getpmdisbuiltin(HashTable ht, char *name) +getpmdisbuiltin(HashTable ht, const char *name) { return getbuiltin(ht, name, DISABLED); } @@ -721,7 +721,7 @@ static const struct gsu_scalar pmoption_gsu = /**/ static HashNode -getpmoption(UNUSED(HashTable ht), char *name) +getpmoption(UNUSED(HashTable ht), const char *name) { Param pm = NULL; int n; @@ -771,69 +771,29 @@ scanpmoptions(UNUSED(HashTable ht), ScanFunc func, int flags) /* Functions for the modules special parameter. */ -static char *modpmname; -static int modpmfound; - -/**/ -static void -modpmbuiltinscan(HashNode hn, UNUSED(int dummy)) -{ - if (!(((Builtin) hn)->node.flags & BINF_ADDED) && - !strcmp(((Builtin) hn)->optstr, modpmname)) - modpmfound = 1; -} - -/**/ -static void -modpmparamscan(HashNode hn, UNUSED(int dummy)) -{ - if ((((Param) hn)->node.flags & PM_AUTOLOAD) && - !strcmp(((Param) hn)->u.str, modpmname)) - modpmfound = 1; -} - /**/ static HashNode -getpmmodule(UNUSED(HashTable ht), char *name) +getpmmodule(UNUSED(HashTable ht), const char *name) { Param pm = NULL; char *type = NULL; - LinkNode node; + Module m; pm = (Param) hcalloc(sizeof(struct param)); pm->node.nam = dupstring(name); pm->node.flags = PM_SCALAR | PM_READONLY; pm->gsu.s = &nullsetscalar_gsu; - if (!type) { - Module m; - - for (node = firstnode(modules); node; incnode(node)) { - m = (Module) getdata(node); - if (m->u.handle && !(m->flags & MOD_UNLOAD) && - !strcmp(name, m->nam)) { - type = ((m->flags & MOD_ALIAS) ? - dyncat("alias:", m->u.alias) : "loaded"); - break; - } - } + m = (Module)modulestab->getnode2(modulestab, name); + + if (!m) + return NULL; + if (m->u.handle && !(m->node.flags & MOD_UNLOAD)) { + type = ((m->node.flags & MOD_ALIAS) ? + dyncat("alias:", m->u.alias) : "loaded"); } - modpmname = name; - modpmfound = 0; if (!type) { - scanhashtable(builtintab, 0, 0, 0, modpmbuiltinscan, 0); - if (!modpmfound) { - Conddef p; - - for (p = condtab; p; p = p->next) - if (p->module && !strcmp(name, p->module)) { - modpmfound = 1; - break; - } - if (!modpmfound) - scanhashtable(realparamtab, 0, 0, 0, modpmparamscan, 0); - } - if (modpmfound) + if (m->autoloads && firstnode(m->autoloads)) type = "autoloaded"; } if (type) @@ -853,7 +813,6 @@ scanpmmodules(UNUSED(HashTable ht), ScanFunc func, int flags) int i; HashNode hn; LinkList done = newlinklist(); - LinkNode node; Module m; Conddef p; char *loaded = dupstring("loaded"); @@ -862,14 +821,16 @@ scanpmmodules(UNUSED(HashTable ht), ScanFunc func, int flags) pm.node.flags = PM_SCALAR | PM_READONLY; pm.gsu.s = &nullsetscalar_gsu; - for (node = firstnode(modules); node; incnode(node)) { - m = (Module) getdata(node); - if (m->u.handle && !(m->flags & MOD_UNLOAD)) { - pm.node.nam = m->nam; - pm.u.str = ((m->flags & MOD_ALIAS) ? - dyncat("alias:", m->u.alias) : loaded); - addlinknode(done, pm.node.nam); - func(&pm.node, flags); + for (i = 0; i < modulestab->hsize; i++) { + for (hn = modulestab->nodes[i]; hn; hn = hn->next) { + m = (Module) hn; + if (m->u.handle && !(m->node.flags & MOD_UNLOAD)) { + pm.node.nam = m->node.nam; + pm.u.str = ((m->node.flags & MOD_ALIAS) ? + dyncat("alias:", m->u.alias) : loaded); + addlinknode(done, pm.node.nam); + func(&pm.node, flags); + } } } pm.u.str = dupstring("autoloaded"); @@ -928,11 +889,11 @@ dirsgetfn(UNUSED(Param pm)) /**/ static HashNode -getpmhistory(UNUSED(HashTable ht), char *name) +getpmhistory(UNUSED(HashTable ht), const char *name) { Param pm = NULL; Histent he; - char *p; + const char *p; int ok = 1; pm = (Param) hcalloc(sizeof(struct param)); @@ -1042,7 +1003,7 @@ pmjobtext(int job) /**/ static HashNode -getpmjobtext(UNUSED(HashTable ht), char *name) +getpmjobtext(UNUSED(HashTable ht), const char *name) { Param pm = NULL; int job; @@ -1139,7 +1100,7 @@ pmjobstate(int job) /**/ static HashNode -getpmjobstate(UNUSED(HashTable ht), char *name) +getpmjobstate(UNUSED(HashTable ht), const char *name) { Param pm = NULL; int job; @@ -1201,7 +1162,7 @@ pmjobdir(int job) /**/ static HashNode -getpmjobdir(UNUSED(HashTable ht), char *name) +getpmjobdir(UNUSED(HashTable ht), const char *name) { Param pm = NULL; int job; @@ -1329,7 +1290,7 @@ static const struct gsu_scalar pmnamedir_gsu = /**/ static HashNode -getpmnameddir(UNUSED(HashTable ht), char *name) +getpmnameddir(UNUSED(HashTable ht), const char *name) { Param pm = NULL; Nameddir nd; @@ -1378,7 +1339,7 @@ scanpmnameddirs(UNUSED(HashTable ht), ScanFunc func, int flags) /**/ static HashNode -getpmuserdir(UNUSED(HashTable ht), char *name) +getpmuserdir(UNUSED(HashTable ht), const char *name) { Param pm = NULL; Nameddir nd; @@ -1631,7 +1592,7 @@ assignaliasdefs(Param pm, int flags) /**/ static HashNode -getalias(HashTable alht, UNUSED(HashTable ht), char *name, int flags) +getalias(HashTable alht, UNUSED(HashTable ht), const char *name, int flags) { Param pm = NULL; Alias al; @@ -1653,45 +1614,45 @@ getalias(HashTable alht, UNUSED(HashTable ht), char *name, int flags) /**/ static HashNode -getpmralias(HashTable ht, char *name) +getpmralias(HashTable ht, const char *name) { return getalias(aliastab, ht, name, 0); } /**/ static HashNode -getpmdisralias(HashTable ht, char *name) +getpmdisralias(HashTable ht, const char *name) { return getalias(aliastab, ht, name, DISABLED); } /**/ static HashNode -getpmgalias(HashTable ht, char *name) +getpmgalias(HashTable ht, const char *name) { return getalias(aliastab, ht, name, ALIAS_GLOBAL); } /**/ static HashNode -getpmdisgalias(HashTable ht, char *name) +getpmdisgalias(HashTable ht, const char *name) { return getalias(aliastab, ht, name, ALIAS_GLOBAL|DISABLED); } /**/ static HashNode -getpmsalias(HashTable ht, char *name) +getpmsalias(HashTable ht, const char *name) { return getalias(sufaliastab, ht, name, ALIAS_SUFFIX); } /**/ static HashNode -getpmdissalias(HashTable ht, char *name) +getpmdissalias(HashTable ht, const char *name) { return getalias(sufaliastab, ht, name, ALIAS_SUFFIX|DISABLED); -} +} /**/ static void @@ -1809,63 +1770,63 @@ static const struct gsu_array historywords_gsu = { histwgetfn, arrsetfn, stdunsetfn }; static struct paramdef partab[] = { - SPECIALPMDEF("parameters", PM_READONLY, - NULL, getpmparameter, scanpmparameters), + SPECIALPMDEF("aliases", 0, + &pmraliases_gsu, getpmralias, scanpmraliases), + SPECIALPMDEF("builtins", PM_READONLY, NULL, getpmbuiltin, scanpmbuiltins), SPECIALPMDEF("commands", 0, &pmcommands_gsu, getpmcommand, scanpmcommands), - SPECIALPMDEF("functions", 0, &pmfunctions_gsu, getpmfunction, - scanpmfunctions), + SPECIALPMDEF("dirstack", PM_ARRAY, + &dirs_gsu, NULL, NULL), + SPECIALPMDEF("dis_aliases", 0, + &pmdisraliases_gsu, getpmdisralias, scanpmdisraliases), + SPECIALPMDEF("dis_builtins", PM_READONLY, + NULL, getpmdisbuiltin, scanpmdisbuiltins), SPECIALPMDEF("dis_functions", 0, &pmdisfunctions_gsu, getpmdisfunction, scanpmdisfunctions), + SPECIALPMDEF("dis_galiases", 0, + &pmdisgaliases_gsu, getpmdisgalias, scanpmdisgaliases), + SPECIALPMDEF("dis_reswords", PM_ARRAY|PM_READONLY, + &disreswords_gsu, NULL, NULL), + SPECIALPMDEF("dis_saliases", 0, + &pmdissaliases_gsu, getpmdissalias, scanpmdissaliases), SPECIALPMDEF("funcstack", PM_ARRAY|PM_READONLY, &funcstack_gsu, NULL, NULL), + SPECIALPMDEF("functions", 0, &pmfunctions_gsu, getpmfunction, + scanpmfunctions), SPECIALPMDEF("functrace", PM_ARRAY|PM_READONLY, &functrace_gsu, NULL, NULL), - SPECIALPMDEF("builtins", PM_READONLY, NULL, getpmbuiltin, scanpmbuiltins), - SPECIALPMDEF("dis_builtins", PM_READONLY, - NULL, getpmdisbuiltin, scanpmdisbuiltins), - SPECIALPMDEF("reswords", PM_ARRAY|PM_READONLY, - &reswords_gsu, NULL, NULL), - SPECIALPMDEF("dis_reswords", PM_ARRAY|PM_READONLY, - &disreswords_gsu, NULL, NULL), - SPECIALPMDEF("options", 0, - &pmoptions_gsu, getpmoption, scanpmoptions), - SPECIALPMDEF("modules", PM_READONLY, - NULL, getpmmodule, scanpmmodules), - SPECIALPMDEF("dirstack", PM_ARRAY, - &dirs_gsu, NULL, NULL), + SPECIALPMDEF("galiases", 0, + &pmgaliases_gsu, getpmgalias, scanpmgaliases), SPECIALPMDEF("history", PM_READONLY, NULL, getpmhistory, scanpmhistory), SPECIALPMDEF("historywords", PM_ARRAY|PM_READONLY, &historywords_gsu, NULL, NULL), - SPECIALPMDEF("jobtexts", PM_READONLY, - NULL, getpmjobtext, scanpmjobtexts), - SPECIALPMDEF("jobstates", PM_READONLY, - NULL, getpmjobstate, scanpmjobstates), SPECIALPMDEF("jobdirs", PM_READONLY, NULL, getpmjobdir, scanpmjobdirs), + SPECIALPMDEF("jobstates", PM_READONLY, + NULL, getpmjobstate, scanpmjobstates), + SPECIALPMDEF("jobtexts", PM_READONLY, + NULL, getpmjobtext, scanpmjobtexts), + SPECIALPMDEF("modules", PM_READONLY, + NULL, getpmmodule, scanpmmodules), SPECIALPMDEF("nameddirs", 0, &pmnameddirs_gsu, getpmnameddir, scanpmnameddirs), - SPECIALPMDEF("userdirs", PM_READONLY, - NULL, getpmuserdir, scanpmuserdirs), - SPECIALPMDEF("aliases", 0, - &pmraliases_gsu, getpmralias, scanpmraliases), - SPECIALPMDEF("galiases", 0, - &pmgaliases_gsu, getpmgalias, scanpmgaliases), + SPECIALPMDEF("options", 0, + &pmoptions_gsu, getpmoption, scanpmoptions), + SPECIALPMDEF("parameters", PM_READONLY, + NULL, getpmparameter, scanpmparameters), + SPECIALPMDEF("reswords", PM_ARRAY|PM_READONLY, + &reswords_gsu, NULL, NULL), SPECIALPMDEF("saliases", 0, &pmsaliases_gsu, getpmsalias, scanpmsaliases), - SPECIALPMDEF("dis_aliases", 0, - &pmdisraliases_gsu, getpmdisralias, scanpmdisraliases), - SPECIALPMDEF("dis_galiases", 0, - &pmdisgaliases_gsu, getpmdisgalias, scanpmdisgaliases), - SPECIALPMDEF("dis_saliases", 0, - &pmdissaliases_gsu, getpmdissalias, scanpmdissaliases) + SPECIALPMDEF("userdirs", PM_READONLY, + NULL, getpmuserdir, scanpmuserdirs) }; static struct features module_features = { NULL, 0, NULL, 0, - partab, sizeof(partab)/sizeof(*partab), NULL, 0, + partab, sizeof(partab)/sizeof(*partab), 0 }; @@ -1880,7 +1841,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -1894,7 +1855,7 @@ enables_(Module m, int **enables) * on the main shell, so set the flag to indicate. */ incleanup = 1; - ret = handlefeatures(m->nam, &module_features, enables); + ret = handlefeatures(m, &module_features, enables); incleanup = 0; return ret; } @@ -1912,7 +1873,7 @@ cleanup_(Module m) { int ret; incleanup = 1; - ret = setfeatureenables(m->nam, &module_features, NULL); + ret = setfeatureenables(m, &module_features, NULL); incleanup = 0; return ret; } diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c index 45c38eba0..4f8daff80 100644 --- a/Src/Modules/pcre.c +++ b/Src/Modules/pcre.c @@ -290,8 +290,8 @@ static struct conddef cotab[] = { static struct builtin bintab[] = { BUILTIN("pcre_compile", 0, bin_pcre_compile, 1, 1, 0, "aimx", NULL), - BUILTIN("pcre_study", 0, bin_pcre_study, 0, 0, 0, NULL, NULL), - BUILTIN("pcre_match", 0, bin_pcre_match, 1, 1, 0, "a:v:", NULL) + BUILTIN("pcre_match", 0, bin_pcre_match, 1, 1, 0, "a:v:", NULL), + BUILTIN("pcre_study", 0, bin_pcre_study, 0, 0, 0, NULL, NULL) }; @@ -319,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; } @@ -327,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); } /**/ @@ -341,7 +341,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/regex.c b/Src/Modules/regex.c index a3d956055..00ed46b3b 100644 --- a/Src/Modules/regex.c +++ b/Src/Modules/regex.c @@ -152,7 +152,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -160,7 +160,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); } /**/ @@ -174,7 +174,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/socket.c b/Src/Modules/socket.c index 413625dcf..469568a11 100644 --- a/Src/Modules/socket.c +++ b/Src/Modules/socket.c @@ -276,7 +276,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -284,7 +284,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); } /**/ @@ -298,7 +298,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c index 1d55317ea..a3e95bb59 100644 --- a/Src/Modules/stat.c +++ b/Src/Modules/stat.c @@ -643,7 +643,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -651,7 +651,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); } /**/ @@ -665,7 +665,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/system.c b/Src/Modules/system.c index f8a188d42..4af464db0 100644 --- a/Src/Modules/system.c +++ b/Src/Modules/system.c @@ -365,7 +365,7 @@ static const struct gsu_array errnos_gsu = /**/ static void -fillpmsysparams(Param pm, char *name) +fillpmsysparams(Param pm, const char *name) { char buf[DIGBUFSIZE]; int num; @@ -390,7 +390,7 @@ fillpmsysparams(Param pm, char *name) /**/ static HashNode -getpmsysparams(UNUSED(HashTable ht), char *name) +getpmsysparams(UNUSED(HashTable ht), const char *name) { Param pm; @@ -423,8 +423,8 @@ static struct paramdef partab[] = { static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, - partab, sizeof(partab)/sizeof(*partab), NULL, 0, + partab, sizeof(partab)/sizeof(*partab), 0 }; @@ -441,7 +441,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -449,7 +449,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); } /**/ @@ -464,7 +464,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c index 1bf9b3776..d1d4e5002 100644 --- a/Src/Modules/tcp.c +++ b/Src/Modules/tcp.c @@ -696,7 +696,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -704,7 +704,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); } /**/ @@ -722,7 +722,7 @@ cleanup_(Module m) { tcp_cleanup(); freelinklist(ztcp_sessions, (FreeFunc) ztcp_free_session); - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/termcap.c b/Src/Modules/termcap.c index c19db4892..351324a68 100644 --- a/Src/Modules/termcap.c +++ b/Src/Modules/termcap.c @@ -164,10 +164,10 @@ static struct builtin bintab[] = { /**/ static HashNode -gettermcap(UNUSED(HashTable ht), char *name) +gettermcap(UNUSED(HashTable ht), const char *name) { int len, num; - char *tcstr, buf[2048], *u; + char *tcstr, buf[2048], *u, *nameu; Param pm = NULL; /* This depends on the termcap stuff in init.c */ @@ -176,16 +176,18 @@ gettermcap(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; u = buf; /* logic in the following cascade copied from echotc, above */ - if ((num = tgetnum(name)) != -1) { + if ((num = tgetnum(nameu)) != -1) { pm->gsu.i = &nullsetinteger_gsu; pm->u.val = num; pm->node.flags |= PM_INTEGER; @@ -193,7 +195,7 @@ gettermcap(UNUSED(HashTable ht), char *name) } pm->gsu.s = &nullsetscalar_gsu; - switch (ztgetflag(name)) { + switch (ztgetflag(nameu)) { case -1: break; case 0: @@ -205,7 +207,7 @@ gettermcap(UNUSED(HashTable ht), char *name) pm->node.flags |= PM_SCALAR; return &pm->node; } - if ((tcstr = tgetstr(name, &u)) != NULL && tcstr != (char *)-1) { + if ((tcstr = tgetstr(nameu, &u)) != NULL && tcstr != (char *)-1) { pm->u.str = dupstring(tcstr); pm->node.flags |= PM_SCALAR; } else { @@ -324,12 +326,12 @@ static struct features module_features = { NULL, 0, #endif NULL, 0, + NULL, 0, #ifdef HAVE_TGETENT partab, sizeof(partab)/sizeof(*partab), #else NULL, 0, #endif - NULL, 0, 0 }; @@ -344,7 +346,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -352,7 +354,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); } /**/ @@ -371,7 +373,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ 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); } /**/ diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c index 5c8822cc5..af48e80aa 100644 --- a/Src/Modules/zftp.c +++ b/Src/Modules/zftp.c @@ -3181,7 +3181,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -3189,7 +3189,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); } /**/ @@ -3221,7 +3221,7 @@ cleanup_(Module m) { deletehookfunc("exit", zftpexithook); zftp_cleanup(); - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/zprof.c b/Src/Modules/zprof.c index b30e44432..bc97771c0 100644 --- a/Src/Modules/zprof.c +++ b/Src/Modules/zprof.c @@ -225,7 +225,7 @@ zprof_wrapper(Eprog prog, FuncWrap w, char *name) struct timezone dummy; double prev = 0, now; - if (zprof_module && !(zprof_module->flags & MOD_UNLOAD)) { + if (zprof_module && !(zprof_module->node.flags & MOD_UNLOAD)) { active = 1; if (!(f = findpfunc(name))) { f = (Pfunc) zalloc(sizeof(*f)); @@ -260,7 +260,7 @@ zprof_wrapper(Eprog prog, FuncWrap w, char *name) } runshfunc(prog, w, name); if (active) { - if (zprof_module && !(zprof_module->flags & MOD_UNLOAD)) { + if (zprof_module && !(zprof_module->node.flags & MOD_UNLOAD)) { tv.tv_sec = tv.tv_usec = 0; gettimeofday(&tv, &dummy); @@ -315,7 +315,7 @@ setup_(Module m) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -323,7 +323,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); } /**/ @@ -345,7 +345,7 @@ cleanup_(Module m) freepfuncs(calls); freeparcs(arcs); deletewrapper(m, wrapper); - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c index 3280b8175..7e140102e 100644 --- a/Src/Modules/zpty.c +++ b/Src/Modules/zpty.c @@ -750,7 +750,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -758,7 +758,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); } /**/ @@ -777,7 +777,7 @@ cleanup_(Module m) { deletehookfunc("exit", ptyhook); deleteallptycmds(); - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/zselect.c b/Src/Modules/zselect.c index 3e71fa3bd..c02074646 100644 --- a/Src/Modules/zselect.c +++ b/Src/Modules/zselect.c @@ -294,7 +294,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -302,7 +302,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); } /**/ @@ -317,7 +317,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c index 127509b01..76056308f 100644 --- a/Src/Modules/zutil.c +++ b/Src/Modules/zutil.c @@ -1801,10 +1801,10 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) } static struct builtin bintab[] = { - BUILTIN("zstyle", 0, bin_zstyle, 0, -1, 0, NULL, NULL), BUILTIN("zformat", 0, bin_zformat, 3, -1, 0, NULL, NULL), - BUILTIN("zregexparse", 0, bin_zregexparse, 3, -1, 0, "c", NULL), BUILTIN("zparseopts", 0, bin_zparseopts, 1, -1, 0, NULL, NULL), + BUILTIN("zregexparse", 0, bin_zregexparse, 3, -1, 0, "c", NULL), + BUILTIN("zstyle", 0, bin_zstyle, 0, -1, 0, NULL, NULL), }; static struct features module_features = { @@ -1828,7 +1828,7 @@ setup_(UNUSED(Module m)) int features_(Module m, char ***features) { - *features = featuresarray(m->nam, &module_features); + *features = featuresarray(m, &module_features); return 0; } @@ -1836,7 +1836,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); } /**/ @@ -1850,7 +1850,7 @@ boot_(Module m) int cleanup_(Module m) { - return setfeatureenables(m->nam, &module_features, NULL); + return setfeatureenables(m, &module_features, NULL); } /**/ |