diff options
author | alm <alm@FreeBSD.org> | 1993-08-27 22:14:24 +0000 |
---|---|---|
committer | alm <alm@FreeBSD.org> | 1993-08-27 22:14:24 +0000 |
commit | eb6abffe8818f1fc48f4607f4c5493f691e7c3a5 (patch) | |
tree | 63e31ff029a217790a90e3b08cb570253083bff6 /bin/ed | |
parent | 3d93ce434ad5d1f0d85e9bff6ef0795f9595b579 (diff) | |
download | FreeBSD-src-eb6abffe8818f1fc48f4607f4c5493f691e7c3a5.zip FreeBSD-src-eb6abffe8818f1fc48f4607f4c5493f691e7c3a5.tar.gz |
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?)
Diffstat (limited to 'bin/ed')
-rw-r--r-- | bin/ed/re.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/bin/ed/re.c b/bin/ed/re.c index 2bf1221..7553d5f 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) |