develooper Front page | perl.perl5.porters | Postings from November 2000

PATCH std stdio for (Free)BSD

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
November 8, 2000 07:36
Subject:
PATCH std stdio for (Free)BSD
Message ID:
20001108153629.D98736@plum.flirble.org
On Mon, Oct 23, 2000 at 03:39:32PM +0100, Nicholas Clark wrote:
> FreeBSD stdio (still) isn't "std"

I believe this to be the correct definitions for FreeBSD stdio's file
struct, including ensuring stdio_base is correct when an ungetc buffer
is present.
I've only got access to FreeBSD; with the following patch regression
tests pass on FreeBSD and things don't break on Linux.

I believe that the BSD stdio code predates the BSD splits, so hopefully
the code below will also allow all NetBSD, OpenBSD, BSDI and presumably
Darwin to benefit from fast sv_gets. However, I can't test this.

Nicholas Clark

--- Configure.orig	Tue Nov  7 23:38:14 2000
+++ Configure	Wed Nov  8 14:58:48 2000
@@ -11446,7 +11441,27 @@
 
 : see if _ptr and _cnt from stdio act std
 echo " "
-if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
+if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
+	echo "(Looks like you have stdio.h from BSD.)"
+	case "$stdio_ptr" in
+	'') stdio_ptr='((fp)->_p)'
+		ptr_lval=$define
+		;;
+	*)	ptr_lval=$d_stdio_ptr_lval;;
+	esac
+	case "$stdio_cnt" in
+	'') stdio_cnt='((fp)->_r)'
+		cnt_lval=$define
+		;;
+	*)	cnt_lval=$d_stdio_cnt_lval;;
+	esac
+	case "$stdio_base" in
+	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
+	esac
+	case "$stdio_bufsiz" in
+	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
+	esac
+elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
 	echo "(Looks like you have stdio.h from Linux.)"
 	case "$stdio_ptr" in
 	'') stdio_ptr='((fp)->_IO_read_ptr)'

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About