Subject: bin/3224: a bug related to src/usr.bin/kdump/mkioctls.
To: None <gnats-bugs@gnats.netbsd.org>
From: Hiroshi HORIMOTO <horimoto@cs-aoi.cs.sist.ac.jp>
List: netbsd-bugs
Date: 02/17/1997 15:03:15
>Number:         3224
>Category:       bin
>Synopsis:       src/usr.bin/kdump/mkioctls cannot handle plural arguments.
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 16 22:20:01 1997
>Last-Modified:
>Originator:     Hiroshi HORIMOTO
>Organization:
	Shizuoka Institute Science and Technology, Japan
>Release:        NetBSD-current on Feb 16, 1997
>Environment:
	Machine: X68030 (x68k) w/ 030RC40, 882FN33. MEM:12MB  MPU-CLOCK:33MHz
	OS: NetBSD 1.2
	Target: NetBSD-current source on Feb 16, 1997 (updating now..)

System: NetBSD zeek 1.2 NetBSD 1.2 (ZERO) #16: Tue Jan 21 08:01:14 JST 1997 jeanne@zeek:/usr/src/sys/arch/x68k/compile/ZERO x68k


>Description:
    src/usr.bin/kdump/mkioctls cannot handle plural arguments.
    But, in src/usr.bin/kdump/Makefile, give 2 arguments..

ioctl.c: mkioctls
	/bin/sh ${.CURDIR}/mkioctls ${DESTDIR}/usr/include/sys/ioctl.h \
	    ${DESTDIR}/usr/include/sys/ioctl_compat.h > ioctl.c

    Then, mkioctls will do `pre-process' ioctl.h and write the result
into ioctl_compat.h. That is, ioctl_compat.h will be broken. And 
ioctl.c will have the wrong (empty) code.

>How-To-Repeat:
>Fix:
    Please fix mkioctls as follows..

#!/bin/sh
echo "#include <sys/param.h>"
echo "#include <sys/socket.h>"
echo "#include <sys/socketvar.h>"
echo "#include <net/route.h>"
echo "#include <net/if.h>"
echo "#include <netinet/in.h>"
echo "#include <netinet/ip_mroute.h>"
echo "#include <sys/termios.h>"
echo "#define COMPAT_43"
echo "#include <sys/ioctl.h>"
echo ""
echo "char *"
echo "ioctlname(val)"
echo "	long val;"
echo "{"
echo "	switch (val) {"
for hf ; do
cpp -dM $hf | awk '
/^#[ 	]*define[ 	]*(TIO|FIO|SIO|OSIO)[A-Z]*[ 	]*_IO/ {
	
	# find where the name starts
	for (i = 1; i <= NF; i++)
		if ($i ~ /define/)
			break;
	++i;
	# 
	printf("\tcase %s:\n\t\treturn (\"%s\");\n", $i, $i);

}'
done
echo "	}"
echo "	return (NULL);"
echo "}"
>Audit-Trail:
>Unformatted: