diff options
author | Tim Potter <tpot@samba.org> | 2005-06-03 07:47:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:26 -0500 |
commit | 0253adcab3157ec73cc96ad74b19faa2c87e067a (patch) | |
tree | eee6899cbb8af08bfd16c68b0b740dbb4346bd06 /source4/lib/ejs/ejsLex.c | |
parent | b82d8c9928f7a39dbc552f99e1128e736d050622 (diff) | |
download | samba-0253adcab3157ec73cc96ad74b19faa2c87e067a.tar.gz samba-0253adcab3157ec73cc96ad74b19faa2c87e067a.tar.bz2 samba-0253adcab3157ec73cc96ad74b19faa2c87e067a.zip |
r7213: Add a small bit to the ejs parser to ignore a #!/path/to/interpreter
as the first line of the script. This allows smbscript to be used as an
interpreter.
(This used to be commit 875c8164096e7334de25cc57ac4b8bdc39b9c46b)
Diffstat (limited to 'source4/lib/ejs/ejsLex.c')
-rw-r--r-- | source4/lib/ejs/ejsLex.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source4/lib/ejs/ejsLex.c b/source4/lib/ejs/ejsLex.c index b0d6483c2a..81f56b092e 100644 --- a/source4/lib/ejs/ejsLex.c +++ b/source4/lib/ejs/ejsLex.c @@ -674,6 +674,26 @@ static int getLexicalToken(Ejs *ep, int state) inputPutback(ep, c); return EJS_TOK_NUMBER; + case '#': + if (ip->lineNumber == 1) { + if ((c = inputGetc(ep)) < 0) { + ejsError(ep, "Syntax Error"); + return EJS_TOK_ERR; + } + if (c != '!') { + ejsError(ep, "Syntax Error"); + return EJS_TOK_ERR; + } + while ((c = inputGetc(ep)) != -1) { + if (c == '\r' || c == '\n') + break; + tokenAddChar(ep, c); + } + return EJS_TOK_HASHBANG; + } + + /* Fall through to default handling */ + default: /* * Identifiers or a function names |