summaryrefslogtreecommitdiffstats
path: root/txr.c
diff options
context:
space:
mode:
Diffstat (limited to 'txr.c')
-rw-r--r--txr.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/txr.c b/txr.c
index 21e30f87..c8d7b5e9 100644
--- a/txr.c
+++ b/txr.c
@@ -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;