diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-08-05 15:30:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:18 -0500 |
commit | beed5b8532400d79fd40fc53ebae1666adc9af34 (patch) | |
tree | e4df28e320076202faa68a6dc10a6721a5bdd055 /source4/scripting/ejs | |
parent | 0e6369f5e80d506d532e0e352b02d7d65d16db49 (diff) | |
download | samba-beed5b8532400d79fd40fc53ebae1666adc9af34.tar.gz samba-beed5b8532400d79fd40fc53ebae1666adc9af34.tar.bz2 samba-beed5b8532400d79fd40fc53ebae1666adc9af34.zip |
r9119: added a lp.categories() call in the loadparm js object, to allow
retrieval of the smb.conf parameter categories. This will make writing
a smb.conf editor easier.
(This used to be commit 8db549b1506b5260c9eb16f40bbdae6a7c006fa2)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r-- | source4/scripting/ejs/smbcalls_config.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/scripting/ejs/smbcalls_config.c b/source4/scripting/ejs/smbcalls_config.c index ddb06aa7d7..a69c3d81f9 100644 --- a/source4/scripting/ejs/smbcalls_config.c +++ b/source4/scripting/ejs/smbcalls_config.c @@ -45,6 +45,27 @@ static int ejs_lpServices(MprVarHandle eid, int argc, char **argv) /* + return a list of parameter categories +*/ +static int ejs_lpCategories(MprVarHandle eid, int argc, char **argv) +{ + struct parm_struct *parm_table = lp_parm_table(); + int i; + const char **list = NULL; + if (argc != 0) return -1; + + for (i=0;parm_table[i].label;i++) { + if (parm_table[i].class == P_SEPARATOR) { + list = str_list_add(list, parm_table[i].label); + } + } + talloc_steal(mprMemCtx(), list); + mpr_Return(eid, mprList("categories", list)); + return 0; +} + + +/* allow access to loadparm variables from inside ejs scripts in swat can be called in 4 ways: @@ -185,6 +206,7 @@ static int ejs_loadparm_init(MprVarHandle eid, int argc, struct MprVar **argv) mprSetStringCFunction(obj, "set", ejs_lpSet); mprSetStringCFunction(obj, "reload", ejs_lpReload); mprSetStringCFunction(obj, "services", ejs_lpServices); + mprSetStringCFunction(obj, "categories", ejs_lpCategories); return 0; } |