summaryrefslogtreecommitdiff
path: root/argp/argp-help.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-20 06:37:56 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-20 06:37:56 +0000
commit9af652f60865624b4f44605c0c8bd4c23a18a2a7 (patch)
tree74905537f4aacd0ad0f819845808639df06d8612 /argp/argp-help.c
parent091b895531aabba1adc36ac6b68dd91ba52a0945 (diff)
Update.
2001-08-19 Ulrich Drepper <drepper@redhat.com> * 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: <inttypes.h> test requires <stddef.h>.
Diffstat (limited to 'argp/argp-help.c')
-rw-r--r--argp/argp-help.c100
1 files changed, 81 insertions, 19 deletions
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 <miles@gnu.ai.mit.edu>.
@@ -52,6 +52,9 @@ char *alloca ();
#include <stdarg.h>
#include <malloc.h>
#include <ctype.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#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);