summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-12 11:46:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:20:13 -0500
commitadb7fd18e5e58bc466bdd31d68423e5f958a1d5d (patch)
tree1af5f5d9ca3223bc70eb6293f715e4ab3db329b6 /source4/scripting/ejs
parenta4c614b01279e7f89ceea4b2dffccee6cefe37dc (diff)
downloadsamba-adb7fd18e5e58bc466bdd31d68423e5f958a1d5d.tar.gz
samba-adb7fd18e5e58bc466bdd31d68423e5f958a1d5d.tar.bz2
samba-adb7fd18e5e58bc466bdd31d68423e5f958a1d5d.zip
r8372: - split out provisioning logic into a separate ejs library
- added a provisioning web page (This used to be commit 7476cb94132cf2849ec19360468904ca6fe8de2c)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r--source4/scripting/ejs/smbcalls_string.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/scripting/ejs/smbcalls_string.c b/source4/scripting/ejs/smbcalls_string.c
index ad998701f6..6597f3b27b 100644
--- a/source4/scripting/ejs/smbcalls_string.c
+++ b/source4/scripting/ejs/smbcalls_string.c
@@ -27,6 +27,20 @@
/*
usage:
+ var len = strlen(str);
+*/
+static int ejs_strlen(MprVarHandle eid, int argc, char **argv)
+{
+ if (argc != 1) {
+ ejsSetErrorMsg(eid, "strlen invalid arguments");
+ return -1;
+ }
+ mpr_Return(eid, mprCreateIntegerVar(strlen_m(argv[0])));
+ return 0;
+}
+
+/*
+ usage:
var s = strlower("UPPER");
*/
static int ejs_strlower(MprVarHandle eid, int argc, char **argv)
@@ -311,6 +325,7 @@ static int ejs_vsprintf(MprVarHandle eid, int argc, struct MprVar **argv)
*/
void smb_setup_ejs_string(void)
{
+ ejsDefineStringCFunction(-1, "strlen", ejs_strlen, NULL, MPR_VAR_SCRIPT_HANDLE);
ejsDefineStringCFunction(-1, "strlower", ejs_strlower, NULL, MPR_VAR_SCRIPT_HANDLE);
ejsDefineStringCFunction(-1, "strupper", ejs_strupper, NULL, MPR_VAR_SCRIPT_HANDLE);
ejsDefineStringCFunction(-1, "split", ejs_split, NULL, MPR_VAR_SCRIPT_HANDLE);