From b4e54243c42ac249943bb6904cd74c82d0350e02 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 10 Mar 2000 08:46:33 +0000 Subject: * mach/devstream.c (devstream_write, devstream_read): New functions. (input, output): Functions removed. (mach_open_devstream): Use devstream_{read,write} as cookie functions, using only the vanilla fopencookie interface. * hurd/fopenport.c [! USE_IN_LIBIO] (cookie_io_functions_t): Define as macro for __io_functions. (funcsio): Use cookie_io_functions_t type name. (fopenport): Renamed from __fopenport. Rewrite to call fopencookie. * libio/iofopncook.c (_IO_cookie_init): New function, broken out of fopencookie. (fopencookie): Use it. * libio/libio.h: Declare _IO_cookie_init. * hurd/vpprintf.c (vpprintf) [USE_IN_LIBIO]: Implement using _IO_cookie_init. * libio/libio.h (__io_seek_fn): Fix second argument type to be a pointer, in line with the manual and the old stdio. * libio/iofopncook.c (_IO_cookie_seek): Fix (sole) caller. * sysdeps/generic/bits/stdio-lock.h: New file. This is a stub with #error, but that's better than no file at all. * sysdeps/unix/sysv/linux/alpha/syscall.S: * manual/message.texi (Using gettextized software): * manual/filesys.texi (File Size): * manual/charset.texi (glibc iconv Implementation): * locale/programs/ld-collate.c (collate_output): * manual/stdio.texi (Output Conversion Syntax): --- hurd/vpprintf.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'hurd') diff --git a/hurd/vpprintf.c b/hurd/vpprintf.c index fe52177..b713a06 100644 --- a/hurd/vpprintf.c +++ b/hurd/vpprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991,94,97,2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,7 +33,6 @@ pwrite (void *cookie, return n; } - /* Write formatted output to PORT, a Mach port supporting the i/o protocol, according to the format string FORMAT, using the argument list in ARG. */ int @@ -42,6 +41,27 @@ vpprintf (io_t port, va_list arg) { int done; + +#ifdef USE_IN_LIBIO + + struct locked_FILE + { + struct _IO_cookie_file cfile; +#ifdef _IO_MTSAFE_IO + _IO_lock_t lock; +#endif + } temp_f; +#ifdef _IO_MTSAFE_IO + temp_f.cfile.__file._lock = &temp_f.lock; +#endif + + _IO_cookie_init (&temp_f.cfile, _IO_NO_READS, + (void *) port, (cookie_io_functions_t) { write: pwrite }); + + done = _IO_vfprintf (&temp_f.cfile.__file, format, arg); + +#else + FILE f; /* Create an unbuffered stream talking to PORT on the stack. */ @@ -57,5 +77,7 @@ vpprintf (io_t port, /* vfprintf will use a buffer on the stack for the life of the call. */ done = vfprintf (&f, format, arg); +#endif + return done; } -- cgit v1.1