diff options
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; |