mkioctls revision 1.3
1# $Id: mkioctls,v 1.3 1994/10/06 15:44:35 mycroft Exp $ 2# 3awk ' 4BEGIN { 5 print "#include <sys/param.h>" 6 print "#include <sys/socket.h>" 7 print "#include <sys/socketvar.h>" 8 print "#include <net/route.h>" 9 print "#include <net/if.h>" 10 print "#include <sys/termios.h>" 11 print "#define COMPAT_43" 12 print "#include <sys/ioctl.h>" 13 print "" 14 print "char *" 15 print "ioctlname(val)" 16 print "{" 17 print "" 18} 19 20/^#[ ]*define[ ]*(TIO|FIO|SIO|OSIO)[A-Z]*[ ]*_IO/ { 21 22 # find where the name starts 23 for (i = 1; i <= NF; i++) 24 if ($i ~ /define/) 25 break; 26 ++i; 27 # 28 printf("\tif (val == %s)\n\t\treturn(\"%s\");\n", $i, $i); 29 30} 31END { 32 print "\n\treturn(NULL);" 33 print "}" 34} 35' $1 $2 36