* editors/sed.c (parse_edit_command): Require a newline after the backslash
authorMatt Kraai <kraai@debian.org>
Wed, 2 Jan 2002 17:56:38 +0000 (17:56 -0000)
committerMatt Kraai <kraai@debian.org>
Wed, 2 Jan 2002 17:56:38 +0000 (17:56 -0000)
  after an edit command.
* testsuite/sed/sed-requires-newline-after-edit-command: New.

editors/sed.c
testsuite/sed/sed-requires-newline-after-edit-command [new file with mode: 0644]

index fe1c0dbae1ed32263d324bff1e1ce4c1d032d629..1c026d30b667e28c7faac96c6cc508cb30266c7c 100644 (file)
@@ -322,7 +322,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
         *
         */
 
-       if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r'))
+       if (editstr[1] != '\\' || (editstr[2] != '\n' && editstr[2] != '\r'))
                error_msg_and_die("bad format in edit expression");
 
        /* store the edit line text */
diff --git a/testsuite/sed/sed-requires-newline-after-edit-command b/testsuite/sed/sed-requires-newline-after-edit-command
new file mode 100644 (file)
index 0000000..37ebc66
--- /dev/null
@@ -0,0 +1 @@
+! busybox sed -e 'i\foo' </dev/null