diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-11-23 13:36:27 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-11-23 13:36:27 -0800 |
commit | 73126c7aff72a9eb688e29ea557780c4d9ba5f47 (patch) | |
tree | 7cdfe6f60a48d0ce02b327c54507b5a99b9de801 /txr.c | |
parent | 41fc1ec1db8a937c893520589fb5af5ae01c693b (diff) | |
download | txr-73126c7aff72a9eb688e29ea557780c4d9ba5f47.tar.gz txr-73126c7aff72a9eb688e29ea557780c4d9ba5f47.tar.bz2 txr-73126c7aff72a9eb688e29ea557780c4d9ba5f47.zip |
* txr.c (remove_hash_bang_line): Recognize multiple
syntax possibilities. A hash bang could be buried in a (text ...)
compound, or it could just be a string (thanks to the text form
optimization).
Diffstat (limited to 'txr.c')
-rw-r--r-- | txr.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -131,14 +131,19 @@ static val remove_hash_bang_line(val spec) val shbang = string(L"#!"); val firstline = first(spec); val firstelem = first(firstline); - - if (consp(firstelem) && first(firstelem) == text_s) { - val item = second(firstelem); - if (stringp(item)) { - val twochars = sub_str(item, zero, two); - if (equal(twochars, shbang)) - return rest(spec); - } + val item; + + if (stringp(firstelem)) + item = firstelem; + else if (consp(firstelem) && first(firstelem) == text_s) + item = second(firstelem); + else + return spec; + + if (stringp(item)) { + val twochars = sub_str(item, zero, two); + if (equal(twochars, shbang)) + return rest(spec); } return spec; |