Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/regress/sys/net/ether_aton_r Replace ed usage with awk script.



details:   https://anonhg.NetBSD.org/src/rev/4622a2835b3f
branches:  trunk
changeset: 770764:4622a2835b3f
user:      ws <ws%NetBSD.org@localhost>
date:      Tue Nov 01 12:52:28 2011 +0000

description:
Replace ed usage with awk script.
Fixes PR toolchain/45532, generating the exact same output as previously.
Note that it doesn't address Tsutsui's additional check request.

diffstat:

 regress/sys/net/ether_aton_r/autogen |  47 +++++++++++++++++------------------
 1 files changed, 23 insertions(+), 24 deletions(-)

diffs (53 lines):

diff -r 36d969138a1c -r 4622a2835b3f regress/sys/net/ether_aton_r/autogen
--- a/regress/sys/net/ether_aton_r/autogen      Tue Nov 01 09:28:14 2011 +0000
+++ b/regress/sys/net/ether_aton_r/autogen      Tue Nov 01 12:52:28 2011 +0000
@@ -1,26 +1,25 @@
 #!/bin/sh
 
-cat << __EOF > $2
-
-#include <ctype.h>
-#include <sys/types.h>
-#include <errno.h>
-
-#define ETHER_ADDR_LEN 6
-
-int ether_aton_r(u_char *dest, size_t len, const char *str);
-
-__EOF
-
-ed $1 << _EOF > /dev/null 2>&1
-1
-/^ether_aton_r/
--
--
-1,.d
-/^}$/
-+
-.,\$d
-W $2
-q
-_EOF
+awk '
+BEGIN {
+       print
+       print "#include <ctype.h>"
+       print "#include <sys/types.h>"
+       print "#include <errno.h>"
+       print
+       print "#define ETHER_ADDR_LEN 6"
+       print
+       print "int ether_aton_r(u_char *dest, size_t len, const char *str);"
+       print
+}
+/^ether_aton_r/ {
+       print prevline
+       out = 1
+}
+{
+       if (out) print
+       else prevline = $0
+}
+/^}$/ {
+       if (out) exit(0)
+}' $1 >$2



Home | Main Index | Thread Index | Old Index