From 9af652f60865624b4f44605c0c8bd4c23a18a2a7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 20 Aug 2001 06:37:56 +0000 Subject: Update. 2001-08-19 Ulrich Drepper * sunrpc/svcauth_des.c (_svcauth_des): Avoid using bcopy. * sunrpc/xdr_rec.c: Likewise. * sunrpc/xdr_mem.c: Likewise. * sunrpc/svc_authux.c (_svcauth_unix): Likewise. * sunrpc/rpc_cmsg.c: Likewise. * sunrpc/getrpcport.c (getrpcport): Likewise. * sunrpc/clnt_simp.c (callrpc): Likewise. * sunrpc/clnt_gen.c (clnt_create): Likewise. * string/envz.c: Likewise. * po/ko.po: Update from translation team. * argp/argp-help.c: Handle wide oriented stderr stream. * conform/conformtest.pl: test requires . --- argp/argp-help.c | 100 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 81 insertions(+), 19 deletions(-) (limited to 'argp/argp-help.c') diff --git a/argp/argp-help.c b/argp/argp-help.c index 852992591e..de709dff8f 100644 --- a/argp/argp-help.c +++ b/argp/argp-help.c @@ -1,5 +1,5 @@ /* Hierarchial argument parsing help output - Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc. + Copyright (C) 1995-2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -52,6 +52,9 @@ char *alloca (); #include #include #include +#ifdef USE_IN_LIBIO +# include +#endif #ifndef _ /* This is for other GNU distributions with internationalized messages. */ @@ -1702,19 +1705,39 @@ __argp_error (const struct argp_state *state, const char *fmt, ...) __flockfile (stream); - fputs_unlocked (state ? state->name : program_invocation_short_name, - stream); - putc_unlocked (':', stream); - putc_unlocked (' ', stream); - va_start (ap, fmt); - vfprintf (stream, fmt, ap); - va_end (ap); - putc_unlocked ('\n', stream); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stream, 0) > 0) + { + char *buf; + + asprintf (&buf, fmt, ap); + + fwprintf (stream, L"%s: %s\n", + state ? state->name : program_invocation_short_name, + buf); + + free (buf); + } + else +#endif + { + fputs_unlocked (state + ? state->name : program_invocation_short_name, + stream); + putc_unlocked (':', stream); + putc_unlocked (' ', stream); + + vfprintf (stream, fmt, ap); + + putc_unlocked ('\n', stream); + } __argp_state_help (state, stream, ARGP_HELP_STD_ERR); + va_end (ap); + __funlockfile (stream); } } @@ -1743,29 +1766,68 @@ __argp_failure (const struct argp_state *state, int status, int errnum, { __flockfile (stream); - fputs_unlocked (state ? state->name : program_invocation_short_name, - stream); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stream, 0) > 0) + fputws_unlocked (state + ? state->name : program_invocation_short_name, + stream); + else +#endif + fputs_unlocked (state + ? state->name : program_invocation_short_name, + stream); if (fmt) { va_list ap; - putc_unlocked (':', stream); - putc_unlocked (' ', stream); - va_start (ap, fmt); - vfprintf (stream, fmt, ap); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stream, 0) > 0) + { + char *buf; + + asprintf (&buf, fmt, ap); + + fwprintf (stream, L": %s", buf); + + free (buf); + } + else +#endif + { + putc_unlocked (':', stream); + putc_unlocked (' ', stream); + + vfprintf (stream, fmt, ap); + } + va_end (ap); } if (errnum) { - putc_unlocked (':', stream); - putc_unlocked (' ', stream); - fputs (strerror (errnum), stream); + char buf[200]; + +#ifdef USE_IN_LIBIO + if (_IO_fwide (stream, 0) > 0) + fwprintf (stream, ": %s", + __strerror_r (errnum, buf, sizeof (buf))); + else +#endif + { + putc_unlocked (':', stream); + putc_unlocked (' ', stream); + fputs (__strerror_r (errnum, buf, sizeof (buf)), stream); + } } - putc_unlocked ('\n', stream); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stream, 0) > 0) + putwc_unlocked (L'\n', stream); + else +#endif + putc_unlocked ('\n', stream); __funlockfile (stream); -- cgit v1.2.3