Deleted Added
full compact
mkioctls (171453) mkioctls (175936)
1#!/bin/sh
2#
3# $FreeBSD: head/usr.bin/kdump/mkioctls 175936 2008-02-03 11:33:27Z des $
4
1set -e
2
5set -e
6
3# $FreeBSD: head/usr.bin/kdump/mkioctls 171453 2007-07-14 21:49:24Z rwatson $
4
5if [ "x$1" = "x-s" ]; then
6 use_switch=1
7 shift
8else
9 use_switch=0
10fi
11
12if [ -z "$1" ]; then

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

65 print "ioctlname(u_long val)"
66 print "{"
67 print ""
68 if (use_switch)
69 print "\tswitch(val) {"
70}
71
72/^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO/ {
7if [ "x$1" = "x-s" ]; then
8 use_switch=1
9 shift
10else
11 use_switch=0
12fi
13
14if [ -z "$1" ]; then

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

67 print "ioctlname(u_long val)"
68 print "{"
69 print ""
70 if (use_switch)
71 print "\tswitch(val) {"
72}
73
74/^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO/ {
73
75
74 # find where the name starts
75 for (i = 1; i <= NF; i++)
76 if ($i ~ /define/)
77 break;
78 ++i;
76 # find where the name starts
77 for (i = 1; i <= NF; i++)
78 if ($i ~ /define/)
79 break;
80 ++i;
79 #
81 #
80 if (use_switch)
81 printf("\tcase %s:\n\t\treturn(\"%s\");\n", $i, $i);
82 else
83 printf("\tif (val == %s)\n\t\treturn(\"%s\");\n", $i, $i);
84
85}
86END {
87 if (use_switch)
88 print "\t}"
89 print "\n\treturn(NULL);"
90 print "}"
91}
92'
82 if (use_switch)
83 printf("\tcase %s:\n\t\treturn(\"%s\");\n", $i, $i);
84 else
85 printf("\tif (val == %s)\n\t\treturn(\"%s\");\n", $i, $i);
86
87}
88END {
89 if (use_switch)
90 print "\t}"
91 print "\n\treturn(NULL);"
92 print "}"
93}
94'