|
|
@@ -16,8 +16,6 @@ instead of rejecting them and carrying on.
|
|
|
3 files changed, 108 insertions(+), 23 deletions(-)
|
|
|
create mode 100644 tests/ed-style
|
|
|
|
|
|
-diff --git a/src/pch.c b/src/pch.c
|
|
|
-index ff9ed2c..8150493 100644
|
|
|
--- a/src/pch.c
|
|
|
+++ b/src/pch.c
|
|
|
@@ -33,6 +33,7 @@
|
|
|
@@ -28,7 +26,7 @@ index ff9ed2c..8150493 100644
|
|
|
|
|
|
#define INITHUNKMAX 125 /* initial dynamic allocation size */
|
|
|
|
|
|
-@@ -2388,22 +2389,28 @@ do_ed_script (char const *inname, char const *outname,
|
|
|
+@@ -2388,22 +2389,28 @@ do_ed_script (char const *inname, char c
|
|
|
static char const editor_program[] = EDITOR_PROGRAM;
|
|
|
|
|
|
file_offset beginning_of_this_line;
|
|
|
@@ -71,7 +69,7 @@ index ff9ed2c..8150493 100644
|
|
|
for (;;) {
|
|
|
char ed_command_letter;
|
|
|
beginning_of_this_line = file_tell (pfp);
|
|
|
-@@ -2414,14 +2421,14 @@ do_ed_script (char const *inname, char const *outname,
|
|
|
+@@ -2414,14 +2421,14 @@ do_ed_script (char const *inname, char c
|
|
|
}
|
|
|
ed_command_letter = get_ed_command_letter (buf);
|
|
|
if (ed_command_letter) {
|
|
|
@@ -90,7 +88,7 @@ index ff9ed2c..8150493 100644
|
|
|
write_fatal ();
|
|
|
if (chars_read == 2 && strEQ (buf, ".\n"))
|
|
|
break;
|
|
|
-@@ -2434,13 +2441,49 @@ do_ed_script (char const *inname, char const *outname,
|
|
|
+@@ -2434,13 +2441,49 @@ do_ed_script (char const *inname, char c
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -145,65 +143,3 @@ index ff9ed2c..8150493 100644
|
|
|
|
|
|
if (ofp)
|
|
|
{
|
|
|
-diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
|
-index 6b6df63..16f8693 100644
|
|
|
---- a/tests/Makefile.am
|
|
|
-+++ b/tests/Makefile.am
|
|
|
-@@ -32,6 +32,7 @@ TESTS = \
|
|
|
- crlf-handling \
|
|
|
- dash-o-append \
|
|
|
- deep-directories \
|
|
|
-+ ed-style \
|
|
|
- empty-files \
|
|
|
- false-match \
|
|
|
- fifo \
|
|
|
-diff --git a/tests/ed-style b/tests/ed-style
|
|
|
-new file mode 100644
|
|
|
-index 0000000..d8c0689
|
|
|
---- /dev/null
|
|
|
-+++ b/tests/ed-style
|
|
|
-@@ -0,0 +1,41 @@
|
|
|
-+# Copyright (C) 2018 Free Software Foundation, Inc.
|
|
|
-+#
|
|
|
-+# Copying and distribution of this file, with or without modification,
|
|
|
-+# in any medium, are permitted without royalty provided the copyright
|
|
|
-+# notice and this notice are preserved.
|
|
|
-+
|
|
|
-+. $srcdir/test-lib.sh
|
|
|
-+
|
|
|
-+require cat
|
|
|
-+use_local_patch
|
|
|
-+use_tmpdir
|
|
|
-+
|
|
|
-+# ==============================================================
|
|
|
-+
|
|
|
-+cat > ed1.diff <<EOF
|
|
|
-+0a
|
|
|
-+foo
|
|
|
-+.
|
|
|
-+EOF
|
|
|
-+
|
|
|
-+check 'patch -e foo -i ed1.diff' <<EOF
|
|
|
-+EOF
|
|
|
-+
|
|
|
-+check 'cat foo' <<EOF
|
|
|
-+foo
|
|
|
-+EOF
|
|
|
-+
|
|
|
-+cat > ed2.diff <<EOF
|
|
|
-+1337a
|
|
|
-+r !echo bar
|
|
|
-+,p
|
|
|
-+EOF
|
|
|
-+
|
|
|
-+check 'patch -e foo -i ed2.diff 2> /dev/null || echo "Status: $?"' <<EOF
|
|
|
-+?
|
|
|
-+Status: 2
|
|
|
-+EOF
|
|
|
-+
|
|
|
-+check 'cat foo' <<EOF
|
|
|
-+foo
|
|
|
-+EOF
|
|
|
---
|
|
|
-2.19.1
|
|
|
-
|