NetBSD-Bugs archive

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

Re: toolchain/45532: regress/.../ehter_aton_r/autogen should use awk, not ed.



The following reply was made to PR toolchain/45532; it has been noted by GNATS.

From: Wolfgang Solfrank <Wolfgang%Solfrank.net@localhost>
To: Christos Zoulas <christos%zoulas.com@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, toolchain-manager%netbsd.org@localhost, 
 gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: toolchain/45532: regress/.../ehter_aton_r/autogen should use
 awk, not ed.
Date: Fri, 28 Oct 2011 17:03:29 +0200

 This is a multi-part message in MIME format.
 --------------060108070209020900090205
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Hi,
 
 > It is clumsy to do in awk.
 
 What about the attached script?
 
 Ciao,
 Wolfgang
 -- 
 Wolfgang%Solfrank.net@localhost                                Wolfgang 
Solfrank
 
 --------------060108070209020900090205
 Content-Type: text/plain;
  name="autogen"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="autogen"
 
 #!/bin/sh
 
 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
 
 --------------060108070209020900090205--
 


Home | Main Index | Thread Index | Old Index