summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-06-03 08:00:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:27 -0500
commitafeaf137c4cbcbde1d6e4c9921bb769a1d486aff (patch)
tree0ede40ca0c8f1fa72267f53267cdb1fea4c7cf6d
parent65d685c722ecf51bf84bb24af66c1f30c33b3b96 (diff)
downloadsamba-afeaf137c4cbcbde1d6e4c9921bb769a1d486aff.tar.gz
samba-afeaf137c4cbcbde1d6e4c9921bb769a1d486aff.tar.bz2
samba-afeaf137c4cbcbde1d6e4c9921bb769a1d486aff.zip
r7215: Convert smbscript to use ejsEvalScript() and file_load() instead of
ejsEvalFile(). Still need to add advancement of the script past the hash-bang line but it's home time now!! (This used to be commit 14a2053c045a2df1d68838900c833c2a15cb5a36)
-rw-r--r--source4/scripting/ejs/smbscript.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source4/scripting/ejs/smbscript.c b/source4/scripting/ejs/smbscript.c
index 754a49ccb1..323e604f8d 100644
--- a/source4/scripting/ejs/smbscript.c
+++ b/source4/scripting/ejs/smbscript.c
@@ -35,7 +35,8 @@ void ejs_exception(const char *reason)
EjsId eid;
EjsHandle handle = 0;
MprVar result;
- char *emsg;
+ char *emsg, *script;
+ size_t script_size;
TALLOC_CTX *mem_ctx = talloc_new(NULL);
const char **argv_list = NULL;
struct MprVar v;
@@ -79,10 +80,12 @@ void ejs_exception(const char *reason)
v = mprList("ARGV", argv_list);
mprCreateProperty(ejsGetGlobalObject(eid), "ARGV", &v);
+ /* load the script and advance past interpreter line*/
+ script = file_load(argv[1], &script_size);
+
/* run the script */
- if (ejsEvalFile(eid, discard_const_p(char, argv[1]), &result,
- &emsg) == -1) {
- fprintf(stderr, "smbscript: ejsEvalFile(): %s\n", emsg);
+ if (ejsEvalScript(eid, script, &result, &emsg) == -1) {
+ fprintf(stderr, "smbscript: ejsEvalScript(): %s\n", emsg);
exit(1);
}