1#!/bin/sh - 2# This script generates ed test scripts (.ed) from .t files 3# 4# $FreeBSD: src/bin/ed/test/mkscripts.sh,v 1.6 1999/08/27 23:14:20 peter Exp $ 5# $DragonFly: src/bin/ed/test/mkscripts.sh,v 1.2 2003/06/17 04:22:50 dillon Exp $ 6 7PATH="/bin:/usr/bin:/usr/local/bin/:." 8ED=$1 9[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; } 10 11for i in *.t; do 12# base=${i%.*} 13# base=`echo $i | sed 's/\..*//'` 14# base=`expr $i : '\([^.]*\)'` 15# ( 16# echo "#!/bin/sh -" 17# echo "$ED - <<\EOT" 18# echo "r $base.d" 19# cat $i 20# echo "w $base.o" 21# echo EOT 22# ) >$base.ed 23# chmod +x $base.ed 24# The following is pretty ugly way of doing the above, and not appropriate 25# use of ed but the point is that it can be done... 26 base=`$ED - \!"echo $i" <<-EOF 27 s/\..* 28 EOF` 29 $ED - <<-EOF 30 a 31 #!/bin/sh - 32 $ED - <<\EOT 33 H 34 r $base.d 35 w $base.o 36 EOT 37 . 38 -2r $i 39 w $base.ed 40 !chmod +x $base.ed 41 EOF 42done 43 44for i in *.err; do 45# base=${i%.*} 46# base=`echo $i | sed 's/\..*//'` 47# base=`expr $i : '\([^.]*\)'` 48# ( 49# echo "#!/bin/sh -" 50# echo "$ED - <<\EOT" 51# echo H 52# echo "r $base.err" 53# cat $i 54# echo "w $base.o" 55# echo EOT 56# ) >$base-err.ed 57# chmod +x $base-err.ed 58# The following is pretty ugly way of doing the above, and not appropriate 59# use of ed but the point is that it can be done... 60 base=`$ED - \!"echo $i" <<-EOF 61 s/\..* 62 EOF` 63 $ED - <<-EOF 64 a 65 #!/bin/sh - 66 $ED - <<\EOT 67 H 68 r $base.err 69 w $base.o 70 EOT 71 . 72 -2r $i 73 w ${base}.red 74 !chmod +x ${base}.red 75 EOF 76done 77