diff options
author | Andrew Moore <alm@FreeBSD.org> | 1993-08-27 22:14:24 +0000 |
---|---|---|
committer | Andrew Moore <alm@FreeBSD.org> | 1993-08-27 22:14:24 +0000 |
commit | 0bca9fd9dc84ca6b4d6d6f46b462d05d10b4f5e9 (patch) | |
tree | 63e31ff029a217790a90e3b08cb570253083bff6 | |
parent | 6bef4df57c1eda81ac1a2c19e75c9518294f27c2 (diff) | |
download | src-0bca9fd9dc84ca6b4d6d6f46b462d05d10b4f5e9.tar.gz src-0bca9fd9dc84ca6b4d6d6f46b462d05d10b4f5e9.zip |
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?)
Notes
Notes:
svn path=/head/; revision=339
-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 2bf12219f8d8..7553d5f2e332 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) |