1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +03:00

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)
This commit is contained in:
Tim Potter 2005-06-03 08:00:42 +00:00 committed by Gerald (Jerry) Carter
parent 65d685c722
commit afeaf137c4

View File

@ -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);
}