svn commit: samba r8452 - in
branches/SAMBA_4_0/source/scripting/ejs: .
tridge at samba.org
tridge at samba.org
Thu Jul 14 07:21:59 GMT 2005
Author: tridge
Date: 2005-07-14 07:21:59 +0000 (Thu, 14 Jul 2005)
New Revision: 8452
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8452
Log:
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.
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-07-14 07:04:21 UTC (rev 8451)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbscript.c 2005-07-14 07:21:59 UTC (rev 8452)
@@ -83,16 +83,16 @@
/* load the script and advance past interpreter line*/
script = file_load(fname, &script_size, mem_ctx);
- 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--;
- }
+ /* allow scriptable js */
+ if (strncmp(script, "#!", 2) == 0) {
+ script += strcspn(script, "\r\n");
+ script += strspn(script, "\r\n");
}
+ /* 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 */
if (ejsEvalScript(eid, script, &result, &emsg) == -1) {
More information about the samba-cvs
mailing list