From 3f74aa2f7a1ef3703d749edae627cb3766d40434 Mon Sep 17 00:00:00 2001 From: Magnus Henoch Date: Tue, 8 Jan 2013 12:35:33 +0000 Subject: escript to accept emulator arguments when script file has no shebang According to the documentation, if the second or third line in a script starts with %%!, then escript will use the rest of the line as emulator options. However, previously this was only the case if the first line started with #!. This change removes that check, and unconditionally uses the %%! line if present. --- erts/etc/common/escript.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'erts') diff --git a/erts/etc/common/escript.c b/erts/etc/common/escript.c index 9e80ec6656..3566406bf3 100644 --- a/erts/etc/common/escript.c +++ b/erts/etc/common/escript.c @@ -264,7 +264,7 @@ append_shebang_args(char* scriptname) static char linebuf[LINEBUFSZ]; char* ptr = fgets(linebuf, LINEBUFSZ, fd); - if (ptr != NULL && linebuf[0] == '#' && linebuf[1] == '!') { + if (ptr != NULL) { /* Try to find args on second or third line */ ptr = fgets(linebuf, LINEBUFSZ, fd); if (ptr != NULL && linebuf[0] == '%' && linebuf[1] == '%' && linebuf[2] == '!') { -- cgit v1.2.3