?RCS: $Id: selecttype.U,v 3.0.1.3 1997/02/28 16:20:09 ram Exp $
?RCS:
?RCS: Copyright (c) 1991-1993, Raphael Manfredi
?RCS:
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 3.0.
?RCS:
?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu>
?RCS:
?RCS: $Log: selecttype.U,v $
?RCS: Revision 3.0.1.3  1997/02/28  16:20:09  ram
?RCS: patch61: always include <sys/select.h> when available for test
?RCS:
?RCS: Revision 3.0.1.2  1995/07/25  14:14:06  ram
?RCS: patch56: removed harmful spaces in assignment
?RCS:
?RCS: Revision 3.0.1.1  1994/06/20  07:06:31  ram
?RCS: patch30: created by ADO
?RCS:
?MAKE:selecttype: Protochk Oldconfig Myread cat \
	d_fd_set d_select d_socket i_systime i_sysselct extern_C
?MAKE:	-pick add $@ %<
?S:selecttype:
?S:	This variable holds the type used for the 2nd, 3rd, and 4th
?S:	arguments to select.  Usually, this is 'fd_set *', if HAS_FD_SET
?S:	is defined, and 'int *' otherwise.  This is only useful if you
?S:	have select(), naturally.
?S:.
?C:Select_fd_set_t:
?C:	This symbol holds the type used for the 2nd, 3rd, and 4th
?C:	arguments to select.  Usually, this is 'fd_set *', if HAS_FD_SET
?C:	is defined, and 'int *' otherwise.  This is only useful if you
?C:	have select(), of course.
?C:.
?H:#define Select_fd_set_t	$selecttype	/**/
?H:.
?T:xxx nfd tmo try hdrs val
: check for type of arguments to select.
case "$selecttype" in
'') case "$d_select" in
	$define)
		echo " "
		$cat <<EOM
Checking to see what type of arguments are accepted by select().
EOM
		hdrs="$define sys/types.h
			$i_systime sys/time.h
			$i_sysselct sys/select.h
			$d_socket sys/socket.h"
		: The first arg can be int, unsigned, or size_t
		: The last arg may or may not be 'const'
		val=''
		: void pointer has been seen but using that
		: breaks the selectminbits test
		for xxx in 'fd_set *' 'int *'; do
			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
				for tmo in 'struct timeval *' 'const struct timeval *'; do
					case "$val" in
					'')	try="$extern_C int select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
						if ./protochk "$try" $hdrs; then
							echo "Your system accepts $xxx."
							val="$xxx"
						fi
						;;
					esac
				done
			done
		done
?X:	In the unlikely event that none of those worked, prompt the user.
		case "$val" in
		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
			case "$d_fd_set" in
				$define) dflt="fd_set *" ;;
				*)		dflt="int *" ;;
			esac
			. ./myread
			val=$ans
			;;
		esac
		selecttype="$val"
		;;
	*)	: no select, so pick a harmless default
		selecttype='int *'
		;;
	esac
	;;
esac

