about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xatxec.c2
-rwxr-xr-xt/regression.t12
2 files changed, 13 insertions, 1 deletions
diff --git a/atxec.c b/atxec.c
index 9432c56..f1bdf7e 100755
--- a/atxec.c
+++ b/atxec.c
@@ -49,7 +49,7 @@ arg_splice(char *s)
 	while (1) {
 		while (isspace(*s) || *s == '#')
 			if (*s == '#')  /* skip line comment */
-				while (*s != '\n')
+				while (*s && *s != '\n')
 					s++;
 			else
 				s++;
diff --git a/t/regression.t b/t/regression.t
new file mode 100755
index 0000000..6ac2435
--- /dev/null
+++ b/t/regression.t
@@ -0,0 +1,12 @@
+#!/bin/sh
+export "PATH=.:$PATH"
+
+printf '1..1\n'
+printf '# regression tests\n'
+
+tap3 'comments without newline' <<'EOF'
+printf '# foo' >two
+atxec echo 1 @two 3
+>>>
+1 3
+EOF