mkioctls revision 1.4
1# $Id: mkioctls,v 1.4 1994/12/24 16:47:28 cgd 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 "long val;" 17 print "{" 18 print "" 19} 20 21/^#[ ]*define[ ]*(TIO|FIO|SIO|OSIO)[A-Z]*[ ]*_IO/ { 22 23 # find where the name starts 24 for (i = 1; i <= NF; i++) 25 if ($i ~ /define/) 26 break; 27 ++i; 28 # 29 printf("\tif (val == %s)\n\t\treturn(\"%s\");\n", $i, $i); 30 31} 32END { 33 print "\n\treturn(NULL);" 34 print "}" 35} 36' $1 $2 37