1 #!/bin/sh 2 3 awk ' 4 BEGIN { 5 print 6 print "#include <ctype.h>" 7 print "#include <sys/types.h>" 8 print "#include <errno.h>" 9 print 10 print "#define ETHER_ADDR_LEN 6" 11 print 12 print "int ether_aton_r(u_char *dest, size_t len, const char *str);" 13 print 14 } 15 /^ether_aton_r/ { 16 print prevline 17 out = 1 18 } 19 { 20 if (out) print 21 else prevline = $0 22 } 23 /^}$/ { 24 if (out) exit(0) 25 }' $1 >$2 26