Home | History | Annotate | Line # | Download | only in kdump
mkioctls revision 1.15
      1  1.14  christos #!/bin/sh
      2  1.15       jmc #	$NetBSD: mkioctls,v 1.15 2004/05/08 21:03:43 jmc Exp $
      3   1.7       jtc #
      4   1.7       jtc # Copyright (c) 1994
      5   1.7       jtc #	The Regents of the University of California.  All rights reserved.
      6   1.7       jtc #
      7   1.7       jtc # Redistribution and use in source and binary forms, with or without
      8   1.7       jtc # modification, are permitted provided that the following conditions
      9   1.7       jtc # are met:
     10   1.7       jtc # 1. Redistributions of source code must retain the above copyright
     11   1.7       jtc #    notice, this list of conditions and the following disclaimer.
     12   1.7       jtc # 2. Redistributions in binary form must reproduce the above copyright
     13   1.7       jtc #    notice, this list of conditions and the following disclaimer in the
     14   1.7       jtc #    documentation and/or other materials provided with the distribution.
     15   1.7       jtc # 3. All advertising materials mentioning features or use of this software
     16   1.7       jtc #    must display the following acknowledgement:
     17   1.7       jtc #	This product includes software developed by the University of
     18   1.7       jtc #	California, Berkeley and its contributors.
     19   1.7       jtc # 4. Neither the name of the University nor the names of its contributors
     20   1.7       jtc #    may be used to endorse or promote products derived from this software
     21   1.7       jtc #    without specific prior written permission.
     22   1.7       jtc #
     23   1.7       jtc # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24   1.7       jtc # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25   1.7       jtc # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26   1.7       jtc # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27   1.7       jtc # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28   1.7       jtc # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29   1.7       jtc # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30   1.7       jtc # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31   1.7       jtc # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32   1.7       jtc # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33   1.7       jtc # SUCH DAMAGE.
     34   1.7       jtc #
     35   1.7       jtc #	@(#)mkioctls	8.2 (Berkeley) 4/28/95
     36   1.3   mycroft #
     37  1.14  christos echo "#define const" 	# XXX: timepps lossage
     38  1.14  christos echo "struct ap_control { int _xxx; };" # XXX: ip_nat.h lossage
     39  1.14  christos echo "#define COMPAT_43"
     40  1.14  christos echo "struct lwp;"
     41  1.15       jmc echo "struct videomemory_t { int _xxx; };" # XXX arm video lossage
     42  1.15       jmc echo "typedef struct videomemory_t videomemory_t;" # XXX arm video lossage
     43  1.14  christos echo "#include <sys/types.h>"
     44  1.14  christos echo "#include <sys/param.h>"
     45  1.14  christos echo "#include <sys/disk.h>"
     46  1.14  christos echo "#include <sys/mount.h>"
     47  1.14  christos echo "#include <sys/termios.h>"
     48  1.14  christos echo "#include <net/if.h>"
     49  1.14  christos echo "#include <net/route.h>"
     50  1.14  christos echo "#include <net/ppp_defs.h>"
     51  1.14  christos echo "#include <netinet/in.h>"
     52  1.14  christos echo "#include <netinet/in_systm.h>"
     53  1.14  christos echo "#include <netinet/ip.h>"
     54  1.14  christos echo "#include <netinet/ip_mroute.h>"
     55  1.14  christos echo "#include <netinet/ip_compat.h>"
     56  1.14  christos echo "#include <net80211/ieee80211.h>"
     57  1.14  christos echo "#include <netiso/iso.h>"
     58  1.14  christos for i
     59  1.14  christos do
     60  1.14  christos 	echo "#include <$i>"
     61  1.14  christos done | sed -e "s,${DESTDIR}/usr/include/,,g"
     62  1.14  christos 
     63  1.11       cgd ${CC:-cc} -E -nostdinc -idirafter $DESTDIR/usr/include -dM ${1+"$@"} | awk '
     64   1.1       cgd BEGIN {
     65  1.10     lukem 	print ""
     66  1.10     lukem 	print "char *ioctlname __P((long));"
     67   1.1       cgd 	print ""
     68   1.1       cgd 	print "char *"
     69   1.1       cgd 	print "ioctlname(val)"
     70   1.5   mycroft 	print "\tlong val;"
     71   1.1       cgd 	print "{"
     72   1.1       cgd 	print ""
     73   1.1       cgd }
     74   1.1       cgd 
     75  1.13   thorpej /^#[ 	]*define[ 	]*(TIO|FIO|SIO|OSIO|CIO|CRIO)[A-Z]*[ 	]*_IO/ {
     76   1.1       cgd 	
     77   1.1       cgd 	# find where the name starts
     78   1.1       cgd 	for (i = 1; i <= NF; i++)
     79   1.1       cgd 		if ($i ~ /define/)
     80   1.1       cgd 			break;
     81   1.1       cgd 	++i;
     82   1.1       cgd 	# 
     83   1.5   mycroft 	printf("\tif (val == %s)\n\t\treturn (\"%s\");\n", $i, $i);
     84   1.1       cgd 
     85   1.1       cgd }
     86   1.1       cgd END {
     87   1.5   mycroft 	print "\n\treturn (NULL);"
     88   1.1       cgd 	print "}"
     89   1.1       cgd }
     90   1.5   mycroft '
     91