e4372ceba0
NET_NEEDS_GIANT. netatm has been disconnected from the build for ten months in HEAD/RELENG_7. Specifics: - netatm include files - netatm command line management tools - libatm - ATM parts in rescue and sysinstall - sample configuration files and documents - kernel support as a module or in NOTES - netgraph wrapper nodes for netatm - ctags data for netatm. - netatm-specific device drivers. MFC after: 3 weeks Reviewed by: bz Discussed with: bms, bz, harti
90 lines
1.9 KiB
Bash
90 lines
1.9 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
|
|
set -e
|
|
|
|
if [ "x$1" = "x-s" ]; then
|
|
use_switch=1
|
|
shift
|
|
else
|
|
use_switch=0
|
|
fi
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "usage: sh $0 [-s] include-dir"
|
|
exit 1
|
|
fi
|
|
|
|
LC_ALL=C; export LC_ALL
|
|
|
|
# Build a list of headers that have ioctls in them.
|
|
# XXX should we use an ANSI cpp?
|
|
ioctl_includes=`
|
|
cd $1
|
|
find -H -s * -name '*.h' |
|
|
xargs egrep -l \
|
|
'^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO[^a-z0-9_]' |
|
|
awk '{printf("#include <%s>\\\\n", $1)}'
|
|
`
|
|
|
|
awk -v x="$ioctl_includes" 'BEGIN {print x}' |
|
|
gcc -E -I$1 -dM - |
|
|
awk -v ioctl_includes="$ioctl_includes" -v use_switch="$use_switch" '
|
|
BEGIN {
|
|
print "/* XXX obnoxious prerequisites. */"
|
|
print "#define COMPAT_43"
|
|
print "#include <sys/param.h>"
|
|
print "#include <sys/devicestat.h>"
|
|
print "#include <sys/disklabel.h>"
|
|
print "#include <sys/socket.h>"
|
|
print "#include <sys/time.h>"
|
|
print "#include <sys/tty.h>"
|
|
print "#include <bsm/audit.h>"
|
|
print "#include <net/ethernet.h>"
|
|
print "#include <net/if.h>"
|
|
print "#include <net/if_var.h>"
|
|
print "#include <net/pfvar.h>"
|
|
print "#include <net/route.h>"
|
|
print "#include <netinet/in.h>"
|
|
print "#include <netinet/ip_mroute.h>"
|
|
print "#include <netinet6/in6_var.h>"
|
|
print "#include <netinet6/nd6.h>"
|
|
print "#include <netinet6/ip6_mroute.h>"
|
|
print "#include <stdio.h>"
|
|
print "#include <cam/cam.h>"
|
|
print ""
|
|
print "const char *ioctlname(u_long val);"
|
|
print ""
|
|
print ioctl_includes
|
|
print ""
|
|
print "const char *"
|
|
print "ioctlname(u_long val)"
|
|
print "{"
|
|
print ""
|
|
if (use_switch)
|
|
print "\tswitch(val) {"
|
|
}
|
|
|
|
/^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO/ {
|
|
|
|
# find where the name starts
|
|
for (i = 1; i <= NF; i++)
|
|
if ($i ~ /define/)
|
|
break;
|
|
++i;
|
|
#
|
|
if (use_switch)
|
|
printf("\tcase %s:\n\t\treturn(\"%s\");\n", $i, $i);
|
|
else
|
|
printf("\tif (val == %s)\n\t\treturn(\"%s\");\n", $i, $i);
|
|
|
|
}
|
|
END {
|
|
if (use_switch)
|
|
print "\t}"
|
|
print "\n\treturn(NULL);"
|
|
print "}"
|
|
}
|
|
'
|