summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMark Whitley <markw@lineo.com>2001-04-20 23:27:17 +0000
committerMark Whitley <markw@lineo.com>2001-04-20 23:27:17 +0000
commit497ef4658755762d44e1b83e067c985f79f8cba5 (patch)
tree219c0257a0e44b48965fb2dc5a1f2e2818969f9f
parent3e310ac309a3d61c5d2b651e200a625f71d9faa4 (diff)
Made a correction to a bad test expression. Props to Larry Doolittle for
spotting this one.
-rw-r--r--editors/sed.c3
-rw-r--r--sed.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 897c290d5..07e3a3e30 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -317,7 +317,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
/* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */
while (ptr[idx]) {
- while (ptr[idx] != '\\' && (ptr[idx+1] != '\n' || ptr[idx+1] != '\r')) {
+ while (ptr[idx] != '\\' || (ptr[idx+1] != '\n' && ptr[idx+1] != '\r')) {
idx++;
if (!ptr[idx]) {
goto out;
@@ -343,7 +343,6 @@ out:
/* this accounts for the fact that A) we started at index 3, not at index
* 0 and B) that we added an extra '\n' at the end (if you think the next
* line should read 'idx += 4' remember, arrays are zero-based) */
-
idx += 3;
return idx;
diff --git a/sed.c b/sed.c
index 897c290d5..07e3a3e30 100644
--- a/sed.c
+++ b/sed.c
@@ -317,7 +317,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
/* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */
while (ptr[idx]) {
- while (ptr[idx] != '\\' && (ptr[idx+1] != '\n' || ptr[idx+1] != '\r')) {
+ while (ptr[idx] != '\\' || (ptr[idx+1] != '\n' && ptr[idx+1] != '\r')) {
idx++;
if (!ptr[idx]) {
goto out;
@@ -343,7 +343,6 @@ out:
/* this accounts for the fact that A) we started at index 3, not at index
* 0 and B) that we added an extra '\n' at the end (if you think the next
* line should read 'idx += 4' remember, arrays are zero-based) */
-
idx += 3;
return idx;