mirror of
https://github.com/samba-team/samba.git
synced 2024-12-27 03:21:53 +03:00
r8452: allow for the ugly hack:
#!/bin/sh exec smbscript "$0" ${1+"$@"} which is needed because bloody solaris puts 'env' in /bin instead of /usr/bin also neaten up the #! handling code.
This commit is contained in:
parent
3c4291e49a
commit
778bcd3738
@ -83,15 +83,15 @@ void ejs_exception(const char *reason)
|
|||||||
/* load the script and advance past interpreter line*/
|
/* load the script and advance past interpreter line*/
|
||||||
script = file_load(fname, &script_size, mem_ctx);
|
script = file_load(fname, &script_size, mem_ctx);
|
||||||
|
|
||||||
if ((script_size > 2) && script[0] == '#' && script[1] == '!') {
|
/* allow scriptable js */
|
||||||
script += 2;
|
if (strncmp(script, "#!", 2) == 0) {
|
||||||
script_size -= 2;
|
script += strcspn(script, "\r\n");
|
||||||
while (script_size) {
|
script += strspn(script, "\r\n");
|
||||||
if (*script == '\r' || *script == '\n')
|
|
||||||
break;
|
|
||||||
script++;
|
|
||||||
script_size--;
|
|
||||||
}
|
}
|
||||||
|
/* and this copes with the ugly exec hack */
|
||||||
|
if (strncmp(script, "exec ", 5) == 0) {
|
||||||
|
script += strcspn(script, "\r\n");
|
||||||
|
script += strspn(script, "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run the script */
|
/* run the script */
|
||||||
|
Loading…
Reference in New Issue
Block a user