aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-03-24 04:06:42 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-03-24 04:06:42 -0700
commit72d01494705ddb72237ee6a85ea27491684c7227 (patch)
tree11607e284d6f1c0695f6590bf293ca4248a1d312
parent39c8fd12550671adac2a44061a5646d0102e95db (diff)
downloadcppawk-72d01494705ddb72237ee6a85ea27491684c7227.tar.gz
cppawk-72d01494705ddb72237ee6a85ea27491684c7227.tar.bz2
cppawk-72d01494705ddb72237ee6a85ea27491684c7227.zip
don't delete hash-bang line; replace with #
This preserves the line numbers.
-rwxr-xr-xcppawk2
-rw-r--r--testcases9
2 files changed, 10 insertions, 1 deletions
diff --git a/cppawk b/cppawk
index cb6987e..876a5bb 100755
--- a/cppawk
+++ b/cppawk
@@ -37,7 +37,7 @@ prepro_opts="-D__gawk__=1 -D__cppawk_ver=20220324"
awk_file=
awk_opts=
tmp_file=
-delhashbang="sed -e /^#!/d --"
+delhashbang="sed -e 1s/^#!.*/#/ --"
prepro_only=
selfdir=$(dirname "$0")
diff --git a/testcases b/testcases
index fd81e02..39519a0 100644
--- a/testcases
+++ b/testcases
@@ -223,3 +223,12 @@ foo
bar
baz
+--
+40:
+./cppawk '#!hashbang
+BEGIN { print __LINE__
+
+ print __LINE__ }'
+:
+2
+4