Fixed a bug where "sed 's/foo/bar/g'" (i.e. a script w/o a -e)

would go into an infinite loop.
 -Erik
This commit is contained in:
Erik Andersen 2000-03-06 19:20:35 +00:00
parent 9c5c29d442
commit e916d24805
3 changed files with 246 additions and 244 deletions

View File

@ -35,6 +35,8 @@
- Fixes to the makefile for handling "strip"
* An initial telnet implementation was added by
Randolph Chung <tausq@debian.org>.
* Fixed a bug where "sed 's/foo/bar/g'" would go into an
infinite loop.
-Erik Andersen

View File

@ -184,7 +184,8 @@ extern int sed_main(int argc, char **argv)
}
while (argc > 1) {
if (**argv == '-') {
if (**argv != '-')
usage(sed_usage);
argc--;
cp = *argv++;
stopNow = FALSE;
@ -307,7 +308,6 @@ extern int sed_main(int argc, char **argv)
}
}
}
}
if (argc == 0) {
switch (sed_f) {

4
sed.c
View File

@ -184,7 +184,8 @@ extern int sed_main(int argc, char **argv)
}
while (argc > 1) {
if (**argv == '-') {
if (**argv != '-')
usage(sed_usage);
argc--;
cp = *argv++;
stopNow = FALSE;
@ -307,7 +308,6 @@ extern int sed_main(int argc, char **argv)
}
}
}
}
if (argc == 0) {
switch (sed_f) {