Deleted Added
full compact
mkioctls (98554) mkioctls (98767)
1set -e
2
1set -e
2
3# $FreeBSD: head/usr.bin/kdump/mkioctls 98554 2002-06-21 10:22:39Z markm $
3# $FreeBSD: head/usr.bin/kdump/mkioctls 98767 2002-06-24 16:35:19Z markm $
4
5if [ "x$1" = "x-s" ]; then
6 use_switch=1
7 shift
8else
9 use_switch=0
10fi
11

--- 39 unchanged lines hidden (view full) ---

51 print "#include <netinet/in.h>"
52 print "#include <netinet/ip_mroute.h>"
53 print "#include <netinet6/in6_var.h>"
54 print "#include <netinet6/nd6.h>"
55 print "#include <netinet6/ip6_mroute.h>"
56 print "#include <stdio.h>"
57 print "#include <cam/cam.h>"
58 print ""
4
5if [ "x$1" = "x-s" ]; then
6 use_switch=1
7 shift
8else
9 use_switch=0
10fi
11

--- 39 unchanged lines hidden (view full) ---

51 print "#include <netinet/in.h>"
52 print "#include <netinet/ip_mroute.h>"
53 print "#include <netinet6/in6_var.h>"
54 print "#include <netinet6/nd6.h>"
55 print "#include <netinet6/ip6_mroute.h>"
56 print "#include <stdio.h>"
57 print "#include <cam/cam.h>"
58 print ""
59 print "const char *ioctlname(register_t val);"
59 print "const char *ioctlname(u_long val);"
60 print ""
61 print ioctl_includes
62 print ""
63 print "const char *"
60 print ""
61 print ioctl_includes
62 print ""
63 print "const char *"
64 print "ioctlname(register_t val)"
64 print "ioctlname(u_long val)"
65 print "{"
66 print ""
67 if (use_switch)
68 print "\tswitch(val) {"
69}
70
71/^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO/ {
72
73 # find where the name starts
74 for (i = 1; i <= NF; i++)
75 if ($i ~ /define/)
76 break;
77 ++i;
78 #
79 if (use_switch)
80 printf("\tcase %s:\n\t\treturn(\"%s\");\n", $i, $i);
81 else
65 print "{"
66 print ""
67 if (use_switch)
68 print "\tswitch(val) {"
69}
70
71/^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO/ {
72
73 # find where the name starts
74 for (i = 1; i <= NF; i++)
75 if ($i ~ /define/)
76 break;
77 ++i;
78 #
79 if (use_switch)
80 printf("\tcase %s:\n\t\treturn(\"%s\");\n", $i, $i);
81 else
82 printf("\tif (val == (register_t)%s)\n\t\treturn(\"%s\");\n", $i, $i);
82 printf("\tif (val == %s)\n\t\treturn(\"%s\");\n", $i, $i);
83
84}
85END {
86 if (use_switch)
87 print "\t}"
88 print "\n\treturn(NULL);"
89 print "}"
90}
91'
83
84}
85END {
86 if (use_switch)
87 print "\t}"
88 print "\n\treturn(NULL);"
89 print "}"
90}
91'