Author: vlendec
Date: 2005-05-29 08:12:16 +0000 (Sun, 29 May 2005)
New Revision: 7069

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

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

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 04:24:09 UTC 
(rev 7068)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbscript.c 2005-05-29 08:12:16 UTC 
(rev 7069)
@@ -47,6 +47,11 @@
        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 @@
                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);
        }

Reply via email to