svn commit: samba r7215 - in branches/SAMBA_4_0/source/scripting/ejs: .

tpot at samba.org tpot at samba.org
Fri Jun 3 08:00:42 GMT 2005


Author: tpot
Date: 2005-06-03 08:00:42 +0000 (Fri, 03 Jun 2005)
New Revision: 7215

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7215

Log:
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!!

Modified:
   branches/SAMBA_4_0/source/scripting/ejs/smbscript.c


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/ejs/smbscript.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/smbscript.c	2005-06-03 07:56:41 UTC (rev 7214)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbscript.c	2005-06-03 08:00:42 UTC (rev 7215)
@@ -35,7 +35,8 @@
 	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 @@
 	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);
 	}
 



More information about the samba-cvs mailing list