summary refs log tree commit diff
path: root/bin/cash/input.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-01-10 20:05:18 -0500
committerJune McEnroe <june@causal.agency>2019-01-10 20:05:18 -0500
commit75f6ed0d8f93446d8442cf7bcd97cb36ee956c7a (patch)
tree4d1557b37bd37bbbd4404e5661a343a5b5264bb9 /bin/cash/input.c
parentReplace eaccess with faccessat (diff)
downloadsrc-75f6ed0d8f93446d8442cf7bcd97cb36ee956c7a.tar.gz
src-75f6ed0d8f93446d8442cf7bcd97cb36ee956c7a.zip
Replace strchrnul with strchr
Diffstat (limited to '')
-rw-r--r--bin/cash/input.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/cash/input.c b/bin/cash/input.c
index feb782e7..24ba73b5 100644
--- a/bin/cash/input.c
+++ b/bin/cash/input.c
@@ -224,7 +224,8 @@ again:
 	p = parsefile->buf + (parsenextc - parsefile->buf);
 	end = p + parselleft;
 	*end = '\0';
-	q = strchrnul(p, '\n');
+	q = strchr(p, '\n');
+	if (!q) q = strchr(p, '\0');
 	if (q != end && *q == '\0') {
 		/* delete nul characters */
 		for (r = q; q != end; q++) {
@@ -236,7 +237,8 @@ again:
 			goto again;
 		end = p + parselleft;
 		*end = '\0';
-		q = strchrnul(p, '\n');
+		q = strchr(p, '\n');
+		if (!q) q = strchr(p, '\0');
 	}
 	if (q == end) {
 		parsenleft = parselleft;