summaryrefslogtreecommitdiffstats
path: root/source4/scripting/ejs/smbcalls_sys.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-15 07:45:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:23:08 -0500
commit7913cbbe11075c75770d37cf2e0da8f7af51a7fc (patch)
tree4ee9f5466c1079dfcc2b286ddf604547ad4467a6 /source4/scripting/ejs/smbcalls_sys.c
parenta0bc4da1a307753e3b28a11863f50d66b0894190 (diff)
downloadsamba-7913cbbe11075c75770d37cf2e0da8f7af51a7fc.tar.gz
samba-7913cbbe11075c75770d37cf2e0da8f7af51a7fc.tar.xz
samba-7913cbbe11075c75770d37cf2e0da8f7af51a7fc.zip
r8484: switched the sys_*() calls to the OO interface
tim, do you want to do the cli_*() calls now? (This used to be commit 9991e924e9dacec663a5d040ccfc878927fc3afa)
Diffstat (limited to 'source4/scripting/ejs/smbcalls_sys.c')
-rw-r--r--source4/scripting/ejs/smbcalls_sys.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c
index 4dc5045ff6b..af51c815dc3 100644
--- a/source4/scripting/ejs/smbcalls_sys.c
+++ b/source4/scripting/ejs/smbcalls_sys.c
@@ -171,16 +171,30 @@ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv)
/*
+ initialise sys ejs subsystem
+*/
+static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv)
+{
+ struct MprVar obj = mprObject("sys");
+
+ mprSetCFunction(&obj, "interfaces", ejs_sys_interfaces);
+ mprSetCFunction(&obj, "hostname", ejs_sys_hostname);
+ mprSetCFunction(&obj, "nttime", ejs_sys_nttime);
+ mprSetCFunction(&obj, "gmtime", ejs_sys_gmtime);
+ mprSetCFunction(&obj, "ldaptime", ejs_sys_ldaptime);
+ mprSetStringCFunction(&obj, "unlink", ejs_sys_unlink);
+ mprSetStringCFunction(&obj, "file_load", ejs_sys_file_load);
+ mprSetStringCFunction(&obj, "file_save", ejs_sys_file_save);
+
+ mpr_Return(eid, obj);
+ return 0;
+}
+
+
+/*
setup C functions that be called from ejs
*/
void smb_setup_ejs_system(void)
{
- ejsDefineCFunction(-1, "sys_interfaces", ejs_sys_interfaces, NULL, MPR_VAR_SCRIPT_HANDLE);
- ejsDefineCFunction(-1, "sys_hostname", ejs_sys_hostname, NULL, MPR_VAR_SCRIPT_HANDLE);
- ejsDefineCFunction(-1, "sys_nttime", ejs_sys_nttime, NULL, MPR_VAR_SCRIPT_HANDLE);
- ejsDefineCFunction(-1, "sys_gmtime", ejs_sys_gmtime, NULL, MPR_VAR_SCRIPT_HANDLE);
- ejsDefineCFunction(-1, "sys_ldaptime", ejs_sys_ldaptime, NULL, MPR_VAR_SCRIPT_HANDLE);
- ejsDefineStringCFunction(-1, "sys_unlink", ejs_sys_unlink, NULL, MPR_VAR_SCRIPT_HANDLE);
- ejsDefineStringCFunction(-1, "sys_file_load", ejs_sys_file_load, NULL, MPR_VAR_SCRIPT_HANDLE);
- ejsDefineStringCFunction(-1, "sys_file_save", ejs_sys_file_save, NULL, MPR_VAR_SCRIPT_HANDLE);
+ ejsDefineCFunction(-1, "sys_init", ejs_sys_init, NULL, MPR_VAR_SCRIPT_HANDLE);
}