Matt Dillon wrote:
> 
> :   
> :   This is a major change to libc.  The library maj must be bumped if you
> :   intend to change the sizeof(FILE), or every single third party applicatio
    n
> :   that uses stdio will break.
> :
> :                             -Matt
> 
>     Oh wait, is libc already bumped in current verses 4.2?  If so then I gues
    s
>     we don't bump libc's maj.  God help anyone using current though!
> 
>                                       -Matt


I cant help but wonder why on earth we didn't have it like this from the
start:

Index: include/stdio.h
===================================================================
RCS file: /home/ncvs/src/include/stdio.h,v
retrieving revision 1.26
diff -u -r1.26 stdio.h
--- include/stdio.h     2001/02/11 22:04:18     1.26
+++ include/stdio.h     2001/02/12 01:27:16
@@ -132,6 +132,9 @@
 
 __BEGIN_DECLS
 extern FILE __sF[];
+extern FILE *__stdin;
+extern FILE *__stdout;
+extern FILE *__stderr;
 __END_DECLS
 
 #define        __SLBF  0x0001          /* line buffered */
@@ -194,9 +197,9 @@
 #define        SEEK_END        2       /* set file offset to EOF plus offset */
 #endif
 
-#define        stdin   (&__sF[0])
-#define        stdout  (&__sF[1])
-#define        stderr  (&__sF[2])
+#define        stdin   __stdin
+#define        stdout  __stdout
+#define        stderr  __stderr
 
 /*
  * Functions defined in ANSI C standard.
Index: lib/libc/stdio/findfp.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/stdio/findfp.c,v
retrieving revision 1.10
diff -u -r1.10 findfp.c
--- lib/libc/stdio/findfp.c     2001/02/11 22:06:40     1.10
+++ lib/libc/stdio/findfp.c     2001/02/12 01:27:16
@@ -75,6 +75,10 @@
 struct glue __sglue = { &uglue, 3, __sF };
 static struct glue *lastglue = &uglue;
 
+FILE *__stdin = &__sF[0];
+FILE *__stdout = &__sF[1];
+FILE *__stderr = &__sF[2];
+
 static struct glue *   moreglue __P((int));
 
 static spinlock_t thread_lock = _SPINLOCK_INITIALIZER;


That compiles fine. The __stdin thing is in case somebody likes the idea
of #undef stdin or #ifdef stdin for some reason.

In fact, I can't imagine *any* reason not to do this. At least this would
insulate us from future nasties in FILE size changes, and would have
saved us in this case.

Cheers,
-Peter
--
Peter Wemm - [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
"All of this is for nothing if we don't go to the stars" - JMS/B5



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to