+++ /dev/null
-# $OpenBSD: Makefile,v 1.2 1996/06/23 14:20:05 deraadt Exp $
-# $NetBSD: Makefile,v 1.11 1995/03/21 09:05:14 cgd Exp $
-
-SHELL= /bin/sh
-ED= ../obj/ed
-
-all: check
- @:
-
-check: build test
- @if grep -h '\*\*\*' errs.o scripts.o; then :; else \
- echo "tests completed successfully."; \
- fi
-
-build: mkscripts.sh
- @if [ -f errs.o ]; then :; else \
- echo "building test scripts for $(ED) ..."; \
- $(SHELL) mkscripts.sh $(ED); \
- fi
-
-test: build ckscripts.sh
- @echo testing $(ED) ...
- @$(SHELL) ckscripts.sh $(ED)
-
-clean:
- rm -f *.ed *.red *.[oz] *~
+++ /dev/null
-$OpenBSD: README,v 1.3 2018/01/09 00:43:10 bluhm Exp $
-$NetBSD: README,v 1.8 1995/03/21 09:05:18 cgd Exp $
-
-The files in this directory with suffixes `.t', `.d', `.r' and `.err' are
-used for testing ed. To run the tests, set the ED variable in the Makefile
-for the path name of the program to be tested (e.g., /bin/ed), and type
-`make'. The tests do not exhaustively verify POSIX compliance nor do
-they verify correct 8-bit or long line support.
-
-The test file suffixes have the following meanings:
-.t Template - a list of ed commands from which an ed script is
- constructed
-.d Data - read by an ed script
-.r Result - the expected output after processing data via an ed
- script.
-.err Error - invalid ed commands that should generate an error
-
-The output of the tests is written to the two files err.o and scripts.o.
-At the end of the tests, these files are grep'ed for error messages,
-which look like:
- *** The script u.ed exited abnormally ***
-or:
- *** Output u.o of script u.ed is incorrect ***
-
-The POSIX requirement that an address range not be used where at most
-a single address is expected has been relaxed in this version of ed.
-Therefore, the following scripts which test for compliance with this
-POSIX rule exit abnormally:
-a1-err.ed
-eq-err.ed
-i1-err.ed
-k1-err.ed
-r1-err.ed
+++ /dev/null
-$OpenBSD: TODO,v 1.2 1996/06/23 14:20:06 deraadt Exp $
-$NetBSD: TODO,v 1.3 1995/03/21 09:05:20 cgd Exp $
-
-Some missing tests:
-0) g/./s^@^@ - okay: NULs in commands
-1) g/./s/^@/ - okay: NULs in patterns
-2) a
- hello^V^Jworld
- . - okay: embedded newlines in insert mode
-3) ed "" - error: invalid filename
-4) red .. - error: restricted
-5) red / - error: restricted
-5) red !xx - error: restricted
-6) ed -x - verify: 8-bit clean
-7) ed - verify: long-line support
-8) ed - verify: interactive/help mode
-9) G/pat/ - verify: global interactive command
-10) V/pat/ - verify: global interactive command
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-hello world
-line 1
-hello world!
-line 2
-line 3
-line 4
-line5
-hello world!!
+++ /dev/null
-0a
-hello world
-.
-2a
-hello world!
-.
-$a
-hello world!!
-.
+++ /dev/null
-1,$a
-hello world
-.
+++ /dev/null
-aa
-hello world
-.
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
-1ine6
-line7
-line8
-line9
+++ /dev/null
-line 2
-line9
+++ /dev/null
-1 d
-1 1 d
-1,2,d
-1;+ + ,d
-1,2;., + 2d
+++ /dev/null
-!read one
-hello, world
-a
-okay
-.
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-at the top
-between top/middle
-in the middle
-at the bottom
+++ /dev/null
-1c
-at the top
-.
-4c
-in the middle
-.
-$c
-at the bottom
-.
-2,3c
-between top/middle
-.
+++ /dev/null
-cc
-hello world
-.
+++ /dev/null
-0c
-hello world
-.
+++ /dev/null
-#!/bin/sh -
-# $OpenBSD: ckscripts.sh,v 1.3 1998/07/12 03:49:08 todd Exp $
-# $NetBSD: ckscripts.sh,v 1.9 1995/04/23 10:07:34 cgd Exp $
-#
-# This script runs the .ed scripts generated by mkscripts.sh
-# and compares their output against the .r files, which contain
-# the correct output
-
-PATH="/bin:/usr/bin:/usr/local/bin/:."
-ED=$1
-[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }
-
-# Run the *.red scripts first, since these don't generate output;
-# they exit with non-zero status
-for i in *.red; do
- echo $i
- if $i; then
- echo "*** The script $i exited abnormally ***"
- fi
-done >errs.o 2>&1
-
-# Run the remaining scripts; they exit with zero status
-for i in *.ed; do
-# base=`expr $i : '\([^.]*\)'`
-# base=`echo $i | sed 's/\..*//'`
- base=`$ED - \!"echo $i" <<-EOF
- s/\..*
- EOF`
- if $base.ed; then
- if cmp -s $base.o $base.r; then :; else
- echo "*** Output $base.o of script $i is incorrect ***"
- fi
- else
- echo "*** The script $i exited abnormally ***"
- fi
-done >scripts.o 2>&1
-
-grep -h '\*\*\*' errs.o scripts.o
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-1d
-2;+1d
-$d
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 4
-line5
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 2
-line 4
-line5
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 4
-line5
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 2
-line 4
-line5
+++ /dev/null
-hello world
+++ /dev/null
-E !echo hello world-
+++ /dev/null
-hello world-
+++ /dev/null
-E !echo hello world-
+++ /dev/null
-E !echo hello world-
+++ /dev/null
-E !echo hello world-
+++ /dev/null
-E !echo hello world-
+++ /dev/null
-E !echo hello world-
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-g/./s //x/
+++ /dev/null
-line5
-help! world
-order
-line 4
-help! world
-order
-line 3
-help! world
-order
-line 2
-help! world
-order
-line 1
-help! world
-order
+++ /dev/null
-g/./m0
-g/./s/$/\
-hello world
-g/hello /s/lo/p!/\
-a\
-order
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-hello world
+++ /dev/null
-g/[2-4]/-1,+1c\
-hello world
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-linc 3
-xine 1
-xine 2
-xinc 4
-xinc5
+++ /dev/null
-g/./s//x/\
-3m0
-g/./s/e/c/\
-2,3m1
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-hello
-zine 1
-line 2
-line 3
-line 4
-line5
-world
+++ /dev/null
-g/./s/./x/\
-u\
-s/./y/\
-u\
-s/./z/\
-u
-u
-0a
-hello
-.
-$a
-world
-.
+++ /dev/null
-line 1
-line 2
-line 3
+++ /dev/null
-line 1
-line 2
-line 3
-line 2
-line 3
-line 1
-line 3
-line 1
-line 2
+++ /dev/null
-g/./1,3t$\
-1d
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-hello world
-hello world!
-line 1
-line 2
-line 3
-line 4
-hello world!!
-line5
+++ /dev/null
-1i
-hello world
-.
-2i
-hello world!
-.
-$i
-hello world!!
-.
+++ /dev/null
-hello world
-line1
+++ /dev/null
-0i
-hello world
-.
+++ /dev/null
-1,$i
-hello world
-.
+++ /dev/null
-ii
-hello world
-.
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 2line 3
-line 4
-line5
+++ /dev/null
-1,1j
-2,3j
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 3
-hello world
-line 4
-line5
-line 2
+++ /dev/null
-2ka
-1d
-'am$
-1ka
-0a
-hello world
-.
-'ad
-u
-'am0
+++ /dev/null
-a
-hello
-.
-.ka
-'ad
-'ap
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-a
-hello world
-.
-1,$m1
+++ /dev/null
-line5
-line 1
-line 2
-line 3
-line 4
+++ /dev/null
-1,2m$
-1,2m$
-1,2m$
-$m0
-$m0
-2,3m1
-2,3m3
+++ /dev/null
-#!/bin/sh -
-# $OpenBSD: mkscripts.sh,v 1.2 1996/06/23 14:20:08 deraadt Exp $
-# $NetBSD: mkscripts.sh,v 1.10 1995/04/23 10:07:36 cgd Exp $
-#
-# This script generates ed test scripts (.ed) from .t files
-
-PATH="/bin:/usr/bin:/usr/local/bin/:."
-ED=$1
-[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }
-
-for i in *.t; do
-# base=${i%.*}
-# base=`echo $i | sed 's/\..*//'`
-# base=`expr $i : '\([^.]*\)'`
-# (
-# echo "#!/bin/sh -"
-# echo "$ED - <<\EOT"
-# echo "r $base.d"
-# cat $i
-# echo "w $base.o"
-# echo EOT
-# ) >$base.ed
-# chmod +x $base.ed
-# The following is pretty ugly way of doing the above, and not appropriate
-# use of ed but the point is that it can be done...
- base=`$ED - \!"echo $i" <<-EOF
- s/\..*
- EOF`
- $ED - <<-EOF
- a
- #!/bin/sh -
- $ED - <<\EOT
- H
- r $base.d
- w $base.o
- EOT
- .
- -2r $i
- w $base.ed
- !chmod +x $base.ed
- EOF
-done
-
-for i in *.err; do
-# base=${i%.*}
-# base=`echo $i | sed 's/\..*//'`
-# base=`expr $i : '\([^.]*\)'`
-# (
-# echo "#!/bin/sh -"
-# echo "$ED - <<\EOT"
-# echo H
-# echo "r $base.err"
-# cat $i
-# echo "w $base.o"
-# echo EOT
-# ) >$base-err.ed
-# chmod +x $base-err.ed
-# The following is pretty ugly way of doing the above, and not appropriate
-# use of ed but the point is that it can be done...
- base=`$ED - \!"echo $i" <<-EOF
- s/\..*
- EOF`
- $ED - <<-EOF
- a
- #!/bin/sh -
- $ED - <<\EOT
- H
- r $base.err
- w $base.o
- EOT
- .
- -2r $i
- w ${base}.red
- !chmod +x ${base}.red
- EOF
-done
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-
-
-hello world
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-1
-
-
-0a
-
-
-hello world
-.
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
-hello world
+++ /dev/null
-a
-hello world
-.
-0;/./
+++ /dev/null
-w q.o
-a
-hello
-.
-q
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-1,$r r1.err
+++ /dev/null
-line 1
-hello world
-line 2
-line 3
-line 4
-line5
-hello world
+++ /dev/null
-1;r !echo hello world
-1
-r !echo hello world
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-r a-good-book
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-r r3.t
-r r3.t
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-liene 1
-(liene) (2)
-(liene) (3)
-liene (4)
-(()liene5)
+++ /dev/null
-s/\([^ ][^ ]*\)/(\1)/g
-2s
-/3/s
-/\(4\)/sr
-/\(.\)/srg
-%s/i/&e/
+++ /dev/null
-a
-hello
-.
-s/[h[.]/x/
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-li(n)e 1
-i(n)e 200
-li(n)e 3
-li(n)e 4
-li(n)e500
+++ /dev/null
-,s/./(&)/3
-s/$/00
-2s//%/g
-s/^l
+++ /dev/null
-hello world
+++ /dev/null
-a
-hello/[]world
-.
-s/[/]/ /
-s/[[:digit:][]/ /
-s/[]]/ /
+++ /dev/null
-s/\a\b\c/xyz/
+++ /dev/null
-a
-hello world
-.
-/./
-sr
+++ /dev/null
-a
-hello
-.
-s/[h[=]/x/
+++ /dev/null
-a
-hello
-.
-s/[h[:]/x/
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 1
-line 1
-line 2
-line 2
-line 3
-line 4
-line5
-line 1
-line 1
-line 1
-line 2
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-1t1
-2,3t2
-,t$
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 1
-line 1
-line 2
-line 2
-line 3
-line 4
-line5
-line 1
-line 1
-line 1
-line 2
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-1t0
-2,3t2
-,t$
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line5
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-hello
-hello world!!
-line 2
-line 3
-line 4
-line5
-hello
-hello world!!
+++ /dev/null
-1;r u.t
-u
-a
-hello
-world
-.
-g/./s//x/\
-a\
-hello\
-world
-u
-u
-u
-a
-hello world!
-.
-u
-1,$d
-u
-2,3d
-u
-c
-hello world!!
-.
-u
-u
--1;.,+1j
-u
-u
-u
-.,+1t$
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line5
-order
-hello world
-line 1
-order
-line 2
-order
-line 3
-order
-line 4
-order
+++ /dev/null
-v/[ ]/m0
-v/[ ]/s/$/\
-hello world
-v/hello /s/lo/p!/\
-a\
-order
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-line 1
-line 2
-line 3
-line 4
-line5
-line 1
-line 2
-line 3
-line 4
-line5
+++ /dev/null
-w !cat >\!.z
-r \!.z
+++ /dev/null
-w /to/some/far-away/place
-# $OpenBSD: Makefile,v 1.3 2020/12/17 00:51:11 bluhm Exp $
+# $OpenBSD: Makefile,v 1.4 2024/08/19 01:43:23 deraadt Exp $
ED ?= /bin/ed
-TESTDIR = ${.CURDIR}/../../../bin/ed/test
+TESTDIR = ${.CURDIR}
TS != cd ${TESTDIR} && ls *.t
ERRS != cd ${TESTDIR} && ls *.err
--- /dev/null
+$OpenBSD: README,v 1.1 2024/08/19 01:43:23 deraadt Exp $
+$NetBSD: README,v 1.8 1995/03/21 09:05:18 cgd Exp $
+
+The files in this directory with suffixes `.t', `.d', `.r' and `.err' are
+used for testing ed. To run the tests, set the ED variable in the Makefile
+for the path name of the program to be tested (e.g., /bin/ed), and type
+`make'. The tests do not exhaustively verify POSIX compliance nor do
+they verify correct 8-bit or long line support.
+
+The test file suffixes have the following meanings:
+.t Template - a list of ed commands from which an ed script is
+ constructed
+.d Data - read by an ed script
+.r Result - the expected output after processing data via an ed
+ script.
+.err Error - invalid ed commands that should generate an error
+
+The output of the tests is written to the two files err.o and scripts.o.
+At the end of the tests, these files are grep'ed for error messages,
+which look like:
+ *** The script u.ed exited abnormally ***
+or:
+ *** Output u.o of script u.ed is incorrect ***
+
+The POSIX requirement that an address range not be used where at most
+a single address is expected has been relaxed in this version of ed.
+Therefore, the following scripts which test for compliance with this
+POSIX rule exit abnormally:
+a1-err.ed
+eq-err.ed
+i1-err.ed
+k1-err.ed
+r1-err.ed
--- /dev/null
+$OpenBSD: TODO,v 1.1 2024/08/19 01:43:23 deraadt Exp $
+$NetBSD: TODO,v 1.3 1995/03/21 09:05:20 cgd Exp $
+
+Some missing tests:
+0) g/./s^@^@ - okay: NULs in commands
+1) g/./s/^@/ - okay: NULs in patterns
+2) a
+ hello^V^Jworld
+ . - okay: embedded newlines in insert mode
+3) ed "" - error: invalid filename
+4) red .. - error: restricted
+5) red / - error: restricted
+5) red !xx - error: restricted
+6) ed -x - verify: 8-bit clean
+7) ed - verify: long-line support
+8) ed - verify: interactive/help mode
+9) G/pat/ - verify: global interactive command
+10) V/pat/ - verify: global interactive command
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+hello world
+line 1
+hello world!
+line 2
+line 3
+line 4
+line5
+hello world!!
--- /dev/null
+0a
+hello world
+.
+2a
+hello world!
+.
+$a
+hello world!!
+.
--- /dev/null
+1,$a
+hello world
+.
--- /dev/null
+aa
+hello world
+.
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
+1ine6
+line7
+line8
+line9
--- /dev/null
+line 2
+line9
--- /dev/null
+1 d
+1 1 d
+1,2,d
+1;+ + ,d
+1,2;., + 2d
--- /dev/null
+!read one
+hello, world
+a
+okay
+.
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+at the top
+between top/middle
+in the middle
+at the bottom
--- /dev/null
+1c
+at the top
+.
+4c
+in the middle
+.
+$c
+at the bottom
+.
+2,3c
+between top/middle
+.
--- /dev/null
+cc
+hello world
+.
--- /dev/null
+0c
+hello world
+.
--- /dev/null
+#!/bin/sh -
+# $OpenBSD: ckscripts.sh,v 1.1 2024/08/19 01:43:23 deraadt Exp $
+# $NetBSD: ckscripts.sh,v 1.9 1995/04/23 10:07:34 cgd Exp $
+#
+# This script runs the .ed scripts generated by mkscripts.sh
+# and compares their output against the .r files, which contain
+# the correct output
+
+PATH="/bin:/usr/bin:/usr/local/bin/:."
+ED=$1
+[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }
+
+# Run the *.red scripts first, since these don't generate output;
+# they exit with non-zero status
+for i in *.red; do
+ echo $i
+ if $i; then
+ echo "*** The script $i exited abnormally ***"
+ fi
+done >errs.o 2>&1
+
+# Run the remaining scripts; they exit with zero status
+for i in *.ed; do
+# base=`expr $i : '\([^.]*\)'`
+# base=`echo $i | sed 's/\..*//'`
+ base=`$ED - \!"echo $i" <<-EOF
+ s/\..*
+ EOF`
+ if $base.ed; then
+ if cmp -s $base.o $base.r; then :; else
+ echo "*** Output $base.o of script $i is incorrect ***"
+ fi
+ else
+ echo "*** The script $i exited abnormally ***"
+ fi
+done >scripts.o 2>&1
+
+grep -h '\*\*\*' errs.o scripts.o
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+1d
+2;+1d
+$d
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 4
+line5
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 2
+line 4
+line5
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 4
+line5
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 2
+line 4
+line5
--- /dev/null
+hello world
--- /dev/null
+E !echo hello world-
--- /dev/null
+hello world-
--- /dev/null
+E !echo hello world-
--- /dev/null
+E !echo hello world-
--- /dev/null
+E !echo hello world-
--- /dev/null
+E !echo hello world-
--- /dev/null
+E !echo hello world-
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+g/./s //x/
--- /dev/null
+line5
+help! world
+order
+line 4
+help! world
+order
+line 3
+help! world
+order
+line 2
+help! world
+order
+line 1
+help! world
+order
--- /dev/null
+g/./m0
+g/./s/$/\
+hello world
+g/hello /s/lo/p!/\
+a\
+order
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+hello world
--- /dev/null
+g/[2-4]/-1,+1c\
+hello world
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+linc 3
+xine 1
+xine 2
+xinc 4
+xinc5
--- /dev/null
+g/./s//x/\
+3m0
+g/./s/e/c/\
+2,3m1
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+hello
+zine 1
+line 2
+line 3
+line 4
+line5
+world
--- /dev/null
+g/./s/./x/\
+u\
+s/./y/\
+u\
+s/./z/\
+u
+u
+0a
+hello
+.
+$a
+world
+.
--- /dev/null
+line 1
+line 2
+line 3
--- /dev/null
+line 1
+line 2
+line 3
+line 2
+line 3
+line 1
+line 3
+line 1
+line 2
--- /dev/null
+g/./1,3t$\
+1d
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+hello world
+hello world!
+line 1
+line 2
+line 3
+line 4
+hello world!!
+line5
--- /dev/null
+1i
+hello world
+.
+2i
+hello world!
+.
+$i
+hello world!!
+.
--- /dev/null
+hello world
+line1
--- /dev/null
+0i
+hello world
+.
--- /dev/null
+1,$i
+hello world
+.
--- /dev/null
+ii
+hello world
+.
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 2line 3
+line 4
+line5
--- /dev/null
+1,1j
+2,3j
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 3
+hello world
+line 4
+line5
+line 2
--- /dev/null
+2ka
+1d
+'am$
+1ka
+0a
+hello world
+.
+'ad
+u
+'am0
--- /dev/null
+a
+hello
+.
+.ka
+'ad
+'ap
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+a
+hello world
+.
+1,$m1
--- /dev/null
+line5
+line 1
+line 2
+line 3
+line 4
--- /dev/null
+1,2m$
+1,2m$
+1,2m$
+$m0
+$m0
+2,3m1
+2,3m3
--- /dev/null
+#!/bin/sh -
+# $OpenBSD: mkscripts.sh,v 1.1 2024/08/19 01:43:23 deraadt Exp $
+# $NetBSD: mkscripts.sh,v 1.10 1995/04/23 10:07:36 cgd Exp $
+#
+# This script generates ed test scripts (.ed) from .t files
+
+PATH="/bin:/usr/bin:/usr/local/bin/:."
+ED=$1
+[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }
+
+for i in *.t; do
+# base=${i%.*}
+# base=`echo $i | sed 's/\..*//'`
+# base=`expr $i : '\([^.]*\)'`
+# (
+# echo "#!/bin/sh -"
+# echo "$ED - <<\EOT"
+# echo "r $base.d"
+# cat $i
+# echo "w $base.o"
+# echo EOT
+# ) >$base.ed
+# chmod +x $base.ed
+# The following is pretty ugly way of doing the above, and not appropriate
+# use of ed but the point is that it can be done...
+ base=`$ED - \!"echo $i" <<-EOF
+ s/\..*
+ EOF`
+ $ED - <<-EOF
+ a
+ #!/bin/sh -
+ $ED - <<\EOT
+ H
+ r $base.d
+ w $base.o
+ EOT
+ .
+ -2r $i
+ w $base.ed
+ !chmod +x $base.ed
+ EOF
+done
+
+for i in *.err; do
+# base=${i%.*}
+# base=`echo $i | sed 's/\..*//'`
+# base=`expr $i : '\([^.]*\)'`
+# (
+# echo "#!/bin/sh -"
+# echo "$ED - <<\EOT"
+# echo H
+# echo "r $base.err"
+# cat $i
+# echo "w $base.o"
+# echo EOT
+# ) >$base-err.ed
+# chmod +x $base-err.ed
+# The following is pretty ugly way of doing the above, and not appropriate
+# use of ed but the point is that it can be done...
+ base=`$ED - \!"echo $i" <<-EOF
+ s/\..*
+ EOF`
+ $ED - <<-EOF
+ a
+ #!/bin/sh -
+ $ED - <<\EOT
+ H
+ r $base.err
+ w $base.o
+ EOT
+ .
+ -2r $i
+ w ${base}.red
+ !chmod +x ${base}.red
+ EOF
+done
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+
+
+hello world
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+1
+
+
+0a
+
+
+hello world
+.
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
+hello world
--- /dev/null
+a
+hello world
+.
+0;/./
--- /dev/null
+w q.o
+a
+hello
+.
+q
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+1,$r r1.err
--- /dev/null
+line 1
+hello world
+line 2
+line 3
+line 4
+line5
+hello world
--- /dev/null
+1;r !echo hello world
+1
+r !echo hello world
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+r a-good-book
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+r r3.t
+r r3.t
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+liene 1
+(liene) (2)
+(liene) (3)
+liene (4)
+(()liene5)
--- /dev/null
+s/\([^ ][^ ]*\)/(\1)/g
+2s
+/3/s
+/\(4\)/sr
+/\(.\)/srg
+%s/i/&e/
--- /dev/null
+a
+hello
+.
+s/[h[.]/x/
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+li(n)e 1
+i(n)e 200
+li(n)e 3
+li(n)e 4
+li(n)e500
--- /dev/null
+,s/./(&)/3
+s/$/00
+2s//%/g
+s/^l
--- /dev/null
+hello world
--- /dev/null
+a
+hello/[]world
+.
+s/[/]/ /
+s/[[:digit:][]/ /
+s/[]]/ /
--- /dev/null
+s/\a\b\c/xyz/
--- /dev/null
+a
+hello world
+.
+/./
+sr
--- /dev/null
+a
+hello
+.
+s/[h[=]/x/
--- /dev/null
+a
+hello
+.
+s/[h[:]/x/
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 1
+line 1
+line 2
+line 2
+line 3
+line 4
+line5
+line 1
+line 1
+line 1
+line 2
+line 2
+line 3
+line 4
+line5
--- /dev/null
+1t1
+2,3t2
+,t$
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 1
+line 1
+line 2
+line 2
+line 3
+line 4
+line5
+line 1
+line 1
+line 1
+line 2
+line 2
+line 3
+line 4
+line5
--- /dev/null
+1t0
+2,3t2
+,t$
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line5
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+hello
+hello world!!
+line 2
+line 3
+line 4
+line5
+hello
+hello world!!
--- /dev/null
+1;r u.t
+u
+a
+hello
+world
+.
+g/./s//x/\
+a\
+hello\
+world
+u
+u
+u
+a
+hello world!
+.
+u
+1,$d
+u
+2,3d
+u
+c
+hello world!!
+.
+u
+u
+-1;.,+1j
+u
+u
+u
+.,+1t$
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line5
+order
+hello world
+line 1
+order
+line 2
+order
+line 3
+order
+line 4
+order
--- /dev/null
+v/[ ]/m0
+v/[ ]/s/$/\
+hello world
+v/hello /s/lo/p!/\
+a\
+order
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+line 1
+line 2
+line 3
+line 4
+line5
+line 1
+line 2
+line 3
+line 4
+line5
--- /dev/null
+w !cat >\!.z
+r \!.z
--- /dev/null
+w /to/some/far-away/place