From 0bca9fd9dc84ca6b4d6d6f46b462d05d10b4f5e9 Mon Sep 17 00:00:00 2001 From: Andrew Moore Date: Fri, 27 Aug 1993 22:14:24 +0000 Subject: [PATCH] Only a single slash (/) is now necessary to repeat a search as per Theo's request. So the command: /pattern/;/ finds the second line containing "pattern" after the current line. Caveat: The commands `st' and `sr' are now both legal and have very different meanings. This is because ed(1) extends POSIX to include the old Berkeley syntax s[rgp]*. (So should two slashes still be required in the case of the substitute command, as SunOS ed does?) --- bin/ed/re.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bin/ed/re.c b/bin/ed/re.c index 2bf12219f8d..7553d5f2e33 100644 --- a/bin/ed/re.c +++ b/bin/ed/re.c @@ -64,13 +64,10 @@ optpat() char delim; int n; - if ((delim = *ibufp) == '\n') { - if (!exp) sprintf(errmsg, "no previous pattern"); - return exp; - } else if (delim == ' ' || *++ibufp == '\n') { + if ((delim = *ibufp) == ' ') { sprintf(errmsg, "invalid pattern delimiter"); return NULL; - } else if (*ibufp == delim) { + } else if (delim == '\n' || *++ibufp == '\n' || *ibufp == delim) { if (!exp) sprintf(errmsg, "no previous pattern"); return exp; } else if ((exps = getlhs(delim)) == NULL)