diff options
| author | Ulrich Drepper <drepper@redhat.com> | 2001-08-17 04:49:12 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 2001-08-17 04:49:12 +0000 |
| commit | 51028f34ceeb7c4c91abc2ac2b818afeaa671b91 (patch) | |
| tree | 165d143b47736e6438b31cfb98d80fdc11cdcbb5 | |
| parent | d79e55530924e8fc9b33991ab4df33653480ec0a (diff) | |
| download | glibc-51028f34ceeb7c4c91abc2ac2b818afeaa671b91.tar.xz glibc-51028f34ceeb7c4c91abc2ac2b818afeaa671b91.zip | |
Update.
* libio/tst-ungetwc2.c (main): Define str const.
* include/wchar.h: Add prototypes for __fwprintf and __vfwprintf.
* libio/fwprintf.c: Also define __fwprintf.
* stdio-common/vfprintf.c [COMPILE_WPRINTF]: Also define __vfwprintf.
* argp/argp-fmtstream.c: Handle wide oriented stderr stream.
* assert/assert-perr.c: Likewise.
* assert/assert.c: Likewise.
* gmon/gmon.c: Likewise.
* inet/rcmd.c: Likewise.
* malloc/obstack.c: Likewise.
* misc/err.c: Likewise.
* misc/error.c: Likewise.
* misc/getpass.c: Likewise.
* posix/getopt.c: Likewise.
* resolv/res_hconf.c: Likewise.
* stdio-common/perror.c: Likewise.
* stdio-common/psignal.c: Likewise.
* stdlib/fmtmsg.c: Likewise.
* sunrpc/auth_unix.c: Likewise.
* sunrpc/clnt_perr.c: Likewise.
* sunrpc/clnt_tcp.c: Likewise.
* sunrpc/clnt_udp.c: Likewise.
* sunrpc/clnt_unix.c: Likewise.
* sunrpc/svc_simple.c: Likewise.
* sunrpc/svc_tcp.c: Likewise.
* sunrpc/svc_udp.c: Likewise.
* sunrpc/svc_unix.c: Likewise.
* sunrpc/xdr.c: Likewise.
* sunrpc/xdr_array.c: Likewise.
* sunrpc/xdr_rec.c: Likewise.
* sunrpc/xdr_ref.c: Likewise.
* sysdeps/generic/wordexp.c: Likewise.
* misc/err.c: Handle wide oriented stderr stream.
| -rw-r--r-- | ChangeLog | 36 | ||||
| -rw-r--r-- | argp/argp-fmtstream.c | 60 | ||||
| -rw-r--r-- | assert/assert-perr.c | 27 | ||||
| -rw-r--r-- | assert/assert.c | 27 | ||||
| -rw-r--r-- | gmon/gmon.c | 10 | ||||
| -rw-r--r-- | include/wchar.h | 7 | ||||
| -rw-r--r-- | inet/rcmd.c | 131 | ||||
| -rw-r--r-- | libio/fwprintf.c | 5 | ||||
| -rw-r--r-- | libio/tst-ungetwc2.c | 2 | ||||
| -rw-r--r-- | malloc/obstack.c | 11 | ||||
| -rw-r--r-- | misc/err.c | 8 | ||||
| -rw-r--r-- | misc/error.c | 10 | ||||
| -rw-r--r-- | misc/getpass.c | 18 | ||||
| -rw-r--r-- | posix/getopt.c | 259 | ||||
| -rw-r--r-- | resolv/res_hconf.c | 135 | ||||
| -rw-r--r-- | stdio-common/perror.c | 2 | ||||
| -rw-r--r-- | stdio-common/psignal.c | 30 | ||||
| -rw-r--r-- | stdio-common/vfprintf.c | 3 | ||||
| -rw-r--r-- | stdlib/fmtmsg.c | 55 | ||||
| -rw-r--r-- | sunrpc/auth_unix.c | 27 | ||||
| -rw-r--r-- | sunrpc/clnt_perr.c | 22 | ||||
| -rw-r--r-- | sunrpc/clnt_tcp.c | 27 | ||||
| -rw-r--r-- | sunrpc/clnt_udp.c | 23 | ||||
| -rw-r--r-- | sunrpc/clnt_unix.c | 24 | ||||
| -rw-r--r-- | sunrpc/svc_simple.c | 52 | ||||
| -rw-r--r-- | sunrpc/svc_tcp.c | 37 | ||||
| -rw-r--r-- | sunrpc/svc_udp.c | 45 | ||||
| -rw-r--r-- | sunrpc/svc_unix.c | 40 | ||||
| -rw-r--r-- | sunrpc/xdr.c | 20 | ||||
| -rw-r--r-- | sunrpc/xdr_array.c | 14 | ||||
| -rw-r--r-- | sunrpc/xdr_rec.c | 18 | ||||
| -rw-r--r-- | sunrpc/xdr_ref.c | 9 | ||||
| -rw-r--r-- | sysdeps/generic/wordexp.c | 43 |
33 files changed, 958 insertions, 279 deletions
@@ -1,8 +1,42 @@ 2001-08-16 Ulrich Drepper <drepper@redhat.com> + * libio/tst-ungetwc2.c (main): Define str const. + + * include/wchar.h: Add prototypes for __fwprintf and __vfwprintf. + * libio/fwprintf.c: Also define __fwprintf. + * stdio-common/vfprintf.c [COMPILE_WPRINTF]: Also define __vfwprintf. + * argp/argp-fmtstream.c: Handle wide oriented stderr stream. + * assert/assert-perr.c: Likewise. + * assert/assert.c: Likewise. + * gmon/gmon.c: Likewise. + * inet/rcmd.c: Likewise. + * malloc/obstack.c: Likewise. + * misc/err.c: Likewise. + * misc/error.c: Likewise. + * misc/getpass.c: Likewise. + * posix/getopt.c: Likewise. + * resolv/res_hconf.c: Likewise. + * stdio-common/perror.c: Likewise. + * stdio-common/psignal.c: Likewise. + * stdlib/fmtmsg.c: Likewise. + * sunrpc/auth_unix.c: Likewise. + * sunrpc/clnt_perr.c: Likewise. + * sunrpc/clnt_tcp.c: Likewise. + * sunrpc/clnt_udp.c: Likewise. + * sunrpc/clnt_unix.c: Likewise. + * sunrpc/svc_simple.c: Likewise. + * sunrpc/svc_tcp.c: Likewise. + * sunrpc/svc_udp.c: Likewise. + * sunrpc/svc_unix.c: Likewise. + * sunrpc/xdr.c: Likewise. + * sunrpc/xdr_array.c: Likewise. + * sunrpc/xdr_rec.c: Likewise. + * sunrpc/xdr_ref.c: Likewise. + * sysdeps/generic/wordexp.c: Likewise. + * po/it.po: Update from translation team. - * misc/err.c: Handle wide oriented stderr. + * misc/err.c: Handle wide oriented stderr stream. 2001-08-14 Tom Rix <trix@redhat.com> diff --git a/argp/argp-fmtstream.c b/argp/argp-fmtstream.c index 9c029c265a..fca89a382d 100644 --- a/argp/argp-fmtstream.c +++ b/argp/argp-fmtstream.c @@ -1,5 +1,5 @@ /* Word-wrapping and line-truncating streams - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader <miles@gnu.ai.mit.edu>. @@ -41,6 +41,7 @@ #endif #if defined _LIBC && defined USE_IN_LIBIO +# include <wchar.h> # include <libio/libioP.h> # define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a) #endif @@ -58,8 +59,10 @@ argp_fmtstream_t __argp_make_fmtstream (FILE *stream, size_t lmargin, size_t rmargin, ssize_t wmargin) { - argp_fmtstream_t fs = malloc (sizeof (struct argp_fmtstream)); - if (fs) + argp_fmtstream_t fs; + + fs = (struct argp_fmtstream *) malloc (sizeof (struct argp_fmtstream)); + if (fs != NULL) { fs->stream = stream; @@ -69,7 +72,7 @@ __argp_make_fmtstream (FILE *stream, fs->point_col = 0; fs->point_offs = 0; - fs->buf = malloc (INIT_BUF_SIZE); + fs->buf = (char *) malloc (INIT_BUF_SIZE); if (! fs->buf) { free (fs); @@ -94,7 +97,14 @@ __argp_fmtstream_free (argp_fmtstream_t fs) { __argp_fmtstream_update (fs); if (fs->p > fs->buf) - fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); + { +#ifdef USE_IN_LIBIO + if (_IO_fwide (fs->stream, 0) > 0) + fwprintf (fs->stream, L"%.*s", (int) (fs->p - fs->buf), fs->buf); + else +#endif + fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); + } free (fs->buf); free (fs); } @@ -134,7 +144,14 @@ __argp_fmtstream_update (argp_fmtstream_t fs) /* No buffer space for spaces. Must flush. */ size_t i; for (i = 0; i < pad; i++) - putc_unlocked (' ', fs->stream); + { +#ifdef USE_IN_LIBIO + if (_IO_fwide (fs->stream, 0) > 0) + putwc_unlocked (L' ', fs->stream); + else +#endif + putc_unlocked (' ', fs->stream); + } } fs->point_col = pad; } @@ -267,9 +284,17 @@ __argp_fmtstream_update (argp_fmtstream_t fs) else /* Output the first line so we can use the space. */ { - if (nl > fs->buf) - fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream); - putc_unlocked ('\n', fs->stream); +#ifdef USE_IN_LIBIO + if (_IO_fwide (fs->stream, 0) > 0) + fwprintf (fs->stream, L"%.*s\n", + (int) (nl - fs->buf), fs->buf); + else +#endif + { + if (nl > fs->buf) + fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream); + putc_unlocked ('\n', fs->stream); + } len += buf - fs->buf; nl = buf = fs->buf; } @@ -286,7 +311,12 @@ __argp_fmtstream_update (argp_fmtstream_t fs) *nl++ = ' '; else for (i = 0; i < fs->wmargin; ++i) - putc_unlocked (' ', fs->stream); +#ifdef USE_IN_LIBIO + if (_IO_fwide (fs->stream, 0) > 0) + putwc_unlocked (L' ', fs->stream); + else +#endif + putc_unlocked (' ', fs->stream); /* Copy the tail of the original buffer into the current buffer position. */ @@ -323,7 +353,15 @@ __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount) /* Flush FS's buffer. */ __argp_fmtstream_update (fs); - wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); +#ifdef USE_IN_LIBIO + if (_IO_fwide (fs->stream, 0) > 0) + { + __fwprintf (fs->stream, L"%.*s", (int) (fs->p - fs->buf), fs->buf); + wrote = fs->p - fs->buf; + } + else +#endif + wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); if (wrote == fs->p - fs->buf) { fs->p = fs->buf; diff --git a/assert/assert-perr.c b/assert/assert-perr.c index 436a9ce8c3..597ac5efb4 100644 --- a/assert/assert-perr.c +++ b/assert/assert-perr.c @@ -17,16 +17,17 @@ 02111-1307 USA. */ #include <assert.h> +#include <libintl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sysdep.h> -#include <libintl.h> extern const char *__progname; #ifdef USE_IN_LIBIO +# include <wchar.h> # include <libio/iolibio.h> # define fflush(s) _IO_fflush (s) #endif @@ -46,17 +47,31 @@ __assert_perror_fail (int errnum, const char *function) { char errbuf[1024]; + char *buf; + #ifdef FATAL_PREPARE FATAL_PREPARE; #endif + (void) __asprintf (&buf, _("%s%s%s:%u: %s%sUnexpected error: %s.\n"), + __progname, __progname[0] ? ": " : "", + file, line, + function ? function : "", function ? ": " : "", + __strerror_r (errnum, errbuf, sizeof errbuf)); + /* Print the message. */ - (void) fprintf (stderr, _("%s%s%s:%u: %s%sUnexpected error: %s.\n"), - __progname, __progname[0] ? ": " : "", - file, line, - function ? function : "", function ? ": " : "", - __strerror_r (errnum, errbuf, sizeof errbuf)); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", buf); + else +#endif + (void) fputs (buf, stderr); + (void) fflush (stderr); + /* We have to free the buffer since the appplication might catch the + SIGABRT. */ + free (buf); + abort (); } diff --git a/assert/assert.c b/assert/assert.c index 81ad080413..df382456e3 100644 --- a/assert/assert.c +++ b/assert/assert.c @@ -17,15 +17,16 @@ 02111-1307 USA. */ #include <assert.h> +#include <libintl.h> #include <stdio.h> #include <stdlib.h> #include <sysdep.h> -#include <libintl.h> extern const char *__progname; #ifdef USE_IN_LIBIO +# include <wchar.h> # include <libio/iolibio.h> # define fflush(s) _IO_fflush (s) #endif @@ -44,17 +45,31 @@ void __assert_fail (const char *assertion, const char *file, unsigned int line, const char *function) { + char *buf; + #ifdef FATAL_PREPARE FATAL_PREPARE; #endif + (void) __asprintf (&buf, _("%s%s%s:%u: %s%sAssertion `%s' failed.\n"), + __progname, __progname[0] ? ": " : "", + file, line, + function ? function : "", function ? ": " : "", + assertion); + /* Print the message. */ - (void) fprintf (stderr, _("%s%s%s:%u: %s%sAssertion `%s' failed.\n"), - __progname, __progname[0] ? ": " : "", - file, line, - function ? function : "", function ? ": " : "", - assertion); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", buf); + else +#endif + (void) fputs (buf, stderr); + (void) fflush (stderr); + /* We have to free the buffer since the appplication might catch the + SIGABRT. */ + free (buf); + abort (); } diff --git a/gmon/gmon.c b/gmon/gmon.c index 8c8906eca4..c8923ab9da 100644 --- a/gmon/gmon.c +++ b/gmon/gmon.c @@ -331,8 +331,14 @@ write_gmon (void) { char buf[300]; int errnum = errno; - fprintf (stderr, "_mcleanup: gmon.out: %s\n", - __strerror_r (errnum, buf, sizeof buf)); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"_mcleanup: gmon.out: %s\n", + __strerror_r (errnum, buf, sizeof buf)); + else +#endif + fprintf (stderr, "_mcleanup: gmon.out: %s\n", + __strerror_r (errnum, buf, sizeof buf)); return; } } diff --git a/include/wchar.h b/include/wchar.h index 818afff3ea..0b5556ed51 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -53,6 +53,13 @@ extern int __vswprintf (wchar_t *__restrict __s, size_t __n, __const wchar_t *__restrict __format, __gnuc_va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; +extern int __fwprintf (__FILE *__restrict __s, + __const wchar_t *__restrict __format, ...) + /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; +extern int __vfwprintf (__FILE *__restrict __s, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) + /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; # endif #endif diff --git a/inet/rcmd.c b/inet/rcmd.c index de00bfaf13..7d974f3e0c 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -80,6 +80,9 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #include <string.h> #include <libintl.h> #include <stdlib.h> +#ifdef USE_IN_LIBIO +# include <wchar.h> +#endif int __ivaliduser (FILE *, u_int32_t, const char *, const char *); @@ -133,8 +136,14 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) (void)__snprintf(num, sizeof(num), "%d", ntohs(rport)); error = getaddrinfo(*ahost, num, &hints, &res); if (error) { - fprintf(stderr, "rcmd: getaddrinfo: %s\n", - gai_strerror(error)); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"rcmd: getaddrinfo: %s\n", + gai_strerror(error)); + else +#endif + fprintf(stderr, "rcmd: getaddrinfo: %s\n", + gai_strerror(error)); return (-1); } @@ -152,13 +161,28 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) refused = 0; oldmask = __sigblock(sigmask(SIGURG)); for (timo = 1, lport = IPPORT_RESERVED - 1;;) { + char errbuf[200]; + s = rresvport_af(&lport, ai->ai_family); if (s < 0) { - if (errno == EAGAIN) - fprintf(stderr, - _("rcmd: socket: All ports in use\n")); - else - fprintf(stderr, "rcmd: socket: %m\n"); + if (errno == EAGAIN) { +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"%s", + _("rcmd: socket: All ports in use\n")); + else +#endif + fputs(_("rcmd: socket: All ports in use\n"), + stderr); + } else { +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, + L"rcmd: socket: %m\n"); + else +#endif + fprintf(stderr, "rcmd: socket: %m\n"); + } __sigsetmask(oldmask); freeaddrinfo(res); return -1; @@ -175,12 +199,20 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) refused = 1; if (ai->ai_next != NULL) { int oerrno = errno; + char *buf = NULL; getnameinfo(ai->ai_addr, ai->ai_addrlen, paddr, sizeof(paddr), NULL, 0, NI_NUMERICHOST); - fprintf(stderr, "connect to address %s: ", paddr); + + asprintf (&buf, _("connect to address %s: "), paddr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); __set_errno (oerrno); perror(0); ai = ai->ai_next; @@ -188,7 +220,14 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) paddr, sizeof(paddr), NULL, 0, NI_NUMERICHOST); - fprintf(stderr, "Trying %s...\n", paddr); + asprintf (&buf, _("Trying %s...\n"), paddr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); + free (buf); continue; } if (refused && timo <= 16) { @@ -199,7 +238,16 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) continue; } freeaddrinfo(res); - (void)fprintf(stderr, "%s: %s\n", *ahost, strerror(errno)); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void)__fwprintf(stderr, L"%s: %s\n", *ahost, + __strerror_r(errno, + errbuf, sizeof (errbuf))); + else +#endif + (void)fprintf(stderr, "%s: %s\n", *ahost, + __strerror_r(errno, + errbuf, sizeof (errbuf))); __sigsetmask(oldmask); return -1; } @@ -217,8 +265,17 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) listen(s2, 1); (void)__snprintf(num, sizeof(num), "%d", lport); if (__write(s, num, strlen(num)+1) != (ssize_t)strlen(num)+1) { - (void)fprintf(stderr, - _("rcmd: write (setting up stderr): %m\n")); + char *buf = NULL; |
