From afeaf137c4cbcbde1d6e4c9921bb769a1d486aff Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 3 Jun 2005 08:00:42 +0000 Subject: 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) --- source4/scripting/ejs/smbscript.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source4/scripting/ejs') 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); } -- cgit