Home | History | Annotate | Line # | Download | only in kdump
mkioctls revision 1.3
      1  1.3  mycroft #	$Id: mkioctls,v 1.3 1994/10/06 15:44:35 mycroft Exp $
      2  1.3  mycroft #
      3  1.1      cgd 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.1      cgd 	print "#include <sys/termios.h>"
     11  1.1      cgd 	print "#define COMPAT_43"
     12  1.1      cgd 	print "#include <sys/ioctl.h>"
     13  1.1      cgd 	print ""
     14  1.1      cgd 	print "char *"
     15  1.1      cgd 	print "ioctlname(val)"
     16  1.1      cgd 	print "{"
     17  1.1      cgd 	print ""
     18  1.1      cgd }
     19  1.1      cgd 
     20  1.1      cgd /^#[ 	]*define[ 	]*(TIO|FIO|SIO|OSIO)[A-Z]*[ 	]*_IO/ {
     21  1.1      cgd 	
     22  1.1      cgd 	# find where the name starts
     23  1.1      cgd 	for (i = 1; i <= NF; i++)
     24  1.1      cgd 		if ($i ~ /define/)
     25  1.1      cgd 			break;
     26  1.1      cgd 	++i;
     27  1.1      cgd 	# 
     28  1.1      cgd 	printf("\tif (val ==  %s)\n\t\treturn(\"%s\");\n", $i, $i);
     29  1.1      cgd 
     30  1.1      cgd }
     31  1.1      cgd END {
     32  1.1      cgd 	print "\n\treturn(NULL);"
     33  1.1      cgd 	print "}"
     34  1.1      cgd }
     35  1.2  mycroft ' $1 $2
     36