diff options
-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) |