mkioctls revision 1.5
11.5Smycroft# $Id: mkioctls,v 1.5 1995/01/15 07:51:08 mycroft 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.1Scgd print "#include <sys/termios.h>" 111.1Scgd print "#define COMPAT_43" 121.1Scgd print "#include <sys/ioctl.h>" 131.1Scgd print "" 141.1Scgd print "char *" 151.1Scgd print "ioctlname(val)" 161.5Smycroft print "\tlong val;" 171.1Scgd print "{" 181.1Scgd print "" 191.1Scgd} 201.1Scgd 211.1Scgd/^#[ ]*define[ ]*(TIO|FIO|SIO|OSIO)[A-Z]*[ ]*_IO/ { 221.1Scgd 231.1Scgd # find where the name starts 241.1Scgd for (i = 1; i <= NF; i++) 251.1Scgd if ($i ~ /define/) 261.1Scgd break; 271.1Scgd ++i; 281.1Scgd # 291.5Smycroft printf("\tif (val == %s)\n\t\treturn (\"%s\");\n", $i, $i); 301.1Scgd 311.1Scgd} 321.1ScgdEND { 331.5Smycroft print "\n\treturn (NULL);" 341.1Scgd print "}" 351.1Scgd} 361.5Smycroft' 37