summaryrefslogtreecommitdiff
path: root/hurd/vpprintf.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2000-03-10 08:46:33 +0000
committerRoland McGrath <roland@gnu.org>2000-03-10 08:46:33 +0000
commitb4e54243c42ac249943bb6904cd74c82d0350e02 (patch)
treed7e3139873ccad36c0116d70b61f39fa364de870 /hurd/vpprintf.c
parent418f095a3ef195e3188a969050a831f0ec96d793 (diff)
* 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):
Diffstat (limited to 'hurd/vpprintf.c')
-rw-r--r--hurd/vpprintf.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/hurd/vpprintf.c b/hurd/vpprintf.c
index fe521774ea..b713a06d70 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;
}