mkioctls revision 1.6
11.6Sthorpej# $Id: mkioctls,v 1.6 1995/06/06 23:45:27 thorpej Exp $ 21.3Smycroft# 31.5Smycroftcpp -dM ${1+"$@"} | awk ' 41.1ScgdBEGIN { 51.1Scgd print "#include <sys/param.h>" 61.1Scgd print "#include <sys/socket.h>" 71.1Scgd print "#include <sys/socketvar.h>" 81.1Scgd print "#include <net/route.h>" 91.1Scgd print "#include <net/if.h>" 101.6Sthorpej print "#include <netinet/in.h>" 111.6Sthorpej print "#include <netinet/ip_mroute.h>" 121.1Scgd print "#include <sys/termios.h>" 131.1Scgd print "#define COMPAT_43" 141.1Scgd print "#include <sys/ioctl.h>" 151.1Scgd print "" 161.1Scgd print "char *" 171.1Scgd print "ioctlname(val)" 181.5Smycroft print "\tlong val;" 191.1Scgd print "{" 201.1Scgd print "" 211.1Scgd} 221.1Scgd 231.1Scgd/^#[ ]*define[ ]*(TIO|FIO|SIO|OSIO)[A-Z]*[ ]*_IO/ { 241.1Scgd 251.1Scgd # find where the name starts 261.1Scgd for (i = 1; i <= NF; i++) 271.1Scgd if ($i ~ /define/) 281.1Scgd break; 291.1Scgd ++i; 301.1Scgd # 311.5Smycroft printf("\tif (val == %s)\n\t\treturn (\"%s\");\n", $i, $i); 321.1Scgd 331.1Scgd} 341.1ScgdEND { 351.5Smycroft print "\n\treturn (NULL);" 361.1Scgd print "}" 371.1Scgd} 381.5Smycroft' 39