diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/Makefile | 2 | ||||
-rw-r--r-- | lib/libc/stdio/findfp.c | 19 |
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/libc/Makefile b/lib/libc/Makefile index cdb5011..3b6ea2a 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -7,7 +7,7 @@ # from CFLAGS below. To remove these strings from just the system call # stubs, remove just -DSYSLIBC_RCS from CFLAGS. LIB=c -SHLIB_MAJOR= 5 +SHLIB_MAJOR= 5.20010213 SHLIB_MINOR= 0 CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/include AINC= -I${.CURDIR}/${MACHINE_ARCH} diff --git a/lib/libc/stdio/findfp.c b/lib/libc/stdio/findfp.c index f307e3e..48eb5b5 100644 --- a/lib/libc/stdio/findfp.c +++ b/lib/libc/stdio/findfp.c @@ -59,20 +59,21 @@ int __sdidinit; #define NDYNAMIC 10 /* add ten more whenever necessary */ -#define std(flags, file) \ - {0,0,0,flags,file,{0},0,__sF+file,__sclose,__sread,__sseek,__swrite} -/* p r w flags file _bf z cookie close read seek write */ +#define std(handle, flags, file) \ +FILE handle = {0,0,0,flags,file,{0},0,&handle,__sclose,__sread,__sseek,__swrite} +/* p r w flags file _bf z cookie close read seek write */ /* the usual - (stdin + stdout + stderr) */ static FILE usual[FOPEN_MAX - 3]; static struct glue uglue = { NULL, FOPEN_MAX - 3, usual }; -FILE __sF[3] = { - std(__SRD, STDIN_FILENO), /* stdin */ - std(__SWR, STDOUT_FILENO), /* stdout */ - std(__SWR|__SNBF, STDERR_FILENO) /* stderr */ -}; -struct glue __sglue = { &uglue, 3, __sF }; +std(__stdin, __SRD, STDIN_FILENO); +std(__stdout, __SWR, STDOUT_FILENO); +std(__stderr, __SWR|__SNBF, STDERR_FILENO); + +static struct glue sglue2 = { &uglue, 1, &__stderr }; +static struct glue sglue1 = { &sglue2, 1, &__stdout }; +struct glue __sglue = { &sglue1, 1, &__stdin }; static struct glue *lastglue = &uglue; static struct glue * moreglue __P((int)); |