# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Wed Apr 16 12:35:41 EET DST 2003 [metaconfig 3.0 PL70]
+# Generated on Thu Apr 17 18:50:57 EET DST 2003 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.org)
cat >c1$$ <<EOF
: check for the select 'width'
case "$selectminbits" in
-'') case "$d_select" in
+'') safebits=`expr $ptrsize \* 8`
+ case "$d_select" in
$define)
$cat <<EOM
#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
#define NBITS (NBYTES * 8)
int main() {
- char s[NBYTES];
+ char *s = malloc(NBYTES);
struct timeval t;
int i;
FILE* fp;
int fd;
+ if (!s)
+ exit(1);
fclose(stdin);
fp = fopen("try.c", "r");
if (fp == 0)
- exit(1);
+ exit(2);
fd = fileno(fp);
if (fd < 0)
- exit(2);
+ exit(3);
b = ($selecttype)s;
for (i = 0; i < NBITS; i++)
FD_SET(i, b);
t.tv_usec = 0;
select(fd + 1, b, 0, 0, &t);
for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
+ free(s);
printf("%d\n", i + 1);
return 0;
}
case "$selectminbits" in
'') cat >&4 <<EOM
Cannot figure out on how many bits at a time your select() operates.
-I'll play safe and guess it is 32 bits.
+I'll play safe and guess it is $safebits bits.
EOM
- selectminbits=32
- bits="32 bits"
+ selectminbits=$safebits
+ bits="$safebits bits"
;;
1) bits="1 bit" ;;
*) bits="$selectminbits bits" ;;
else
rp='What is the minimum number of bits your select() operates on?'
case "$byteorder" in
- 1234|12345678) dflt=32 ;;
+ 12345678) dflt=64 ;;
+ 1234) dflt=32 ;;
*) dflt=1 ;;
esac
. ./myread
$rm -f try.* try
;;
*) : no select, so pick a harmless default
- selectminbits='32'
+ selectminbits=$safebits
;;
esac
;;