svn commit: samba r7075 - in
branches/SAMBA_4_0/source/scripting/ejs: .
tridge at samba.org
tridge at samba.org
Sun May 29 11:58:15 GMT 2005
Author: tridge
Date: 2005-05-29 11:58:14 +0000 (Sun, 29 May 2005)
New Revision: 7075
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7075
Log:
added support for ARGV[] in ejs scripts
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-05-29 11:43:52 UTC (rev 7074)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbscript.c 2005-05-29 11:58:14 UTC (rev 7075)
@@ -37,8 +37,11 @@
MprVar result;
char *emsg;
TALLOC_CTX *mem_ctx = talloc_new(NULL);
+ const char **argv_list = NULL;
+ struct MprVar v;
+ int i;
- if (argc != 2) {
+ if (argc < 2) {
fprintf(stderr, "Usage: %s <scriptfile>\n", argv[0]);
exit(1);
}
@@ -67,6 +70,14 @@
exit(1);
}
+ /* setup ARGV[] in the ejs environment */
+ for (i=2;i<argc;i++) {
+ argv_list = str_list_add(argv_list, argv[i]);
+ }
+ v = mprList("ARGV", argv_list);
+ mprCreateProperty(ejsGetGlobalObject(eid), "ARGV", &v);
+
+ /* run the script */
if (ejsEvalFile(eid, discard_const_p(char, argv[1]), &result,
&emsg) == -1) {
fprintf(stderr, "smbscript: ejsEvalScript(): %s\n", emsg);
More information about the samba-cvs
mailing list