r7223: Advance script past interpreter line.
authorTim Potter <tpot@samba.org>
Fri, 3 Jun 2005 12:04:26 +0000 (12:04 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:27 +0000 (13:17 -0500)
(This used to be commit 31b9fadbed656f666f587a9dcb5a7627a2d388aa)

source4/scripting/ejs/smbscript.c

index 323e604f8dfe20c4b8e65cdaedcdc94775aa7d39..43a93771436f9fcb6e7003835b269e538c12d653 100644 (file)
@@ -83,6 +83,17 @@ void ejs_exception(const char *reason)
        /* load the script and advance past interpreter line*/
        script = file_load(argv[1], &script_size);
 
+       if ((script_size > 2) && script[0] == '#' && script[1] == '!') {
+               script += 2;
+               script_size -= 2;
+               while (script_size) {
+                       if (*script == '\r' || *script == '\n')
+                               break;
+                       script++;
+                       script_size--;
+               }
+       }
+
        /* run the script */
        if (ejsEvalScript(eid, script, &result, &emsg) == -1) {
                fprintf(stderr, "smbscript: ejsEvalScript(): %s\n", emsg);