summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-06-03 12:04:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:27 -0500
commitc1b95bd467109793333c15ea44ec910ffe3e86b4 (patch)
tree3d7d754a14c7d8f8e734a75495d87c7b695c8455 /source4/scripting
parent042ab1adbe9b06cf945006fd0752152ffb913c04 (diff)
downloadsamba-c1b95bd467109793333c15ea44ec910ffe3e86b4.tar.gz
samba-c1b95bd467109793333c15ea44ec910ffe3e86b4.tar.bz2
samba-c1b95bd467109793333c15ea44ec910ffe3e86b4.zip
r7223: Advance script past interpreter line.
(This used to be commit 31b9fadbed656f666f587a9dcb5a7627a2d388aa)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/ejs/smbscript.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/scripting/ejs/smbscript.c b/source4/scripting/ejs/smbscript.c
index 323e604f8d..43a9377143 100644
--- a/source4/scripting/ejs/smbscript.c
+++ b/source4/scripting/ejs/smbscript.c
@@ -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);