From f5baf2630ab0cf51306bb94311e7eed84caa730d Mon Sep 17 00:00:00 2001 From: Wolfgang Corcoran-Mathe Date: Sun, 24 Jul 2016 21:04:27 -0400 Subject: [PATCH] ed: Don't match against line 0 in search() regexec(3) happily matches /^$/ against the text of line zero (the null string), causing an error. Also update email address for Wolfgang Corcoran-Mathe --- LICENSE | 2 +- ed.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 6c0fc52..c86f70d 100644 --- a/LICENSE +++ b/LICENSE @@ -58,6 +58,6 @@ Authors/contributors include: © 2015 Tai Chi Minh Ralph Eastwood © 2015 Quentin Rameau © 2015 Dionysis Grigoropoulos -© 2015 Wolfgang Corcoran-Mathe +© 2015 Wolfgang Corcoran-Mathe © 2016 Mattias Andrée © 2016 Eivind Uggedal diff --git a/ed.c b/ed.c index 184ed30..0cf9fb9 100644 --- a/ed.c +++ b/ed.c @@ -426,7 +426,7 @@ search(int way) i = curln; do { i = (way == '?') ? prevln(i) : nextln(i); - if (match(i)) + if (i > 0 && match(i)) return i; } while (i != curln);