summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-12 06:57:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:20:10 -0500
commit26a55c330a8cd79da290b2ad0e15aaf94be6ebcf (patch)
tree85c23207c8baac99d60163bb3e3089d7e2cabb04 /source4
parent102e24761189306fdf6233481ada43e99a56b5e7 (diff)
downloadsamba-26a55c330a8cd79da290b2ad0e15aaf94be6ebcf.tar.gz
samba-26a55c330a8cd79da290b2ad0e15aaf94be6ebcf.tar.bz2
samba-26a55c330a8cd79da290b2ad0e15aaf94be6ebcf.zip
r8355: - added a vsprintf() function
- removed the --outputdir option from provision, as its not used any more (as ejs knows the real paths) (This used to be commit abbf9c703c17c2edc2d978dade3619a96c38d0d9)
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/ejs/smbcalls_string.c36
-rw-r--r--source4/scripting/libjs/base.js8
-rwxr-xr-xsource4/setup/provision2
3 files changed, 44 insertions, 2 deletions
diff --git a/source4/scripting/ejs/smbcalls_string.c b/source4/scripting/ejs/smbcalls_string.c
index 7a19ecdf2c..ad998701f6 100644
--- a/source4/scripting/ejs/smbcalls_string.c
+++ b/source4/scripting/ejs/smbcalls_string.c
@@ -272,6 +272,41 @@ failed:
}
/*
+ used to build your own print function
+ str = vsprintf(args);
+*/
+static int ejs_vsprintf(MprVarHandle eid, int argc, struct MprVar **argv)
+{
+ struct MprVar **args, *len, *v;
+ int i, ret, length;
+ if (argc != 1 || argv[0]->type != MPR_TYPE_OBJECT) {
+ ejsSetErrorMsg(eid, "vsprintf invalid arguments");
+ return -1;
+ }
+ v = argv[0];
+ len = mprGetProperty(v, "length", NULL);
+ if (len == NULL) {
+ ejsSetErrorMsg(eid, "vsprintf takes an array");
+ return -1;
+ }
+ length = mprToInt(len);
+ args = talloc_array(mprMemCtx(), struct MprVar *, length);
+ if (args == NULL) {
+ return -1;
+ }
+
+ for (i=0;i<length;i++) {
+ char idx[16];
+ mprItoa(i, idx, sizeof(idx));
+ args[i] = mprGetProperty(v, idx, NULL);
+ }
+
+ ret = ejs_sprintf(eid, length, args);
+ talloc_free(args);
+ return ret;
+}
+
+/*
setup C functions that be called from ejs
*/
void smb_setup_ejs_string(void)
@@ -281,4 +316,5 @@ void smb_setup_ejs_string(void)
ejsDefineStringCFunction(-1, "split", ejs_split, NULL, MPR_VAR_SCRIPT_HANDLE);
ejsDefineCFunction(-1, "join", ejs_join, NULL, MPR_VAR_SCRIPT_HANDLE);
ejsDefineCFunction(-1, "sprintf", ejs_sprintf, NULL, MPR_VAR_SCRIPT_HANDLE);
+ ejsDefineCFunction(-1, "vsprintf", ejs_vsprintf, NULL, MPR_VAR_SCRIPT_HANDLE);
}
diff --git a/source4/scripting/libjs/base.js b/source4/scripting/libjs/base.js
index c6b05755c4..181b3ca959 100644
--- a/source4/scripting/libjs/base.js
+++ b/source4/scripting/libjs/base.js
@@ -10,6 +10,14 @@ if (global["HAVE_BASE_JS"] != undefined) {
HAVE_BASE_JS=1
/*
+ an essential function!
+*/
+function printf()
+{
+ print(vsprintf(arguments));
+}
+
+/*
helper function to setup a rpc io object, ready for input
*/
function irpcObj()
diff --git a/source4/setup/provision b/source4/setup/provision
index c388a10bf9..f37907241e 100755
--- a/source4/setup/provision
+++ b/source4/setup/provision
@@ -26,7 +26,6 @@ ok = GetOptions(ARGV, options,
'nogroup=s',
'wheel=s',
'users=s',
- 'outputdir=s',
'quiet');
if (ok == false) {
println("Failed to parse options: " + options.ERROR);
@@ -200,7 +199,6 @@ provision.pl [options]
--host-ip IPADDRESS set ipaddress
--host-guid GUID set hostguid (otherwise random)
--invocationid GUID set invocationid (otherwise random)
- --outputdir OUTPUTDIR set output directory
--adminpass PASSWORD choose admin password (otherwise random)
--krbtgtpass PASSWORD choose krbtgt password (otherwise random)
--machinepass PASSWORD choose machine password (otherwise random)