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