diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-05-29 08:12:16 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:11 -0500 |
commit | 21f3a3921c03777beb7e3072152ae33956b38807 (patch) | |
tree | d345916988b09312205172423051b49d64f7be4a /source4/scripting/ejs | |
parent | b7ed3fa7d23a59d43b9cc57b28b5870350630138 (diff) | |
download | samba-21f3a3921c03777beb7e3072152ae33956b38807.tar.gz samba-21f3a3921c03777beb7e3072152ae33956b38807.tar.bz2 samba-21f3a3921c03777beb7e3072152ae33956b38807.zip |
r7069: Add a little usage message to smbscript and fix a compiler warning. My
compiler still complains about "handle" (scripting/ejs/smbscrip.c:46) possibly
not being initialized and to me this looks true.
Running smbscript with the trivial write("Hello, world\n"); also leaves some
memory around.
Volker
(This used to be commit 06d27a19213dc8fe6dfc948a5e8cbafa74db7a29)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r-- | source4/scripting/ejs/smbscript.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source4/scripting/ejs/smbscript.c b/source4/scripting/ejs/smbscript.c index 0b0a446839..57f42688d6 100644 --- a/source4/scripting/ejs/smbscript.c +++ b/source4/scripting/ejs/smbscript.c @@ -47,6 +47,11 @@ static int writeProc(MprVarHandle userHandle, int argc, char **argv) MprVar result; char *emsg; + if (argc != 2) { + fprintf(stderr, "Usage: %s <scriptfile>\n", argv[0]); + exit(1); + } + if (ejsOpen(NULL, NULL, NULL) != 0) { fprintf(stderr, "smbscript: ejsOpen(): unable to initialise " "EJ subsystem\n"); @@ -61,7 +66,8 @@ static int writeProc(MprVarHandle userHandle, int argc, char **argv) exit(1); } - if (ejsEvalFile(eid, (char *)argv[1], &result, &emsg) == -1) { + if (ejsEvalFile(eid, discard_const_p(char, argv[1]), &result, + &emsg) == -1) { fprintf(stderr, "smbscript: ejsEvalScript(): %s\n", emsg); exit(1); } |