mkioctls revision 1.6
1# $Id: mkioctls,v 1.6 1995/06/06 23:45:27 thorpej Exp $ 2# 3cpp -dM ${1+"$@"} | awk ' 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 <netinet/in.h>" 11 print "#include <netinet/ip_mroute.h>" 12 print "#include <sys/termios.h>" 13 print "#define COMPAT_43" 14 print "#include <sys/ioctl.h>" 15 print "" 16 print "char *" 17 print "ioctlname(val)" 18 print "\tlong val;" 19 print "{" 20 print "" 21} 22 23/^#[ ]*define[ ]*(TIO|FIO|SIO|OSIO)[A-Z]*[ ]*_IO/ { 24 25 # find where the name starts 26 for (i = 1; i <= NF; i++) 27 if ($i ~ /define/) 28 break; 29 ++i; 30 # 31 printf("\tif (val == %s)\n\t\treturn (\"%s\");\n", $i, $i); 32 33} 34END { 35 print "\n\treturn (NULL);" 36 print "}" 37} 38' 39