| 1 |
#!/bin/sh |
| 2 |
# Copyright (c) 1993, 1994, 1995 Rick Sladkey <[email protected]> |
| 3 |
# All rights reserved. |
| 4 |
# |
| 5 |
# Redistribution and use in source and binary forms, with or without |
| 6 |
# modification, are permitted provided that the following conditions |
| 7 |
# are met: |
| 8 |
# 1. Redistributions of source code must retain the above copyright |
| 9 |
# notice, this list of conditions and the following disclaimer. |
| 10 |
# 2. Redistributions in binary form must reproduce the above copyright |
| 11 |
# notice, this list of conditions and the following disclaimer in the |
| 12 |
# documentation and/or other materials provided with the distribution. |
| 13 |
# 3. The name of the author may not be used to endorse or promote products |
| 14 |
# derived from this software without specific prior written permission. |
| 15 |
# |
| 16 |
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 17 |
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 18 |
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 19 |
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 |
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 21 |
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 22 |
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 23 |
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 25 |
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 |
# |
| 27 |
# $Id$ |
| 28 |
|
| 29 |
if [ $# -ne 1 ] |
| 30 |
then |
| 31 |
echo "usage: $0 include-directory" >&2 |
| 32 |
exit 1 |
| 33 |
fi |
| 34 |
|
| 35 |
bad_defines='WINGETVALIDVALUES' |
| 36 |
( |
| 37 |
cd $1 |
| 38 |
find . -name '*.h' -print | sed 's/^\.\///' | |
| 39 |
xargs egrep '^[ ]*#[ ]*define[ ][ ]*[A-Z_][A-Za-z0-9_]*[ ][ ]*_IO[RW]?\(' /dev/null | |
| 40 |
sed 's/\(.*\):#[ ]*define[ ]*\([A-Z_][A-Za-z0-9_]*\)[ ]*\(_IO[^)]*)\)[ ]*\(.*\)/ { "\1", "\2", \2 }, \4/' | |
| 41 |
sort -u |
| 42 |
) >ioctlent.tmp |
| 43 |
echo "\ |
| 44 |
#include <sys/types.h> |
| 45 |
#define KERNEL |
| 46 |
#include <stdio.h> |
| 47 |
#include <strings.h> |
| 48 |
#include <fcntl.h> |
| 49 |
#include <sys/types.h> |
| 50 |
#include <sys/time.h> |
| 51 |
#include <sys/ioctl.h> |
| 52 |
#include <sys/socket.h> |
| 53 |
#include <sys/des.h> |
| 54 |
#include <sys/mtio.h> |
| 55 |
#include <sys/stropts.h> |
| 56 |
#include <sys/stream.h> |
| 57 |
#include <sys/vcmd.h> |
| 58 |
|
| 59 |
#include <net/if.h> |
| 60 |
#include <net/if_arp.h> |
| 61 |
#include <net/route.h> |
| 62 |
#include <net/nit.h> |
| 63 |
#include <net/nit_if.h> |
| 64 |
#include <net/nit_pf.h> |
| 65 |
#include <net/nit_buf.h> |
| 66 |
#include <net/packetfilt.h> |
| 67 |
#include <netinet/in.h> |
| 68 |
#include <netinet/in_systm.h> |
| 69 |
#include <netinet/in_var.h> |
| 70 |
#include <netinet/ip.h> |
| 71 |
#include <netinet/ip_icmp.h> |
| 72 |
#include <netinet/if_ether.h> |
| 73 |
|
| 74 |
#include <scsi/impl/uscsi.h> |
| 75 |
#define sprintf scsi_sprintf |
| 76 |
#include <scsi/scsi.h> |
| 77 |
#undef sprintf |
| 78 |
#include <scsi/targets/srdef.h> |
| 79 |
#include <scsi/targets/stdef.h> |
| 80 |
#if 0 |
| 81 |
#include <scsi/targets/sddef.h> |
| 82 |
#endif |
| 83 |
|
| 84 |
#include <sun/audioio.h> |
| 85 |
#include <sun/fbio.h> |
| 86 |
#include <sun/gpio.h> |
| 87 |
#include <sun/ndio.h> |
| 88 |
#include <sun/tvio.h> |
| 89 |
#include <sun/mem.h> |
| 90 |
#include <sun/sqz.h> |
| 91 |
#include <sun/vddrv.h> |
| 92 |
#include <sun/isdnio.h> |
| 93 |
|
| 94 |
#include <machine/reg.h> |
| 95 |
|
| 96 |
#include <sundev/kbio.h> |
| 97 |
#include <sundev/msio.h> |
| 98 |
#include <sundev/fdreg.h> |
| 99 |
#include <sundev/ppreg.h> |
| 100 |
#include <sundev/openpromio.h> |
| 101 |
#include <sundev/lightpenreg.h> |
| 102 |
|
| 103 |
#include <sunwindow/window_hs.h> |
| 104 |
#include <sunwindow/win_enum.h> |
| 105 |
#include <sunwindow/win_ioctl.h> |
| 106 |
|
| 107 |
#include <sbusdev/audiovar.h> |
| 108 |
#define AMD_CHIP |
| 109 |
#include <sbusdev/audio_79C30.h> |
| 110 |
#include <sbusdev/bpp_io.h> |
| 111 |
#include <sbusdev/gtreg.h> |
| 112 |
|
| 113 |
#include <sys/termio.h> |
| 114 |
" |
| 115 |
echo "struct ioctlent ioctlent[] = {" |
| 116 |
egrep -v "$bad_defines" ioctlent.tmp | awk ' |
| 117 |
{ |
| 118 |
print "#ifdef " $4 |
| 119 |
print |
| 120 |
print "#endif" |
| 121 |
} |
| 122 |
' |
| 123 |
echo "};" |
| 124 |
rm -f ioctlent.tmp |