* 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.
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>
/* 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>.
#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
__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;
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);
{
__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);
}
/* 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;
}
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;
}
*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. */
/* 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;
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
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 ();
}
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
__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 ();
}
{
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;
}
}
__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
#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 *);
(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);
}
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;
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;
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) {
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;
}
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;
+
+ asprintf (&buf,
+ _("rcmd: write (setting up stderr): %m\n"));
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf(stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+ free (buf);
(void)__close(s2);
goto bad;
}
pfd[1].fd = s2;
__set_errno (0);
if (__poll (pfd, 2, -1) < 1 || (pfd[1].revents & POLLIN) == 0){
+ char *buf = NULL;
+
if (errno != 0)
- (void)fprintf(stderr,
+ asprintf(&buf,
_("rcmd: poll (setting up stderr): %m\n"));
else
- (void)fprintf(stderr,
+ asprintf(&buf,
_("poll: protocol failure in circuit setup\n"));
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+ free (buf);
(void)__close(s2);
goto bad;
}
}
(void)__close(s2);
if (s3 < 0) {
- (void)fprintf(stderr,
- "rcmd: accept: %m\n");
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void)__fwprintf(stderr,
+ L"rcmd: accept: %m\n");
+ else
+#endif
+ (void)fprintf(stderr,
+ "rcmd: accept: %m\n");
lport = 0;
goto bad;
}
*fd2p = s3;
if (rport >= IPPORT_RESERVED || rport < IPPORT_RESERVED / 2){
- (void)fprintf(stderr,
- _("socket: protocol failure in circuit setup\n"));
+ char *buf = NULL;
+
+ asprintf(&buf,
+ _("socket: protocol failure in circuit setup\n"));
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+ free (buf);
goto bad2;
}
}
(void)__write(s, cmd, strlen(cmd)+1);
n = __read(s, &c, 1);
if (n != 1) {
+ char *buf = NULL;
+
if (n == 0)
- (void)fprintf(stderr, _("rcmd: %s: short read"),
- *ahost);
+ asprintf(&buf, _("rcmd: %s: short read"), *ahost);
+ else
+ asprintf(&buf, "rcmd: %s: %m\n", *ahost);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
else
- (void)fprintf(stderr, "rcmd: %s: %m\n", *ahost);
+#endif
+ fputs (buf, stderr);
+ free (buf);
goto bad2;
}
if (c != 0) {
-/* Copyright (C) 1991, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 1999, 2000, 2001 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
/* Write formatted output to STREAM from the format string FORMAT. */
/* VARARGS2 */
int
-fwprintf (FILE *stream, const wchar_t *format, ...)
+__fwprintf (FILE *stream, const wchar_t *format, ...)
{
va_list arg;
int done;
return done;
}
+weak_alias (__fwprintf, fwprintf)
main (void)
{
FILE *fp;
- char *str = "abcdef";
+ const char *str = "abcdef";
wint_t ret, wc;
char fname[] = "/tmp/tst-ungetwc2.out.XXXXXX";
int fd;
__attribute__ ((noreturn))
print_and_abort ()
{
- fputs (_("memory exhausted"), stderr);
- fputc ('\n', stderr);
+#if defined _LIBC && defined USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s\n", _("memory exhausted"));
+ else
+#endif
+ {
+ fputs (_("memory exhausted"), stderr);
+ fputc ('\n', stderr);
+ }
exit (obstack_exit_failure);
}
\f
/* The string cannot be converted. */
wformat = (wchar_t *) L"???";
- vfwprintf (stderr, wformat, ap);
+ __vfwprintf (stderr, wformat, ap);
}
#endif
#ifdef USE_IN_LIBIO
if (_IO_fwide (stderr, 0) > 0)
{
- fwprintf (stderr, L"%s: ", __progname);
+ __fwprintf (stderr, L"%s: ", __progname);
convert_and_print (format, ap);
putwc_unlocked (L'\n', stderr);
}
#ifdef USE_IN_LIBIO
if (_IO_fwide (stderr, 0) > 0)
{
- fwprintf (stderr, L"%s: ", __progname);
+ __fwprintf (stderr, L"%s: ", __progname);
if (format)
{
convert_and_print (format, ap);
fputws_unlocked (L": ", stderr);
}
__set_errno (error);
- fwprintf (stderr, L"%m\n");
+ __fwprintf (stderr, L"%m\n");
}
else
#endif
/* The string cannot be converted. */
wmessage = (wchar_t *) L"???";
- vfwprintf (stderr, wmessage, args);
+ __vfwprintf (stderr, wmessage, args);
}
else
# endif
char *s = __strerror_r (errnum, errbuf, sizeof errbuf);
# ifdef _LIBC
if (_IO_fwide (stderr, 0) > 0)
- fwprintf (stderr, L": %s", s);
+ __fwprintf (stderr, L": %s", s);
else
# endif
fprintf (stderr, ": %s", s);
{
#ifdef _LIBC
if (_IO_fwide (stderr, 0) > 0)
- fwprintf (stderr, L"%s: ", program_name);
+ __fwprintf (stderr, L"%s: ", program_name);
else
#endif
fprintf (stderr, "%s: ", program_name);
{
#ifdef _LIBC
if (_IO_fwide (stderr, 0) > 0)
- fwprintf (stderr, L"%s: ", program_name);
+ __fwprintf (stderr, L"%s: ", program_name);
else
#endif
fprintf (stderr, "%s:", program_name);
{
#ifdef _LIBC
if (_IO_fwide (stderr, 0) > 0)
- fwprintf (stderr, L"%s:%d: ", file_name, line_number);
+ __fwprintf (stderr, L"%s:%d: ", file_name, line_number);
else
#endif
fprintf (stderr, "%s:%d: ", file_name, line_number);
tty_changed = 0;
/* Write the prompt. */
- fputs_unlocked (prompt, out);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (out, 0) > 0)
+ __fwprintf (out, L"%s", prompt);
+ else
+#endif
+ fputs_unlocked (prompt, out);
fflush_unlocked (out);
/* Read the password. */
/* Remove the newline. */
buf[nread - 1] = '\0';
if (tty_changed)
- /* Write the newline that was not echoed. */
- putc_unlocked ('\n', out);
+ {
+ /* Write the newline that was not echoed. */
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (out, 0) > 0)
+ putwc_unlocked (L'\n', out);
+ else
+#endif
+ putc_unlocked ('\n', out);
+ }
}
}
# else
# define _(msgid) (msgid)
# endif
+# if defined _LIBC && defined USE_IN_LIBIO
+# include <wchar.h>
+# endif
#endif
/* This version of `getopt' appears to the caller like standard Unix `getopt'
if (ambig && !exact)
{
if (print_errors)
- fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
- argv[0], argv[optind]);
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ __asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
+ argv[0], argv[optind]);
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ free (buf);
+#else
+ fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+ argv[0], argv[optind]);
+#endif
+ }
nextchar += strlen (nextchar);
optind++;
optopt = 0;
{
if (print_errors)
{
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+#endif
+
if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- _("%s: option `--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
+ {
+ /* --option */
+#if defined _LIBC && defined USE_IN_LIBIO
+ __asprintf (&buf, _("\
+%s: option `--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+#else
+ fprintf (stderr, _("\
+%s: option `--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+#endif
+ }
else
- /* +option or -option */
- fprintf (stderr,
- _("%s: option `%c%s' doesn't allow an argument\n"),
- argv[0], argv[optind - 1][0], pfound->name);
+ {
+ /* +option or -option */
+#if defined _LIBC && defined USE_IN_LIBIO
+ __asprintf (&buf, _("\
+%s: option `%c%s' doesn't allow an argument\n"),
+ argv[0], argv[optind - 1][0],
+ pfound->name);
+#else
+ fprintf (stderr, _("\
+%s: option `%c%s' doesn't allow an argument\n"),
+ argv[0], argv[optind - 1][0], pfound->name);
+#endif
+ }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ free (buf);
+#endif
}
nextchar += strlen (nextchar);
else
{
if (print_errors)
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ __asprintf (&buf,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ free (buf);
+#else
+ fprintf (stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+#endif
+ }
nextchar += strlen (nextchar);
optopt = pfound->val;
return optstring[0] == ':' ? ':' : '?';
{
if (print_errors)
{
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+#endif
+
if (argv[optind][1] == '-')
- /* --option */
- fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
- argv[0], nextchar);
+ {
+ /* --option */
+#if defined _LIBC && defined USE_IN_LIBIO
+ __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
+ argv[0], nextchar);
+#else
+ fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+ argv[0], nextchar);
+#endif
+ }
+ else
+ {
+ /* +option or -option */
+#if defined _LIBC && defined USE_IN_LIBIO
+ __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
+ argv[0], argv[optind][0], nextchar);
+#else
+ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+ argv[0], argv[optind][0], nextchar);
+#endif
+ }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
else
- /* +option or -option */
- fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
- argv[0], argv[optind][0], nextchar);
+ fputs (buf, stderr);
+
+ free (buf);
+#endif
}
nextchar = (char *) "";
optind++;
{
if (print_errors)
{
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+#endif
+
if (posixly_correct)
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, _("%s: illegal option -- %c\n"),
- argv[0], c);
+ {
+ /* 1003.2 specifies the format of this message. */
+#if defined _LIBC && defined USE_IN_LIBIO
+ __asprintf (&buf, _("%s: illegal option -- %c\n"),
+ argv[0], c);
+#else
+ fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
+#endif
+ }
else
- fprintf (stderr, _("%s: invalid option -- %c\n"),
- argv[0], c);
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ __asprintf (&buf, _("%s: invalid option -- %c\n"),
+ argv[0], c);
+#else
+ fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
+#endif
+ }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ free (buf);
+#endif
}
optopt = c;
return '?';
if (print_errors)
{
/* 1003.2 specifies the format of this message. */
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ __asprintf (&buf, _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ free (buf);
+#else
fprintf (stderr, _("%s: option requires an argument -- %c\n"),
argv[0], c);
+#endif
}
optopt = c;
if (optstring[0] == ':')
if (ambig && !exact)
{
if (print_errors)
- fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
- argv[0], argv[optind]);
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ __asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
+ argv[0], argv[optind]);
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ free (buf);
+#else
+ fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+ argv[0], argv[optind]);
+#endif
+ }
nextchar += strlen (nextchar);
optind++;
return '?';
else
{
if (print_errors)
- fprintf (stderr, _("\
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ __asprintf (&buf, _("\
%s: option `-W %s' doesn't allow an argument\n"),
- argv[0], pfound->name);
+ argv[0], pfound->name);
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ free (buf);
+#else
+ fprintf (stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+#endif
+ }
nextchar += strlen (nextchar);
return '?';
else
{
if (print_errors)
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ __asprintf (&buf, _("\
+%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ free (buf);
+#else
+ fprintf (stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+#endif
+ }
nextchar += strlen (nextchar);
return optstring[0] == ':' ? ':' : '?';
}
if (print_errors)
{
/* 1003.2 specifies the format of this message. */
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ __asprintf (&buf,
+ _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ free (buf);
+#else
fprintf (stderr,
_("%s: option requires an argument -- %c\n"),
argv[0], c);
+#endif
}
optopt = c;
if (optstring[0] == ':')
#include <errno.h>
#include <ctype.h>
+#include <libintl.h>
#include <memory.h>
#include <stdio.h>
#include <stdio_ext.h>
#include <bits/libc-lock.h>
#include "ifreq.h"
#include "res_hconf.h"
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
#define _PATH_HOSTCONF "/etc/host.conf"
}
if (service == SERVICE_NONE)
{
- fprintf (stderr, "%s: line %d: expected service, found `%s'\n",
- fname, line_num, start);
+ char *buf;
+
+ __asprintf (&buf, _("%s: line %d: expected service, found `%s'\n"),
+ fname, line_num, start);
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+
+ free (buf);
return 0;
}
if (_res_hconf.num_services >= SERVICE_MAX)
{
- fprintf (stderr, "%s: line %d: cannot specify more than %d services",
- fname, line_num, SERVICE_MAX);
+ char *buf;
+
+ __asprintf (&buf,
+ _("%s: line %d: cannot specify more than %d services"),
+ fname, line_num, SERVICE_MAX);
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+
+ free (buf);
return 0;
}
_res_hconf.service[_res_hconf.num_services++] = service;
args = skip_ws (++args);
if (!*args || *args == '#')
{
- fprintf (stderr,
- "%s: line %d: list delimiter not followed by keyword",
- fname, line_num);
+ char *buf;
+
+ __asprintf (&buf, _("\
+%s: line %d: list delimiter not followed by keyword"),
+ fname, line_num);
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+
+ free (buf);
return 0;
}
default:
if (_res_hconf.num_trimdomains >= TRIMDOMAINS_MAX)
{
- fprintf (stderr,
- "%s: line %d: cannot specify more than %d trim domains",
- fname, line_num, TRIMDOMAINS_MAX);
+ char *buf;
+
+ __asprintf (&buf, _("\
+%s: line %d: cannot specify more than %d trim domains"),
+ fname, line_num, TRIMDOMAINS_MAX);
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+
+ free (buf);
return 0;
}
_res_hconf.trimdomain[_res_hconf.num_trimdomains++] =
args = skip_ws (++args);
if (!*args || *args == '#')
{
- fprintf (stderr,
- "%s: line %d: list delimiter not followed by domain",
- fname, line_num);
+ char *buf;
+
+ __asprintf (&buf, _("\
+%s: line %d: list delimiter not followed by domain"),
+ fname, line_num);
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+
+ free (buf);
return 0;
}
default:
}
else
{
- fprintf (stderr, "%s: line %d: expected `on' or `off', found `%s'\n",
- fname, line_num, args);
+ char *buf;
+
+ __asprintf (&buf,
+ _("%s: line %d: expected `on' or `off', found `%s'\n"),
+ fname, line_num, args);
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+
+ free (buf);
return 0;
}
return args;
}
if (c == NULL)
{
- fprintf (stderr, "%s: line %d: bad command `%s'\n",
- fname, line_num, start);
+ char *buf;
+
+ __asprintf (&buf, _("%s: line %d: bad command `%s'\n"),
+ fname, line_num, start);
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+
+ free (buf);
return;
}
{
if (!isspace (*str)) {
if (*str != '#')
- fprintf (stderr, "%s: line %d: ignoring trailing garbage `%s'\n",
- fname, line_num, str);
+ {
+ char *buf;
+
+ __asprintf (&buf,
+ _("%s: line %d: ignoring trailing garbage `%s'\n"),
+ fname, line_num, str);
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+
+ free (buf);
+ }
break;
}
++str;
#ifdef USE_IN_LIBIO
if (_IO_fwide (fp, 0) > 0)
- (void) fwprintf (fp, L"%s%s%s\n", s, colon, errstring);
+ (void) __fwprintf (fp, L"%s%s%s\n", s, colon, errstring);
else
#endif
(void) fprintf (fp, "%s%s%s\n", s, colon, errstring);
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1995,1996,1997,2001 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
#include <stdio.h>
#include <signal.h>
+#include <stdlib.h>
#include <libintl.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
#ifndef HAVE_GNU_LD
colon = ": ";
if (sig >= 0 && sig < NSIG && (desc = _sys_siglist[sig]) != NULL)
- (void) fprintf (stderr, "%s%s%s\n", s, colon, _(desc));
+ {
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s%s%s\n", s, colon, _(desc));
+ else
+#endif
+ (void) fprintf (stderr, "%s%s%s\n", s, colon, _(desc));
+ }
else
- (void) fprintf (stderr, _("%s%sUnknown signal %d\n"), s, colon, sig);
+ {
+ char *buf;
+
+ (void) __asprintf (&buf, _("%s%sUnknown signal %d\n"), s, colon, sig);
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ (void) fputs (buf, stderr);
+
+ free (buf);
+ }
}
# ifdef strong_alias
/* This is for glibc. */
# ifdef COMPILE_WPRINTF
-strong_alias (_IO_vfwprintf, vfwprintf);
+strong_alias (_IO_vfwprintf, __vfwprintf);
+weak_alias (_IO_vfwprintf, vfwprintf);
# else
strong_alias (_IO_vfprintf, vfprintf);
# endif
-/* Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
#include <stdlib.h>
#include <string.h>
#include <sys/syslog.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
/* We have global data, protect the modification. */
int do_action = (print & action_mask) && action != MM_NULLACT;
int do_tag = (print & tag_mask) && tag != MM_NULLTAG;
- if (fprintf (stderr, "%s%s%s%s%s%s%s%s%s%s\n",
- do_label ? label : "",
- do_label && (do_severity | do_text | do_action | do_tag)
- ? ": " : "",
- do_severity ? severity_rec->string : "",
- do_severity && (do_text | do_action | do_tag) ? ": " : "",
- do_text ? text : "",
- do_text && (do_action | do_tag) ? "\n" : "",
- do_action ? "TO FIX: " : "",
- do_action ? action : "",
- do_action && do_tag ? " " : "",
- do_tag ? tag : "") == EOF)
- /* Oh, oh. An error occurred during the output. */
- result = MM_NOMSG;
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ {
+ if (__fwprintf (stderr, L"%s%s%s%s%s%s%s%s%s%s\n",
+ do_label ? label : "",
+ do_label
+ && (do_severity | do_text | do_action | do_tag)
+ ? ": " : "",
+ do_severity ? severity_rec->string : "",
+ do_severity && (do_text | do_action | do_tag)
+ ? ": " : "",
+ do_text ? text : "",
+ do_text && (do_action | do_tag) ? "\n" : "",
+ do_action ? "TO FIX: " : "",
+ do_action ? action : "",
+ do_action && do_tag ? " " : "",
+ do_tag ? tag : "") == WEOF)
+ /* Oh, oh. An error occurred during the output. */
+ result = MM_NOMSG;
+ }
+ else
+#endif
+ if (fprintf (stderr, "%s%s%s%s%s%s%s%s%s%s\n",
+ do_label ? label : "",
+ do_label && (do_severity | do_text | do_action | do_tag)
+ ? ": " : "",
+ do_severity ? severity_rec->string : "",
+ do_severity && (do_text | do_action | do_tag) ? ": " : "",
+ do_text ? text : "",
+ do_text && (do_action | do_tag) ? "\n" : "",
+ do_action ? "TO FIX: " : "",
+ do_action ? action : "",
+ do_action && do_tag ? " " : "",
+ do_tag ? tag : "") == EOF)
+ /* Oh, oh. An error occurred during the output. */
+ result = MM_NOMSG;
}
if (classification & MM_CONSOLE)
#include <rpc/auth.h>
#include <rpc/auth_unix.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
+
/*
* Unix authenticator operations vector
*/
* Allocate and set up auth handle
*/
auth = (AUTH *) mem_alloc (sizeof (*auth));
- if (auth == NULL)
- {
- (void) fprintf (stderr, _("authunix_create: out of memory\n"));
- return NULL;
- }
au = (struct audata *) mem_alloc (sizeof (*au));
- if (au == NULL)
+ if (auth == NULL || au == NULL)
{
- (void) fprintf (stderr, _("authunix_create: out of memory\n"));
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("authunix_create: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("authunix_create: out of memory\n"), stderr);
return NULL;
}
auth->ah_ops = &auth_unix_ops;
au->au_origcred.oa_base = mem_alloc ((u_int) len);
if (au->au_origcred.oa_base == NULL)
{
- (void) fputs (_("authunix_create: out of memory\n"), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("authunix_create: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("authunix_create: out of memory\n"), stderr);
return NULL;
}
memcpy(au->au_origcred.oa_base, mymem, (u_int) len);
#include <rpc/rpc.h>
#ifdef USE_IN_LIBIO
+# include <wchar.h>
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
void
clnt_perror (CLIENT * rpch, const char *msg)
{
- (void) fputs (clnt_sperror (rpch, msg), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s", clnt_sperror (rpch, msg));
+ else
+#endif
+ (void) fputs (clnt_sperror (rpch, msg), stderr);
}
void
clnt_perrno (enum clnt_stat num)
{
- (void) fputs (clnt_sperrno (num), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s", clnt_sperrno (num));
+ else
+#endif
+ (void) fputs (clnt_sperrno (num), stderr);
}
void
clnt_pcreateerror (const char *msg)
{
- (void) fputs (clnt_spcreateerror (msg), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s", clnt_spcreateerror (msg));
+ else
+#endif
+ (void) fputs (clnt_spcreateerror (msg), stderr);
}
struct auth_errtab
#include <sys/poll.h>
#include <sys/socket.h>
#include <rpc/pmap_clnt.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
extern u_long _create_xid (void);
int *sockp, u_int sendsz, u_int recvsz)
{
CLIENT *h;
- struct ct_data *ct = (struct ct_data *) mem_alloc (sizeof (*ct));
+ struct ct_data *ct;
struct rpc_msg call_msg;
h = (CLIENT *) mem_alloc (sizeof (*h));
- if (h == NULL)
+ ct = (struct ct_data *) mem_alloc (sizeof (*ct));
+ if (h == NULL || ct == NULL)
{
struct rpc_createerr *ce = &get_rpc_createerr ();
- (void) fprintf (stderr, _("clnttcp_create: out of memory\n"));
- ce->cf_stat = RPC_SYSTEMERROR;
- ce->cf_error.re_errno = errno;
- goto fooy;
- }
- /* ct = (struct ct_data *) mem_alloc (sizeof (*ct)); */
- if (ct == NULL)
- {
- struct rpc_createerr *ce = &get_rpc_createerr ();
- (void) fprintf (stderr, _("clnttcp_create: out of memory\n"));
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("clnttcp_create: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("clnttcp_create: out of memory\n"), stderr);
ce->cf_stat = RPC_SYSTEMERROR;
- ce->cf_error.re_errno = errno;
+ ce->cf_error.re_errno = ENOMEM;
goto fooy;
}
#include <errno.h>
#include <rpc/pmap_clnt.h>
#include <net/if.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
#ifdef IP_RECVERR
#include <errqueue.h>
struct rpc_msg call_msg;
cl = (CLIENT *) mem_alloc (sizeof (CLIENT));
- if (cl == NULL)
- {
- struct rpc_createerr *ce = &get_rpc_createerr ();
- (void) fprintf (stderr, _("clntudp_create: out of memory\n"));
- ce->cf_stat = RPC_SYSTEMERROR;
- ce->cf_error.re_errno = errno;
- goto fooy;
- }
sendsz = ((sendsz + 3) / 4) * 4;
recvsz = ((recvsz + 3) / 4) * 4;
cu = (struct cu_data *) mem_alloc (sizeof (*cu) + sendsz + recvsz);
- if (cu == NULL)
+ if (cl == NULL || cu == NULL)
{
struct rpc_createerr *ce = &get_rpc_createerr ();
- (void) fprintf (stderr, _("clntudp_create: out of memory\n"));
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("clntudp_create: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("clntudp_create: out of memory\n"), stderr);
ce->cf_stat = RPC_SYSTEMERROR;
- ce->cf_error.re_errno = errno;
+ ce->cf_error.re_errno = ENOMEM;
goto fooy;
}
cu->cu_outbuf = &cu->cu_inbuf[recvsz];
#include <sys/poll.h>
#include <sys/socket.h>
#include <rpc/pmap_clnt.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
extern u_long _create_xid (void);
int len;
h = (CLIENT *) mem_alloc (sizeof (*h));
- if (h == NULL)
- {
- struct rpc_createerr *ce = &get_rpc_createerr ();
- (void) fputs (_("clntunix_create: out of memory\n"), stderr);
- ce->cf_stat = RPC_SYSTEMERROR;
- ce->cf_error.re_errno = errno;
- goto fooy;
- }
- /* ct = (struct ct_data *) mem_alloc (sizeof (*ct)); */
- if (ct == NULL)
+ if (h == NULL || ct == NULL)
{
struct rpc_createerr *ce = &get_rpc_createerr ();
- (void) fputs (_("clntunix_create: out of memory\n"), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("clntunix_create: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("clntunix_create: out of memory\n"), stderr);
ce->cf_stat = RPC_SYSTEMERROR;
- ce->cf_error.re_errno = errno;
+ ce->cf_error.re_errno = ENOMEM;
goto fooy;
}
#include <stdio.h>
#include <string.h>
#include <libintl.h>
+#include <unistd.h>
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
#include <sys/socket.h>
#include <netdb.h>
#ifdef USE_IN_LIBIO
+# include <wchar.h>
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
char *(*progname) (char *), xdrproc_t inproc, xdrproc_t outproc)
{
struct proglst_ *pl;
+ char *buf;
if (procnum == NULLPROC)
{
- (void) fprintf (stderr,
- _("can't reassign procedure number %ld\n"), NULLPROC);
- return -1;
+
+ (void) __asprintf (&buf, _("can't reassign procedure number %ld\n"),
+ NULLPROC);
+ goto err_out;
}
if (transp == 0)
{
transp = svcudp_create (RPC_ANYSOCK);
if (transp == NULL)
{
- (void) fputs (_("couldn't create an rpc server\n"), stderr);
- return -1;
+ buf = strdup (_("couldn't create an rpc server\n"));
+ goto err_out;
}
}
(void) pmap_unset ((u_long) prognum, (u_long) versnum);
if (!svc_register (transp, (u_long) prognum, (u_long) versnum,
universal, IPPROTO_UDP))
{
- (void) fprintf (stderr, _("couldn't register prog %ld vers %ld\n"),
- prognum, versnum);
- return -1;
+ (void) __asprintf (&buf, _("couldn't register prog %ld vers %ld\n"),
+ prognum, versnum);
+ goto err_out;
}
pl = (struct proglst_ *) malloc (sizeof (struct proglst_));
if (pl == NULL)
{
- (void) fprintf (stderr, _("registerrpc: out of memory\n"));
- return -1;
+ buf = strdup (_("registerrpc: out of memory\n"));
+ goto err_out;
}
pl->p_progname = progname;
pl->p_prognum = prognum;
pl->p_nxt = proglst;
proglst = pl;
return 0;
+
+ err_out:
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ (void) fputs (buf, stderr);
+ free (buf);
+ return -1;
}
static void
char *outdata;
char xdrbuf[UDPMSGSIZE];
struct proglst_ *pl;
+ char *buf = NULL;
/*
* enforce "procnum 0 is echo" convention
{
if (svc_sendreply (transp_l, (xdrproc_t)xdr_void, (char *) NULL) == FALSE)
{
- (void) fprintf (stderr, "xxx\n");
+ write (STDERR_FILENO, "xxx\n", 4);
exit (1);
}
return;
return;
if (!svc_sendreply (transp_l, pl->p_outproc, outdata))
{
- (void) fprintf (stderr,
- _ ("trouble replying to prog %d\n"),
- pl->p_prognum);
+ (void) __asprintf (&buf,
+ _("trouble replying to prog %d\n"),
+ pl->p_prognum);
exit (1);
}
/* free the decoded arguments */
(void) svc_freeargs (transp_l, pl->p_inproc, xdrbuf);
return;
}
- (void) fprintf (stderr, _ ("never registered prog %d\n"), prog);
+ (void) __asprintf (&buf, _("never registered prog %d\n"), prog);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+#endif
+ fputs (buf, stderr);
+ free (buf);
exit (1);
}
#include <stdlib.h>
#ifdef USE_IN_LIBIO
+# include <wchar.h>
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
return (SVCXPRT *) NULL;
}
r = (struct tcp_rendezvous *) mem_alloc (sizeof (*r));
- if (r == NULL)
+ xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
+ if (r == NULL || xprt == NULL)
{
- (void) fputs (_("svctcp_create: out of memory\n"), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s", _("svctcp_create: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("svctcp_create: out of memory\n"), stderr);
return NULL;
}
r->sendsize = sendsize;
r->recvsize = recvsize;
- xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
- if (xprt == NULL)
- {
- (void) fputs (_("svctcp_create: out of memory\n"), stderr);
- return NULL;
- }
xprt->xp_p2 = NULL;
xprt->xp_p1 = (caddr_t) r;
xprt->xp_verf = _null_auth;
struct tcp_conn *cd;
xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
- if (xprt == (SVCXPRT *) NULL)
- {
- (void) fputs (_("svc_tcp: makefd_xprt: out of memory\n"), stderr);
- goto done;
- }
cd = (struct tcp_conn *) mem_alloc (sizeof (struct tcp_conn));
- if (cd == (struct tcp_conn *) NULL)
+ if (xprt == (SVCXPRT *) NULL || cd == NULL)
{
- (void) fputs (_("svc_tcp: makefd_xprt: out of memory\n"), stderr);
- mem_free ((char *) xprt, sizeof (SVCXPRT));
- xprt = (SVCXPRT *) NULL;
- goto done;
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("svc_tcp: makefd_xprt: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("svc_tcp: makefd_xprt: out of memory\n"), stderr);
+ return NULL;
}
cd->strm_stat = XPRT_IDLE;
xdrrec_create (&(cd->xdrs), sendsize, recvsize,
xprt->xp_port = 0; /* this is a connection, not a rendezvouser */
xprt->xp_sock = fd;
xprt_register (xprt);
-done:
return xprt;
}
#endif
#ifdef USE_IN_LIBIO
+# include <wchar.h>
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
struct svcudp_data *su;
struct sockaddr_in addr;
socklen_t len = sizeof (struct sockaddr_in);
- int pad;
+ int pad;
+ void *buf;
if (sock == RPC_ANYSOCK)
{
return (SVCXPRT *) NULL;
}
xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
- if (xprt == NULL)
- {
- (void) fputs (_("svcudp_create: out of memory\n"), stderr);
- return NULL;
- }
su = (struct svcudp_data *) mem_alloc (sizeof (*su));
- if (su == NULL)
+ buf = mem_alloc (((MAX (sendsz, recvsz) + 3) / 4) * 4);
+ if (xprt == NULL || su == NULL || buf == NULL)
{
- (void) fputs (_("svcudp_create: out of memory\n"), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s", _("svcudp_create: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("svcudp_create: out of memory\n"), stderr);
return NULL;
}
su->su_iosz = ((MAX (sendsz, recvsz) + 3) / 4) * 4;
- if ((rpc_buffer (xprt) = mem_alloc (su->su_iosz)) == NULL)
- {
- (void) fputs (_("svcudp_create: out of memory\n"), stderr);
- return NULL;
- }
+ rpc_buffer (xprt) = buf;
xdrmem_create (&(su->su_xdrs), rpc_buffer (xprt), su->su_iosz, XDR_DECODE);
su->su_cache = NULL;
xprt->xp_p2 = (caddr_t) su;
+ sizeof(struct cmsghdr) + sizeof (struct in_pktinfo))
> sizeof (xprt->xp_pad))
{
- (void) fputs (_("svcudp_create: xp_pad is too small for IP_PKTINFO\n"),
- stderr);
+# ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("svcudp_create: xp_pad is too small for IP_PKTINFO\n"));
+ else
+# endif
+ (void) fputs (_("svcudp_create: xp_pad is too small for IP_PKTINFO\n"),
+ stderr);
return NULL;
}
pad = 1;
#define SPARSENESS 4 /* 75% sparse */
-#define CACHE_PERROR(msg) \
+#ifdef USE_IN_LIBIO
+# define CACHE_PERROR(msg) \
+ if (_IO_fwide (stderr, 0) > 0) \
+ (void) __fwprintf(stderr, L"%s\n", msg); \
+ else \
+ (void) fprintf(stderr, "%s\n", msg)
+#else
+# define CACHE_PERROR(msg) \
(void) fprintf(stderr,"%s\n", msg)
+#endif
#define ALLOC(type, size) \
(type *) mem_alloc((unsigned) (sizeof(type) * (size)))
#include <stdlib.h>
#include <libintl.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
+
/*
* Ops vector for AF_UNIX based rpc service handle
*/
}
r = (struct unix_rendezvous *) mem_alloc (sizeof (*r));
- if (r == NULL)
+ xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
+ if (r == NULL || xprt == NULL)
{
- fputs (_("svcunix_create: out of memory\n"), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", _("svcunix_create: out of memory\n"));
+ else
+#endif
+ fputs (_("svcunix_create: out of memory\n"), stderr);
return NULL;
}
r->sendsize = sendsize;
r->recvsize = recvsize;
- xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
- if (xprt == NULL)
- {
- fputs (_("svcunix_create: out of memory\n"), stderr);
- return NULL;
- }
xprt->xp_p2 = NULL;
xprt->xp_p1 = (caddr_t) r;
xprt->xp_verf = _null_auth;
struct unix_conn *cd;
xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
- if (xprt == (SVCXPRT *) NULL)
- {
- (void) fputs (_("svc_unix: makefd_xprt: out of memory\n"), stderr);
- goto done;
- }
cd = (struct unix_conn *) mem_alloc (sizeof (struct unix_conn));
- if (cd == (struct unix_conn *) NULL)
+ if (xprt == (SVCXPRT *) NULL || cd == (struct unix_conn *) NULL)
{
- (void) fputs (_("svc_unix: makefd_xprt: out of memory\n"), stderr);
- mem_free ((char *) xprt, sizeof (SVCXPRT));
- xprt = (SVCXPRT *) NULL;
- goto done;
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("svc_unix: makefd_xprt: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("svc_unix: makefd_xprt: out of memory\n"), stderr);
+ return NULL;
}
cd->strm_stat = XPRT_IDLE;
xdrrec_create (&(cd->xdrs), sendsize, recvsize,
xprt->xp_port = 0; /* this is a connection, not a rendezvouser */
xprt->xp_sock = fd;
xprt_register (xprt);
-done:
return xprt;
}
#include <stdio.h>
#include <limits.h>
#include <string.h>
+#include <libintl.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
+
/*
* constants specific to the xdr "protocol"
*/
}
if (sp == NULL)
{
- (void) fprintf (stderr, "xdr_bytes: out of memory\n");
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s", _("xdr_bytes: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("xdr_bytes: out of memory\n"), stderr);
return FALSE;
}
/* fall into ... */
*cpp = sp = (char *) mem_alloc (nodesize);
if (sp == NULL)
{
- (void) fprintf (stderr, "xdr_string: out of memory\n");
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("xdr_string: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("xdr_string: out of memory\n"), stderr);
return FALSE;
}
sp[size] = 0;
#include <string.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
+#include <libintl.h>
+
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
#define LASTUNSIGNED ((u_int)0-1)
*addrp = target = mem_alloc (nodesize);
if (target == NULL)
{
- (void) fprintf (stderr,
- "xdr_array: out of memory\n");
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("xdr_array: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("xdr_array: out of memory\n"), stderr);
return FALSE;
}
__bzero (target, nodesize);
#include <libintl.h>
#ifdef USE_IN_LIBIO
+# include <wchar.h>
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
{
RECSTREAM *rstrm = (RECSTREAM *) mem_alloc (sizeof (RECSTREAM));
caddr_t tmp;
+ char *buf = mem_alloc (sendsize + recvsize + BYTES_PER_XDR_UNIT);
- if (rstrm == NULL)
+ if (rstrm == NULL || buf == NULL)
{
- (void) fputs (_("xdrrec_create: out of memory\n"), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s", _("xdrrec_create: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("xdrrec_create: out of memory\n"), stderr);
/*
* This is bad. Should rework xdrrec_create to
* return a handle, and in this case return NULL
*/
rstrm->sendsize = sendsize = fix_buf_size (sendsize);
rstrm->recvsize = recvsize = fix_buf_size (recvsize);
- rstrm->the_buffer = mem_alloc (sendsize + recvsize + BYTES_PER_XDR_UNIT);
- if (rstrm->the_buffer == NULL)
- {
- (void) fputs (_("xdrrec_create: out of memory\n"), stderr);
- return;
- }
+ rstrm->the_buffer = buf;
tmp = rstrm->the_buffer;
if ((size_t)tmp % BYTES_PER_XDR_UNIT)
tmp += BYTES_PER_XDR_UNIT - (size_t)tmp % BYTES_PER_XDR_UNIT;
#include <libintl.h>
#ifdef USE_IN_LIBIO
+# include <wchar.h>
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
*pp = loc = (caddr_t) mem_alloc (size);
if (loc == NULL)
{
- (void) fputs (_("xdr_reference: out of memory\n"), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("xdr_reference: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("xdr_reference: out of memory\n"), stderr);
return FALSE;
}
__bzero (loc, (int) size);
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <wordexp.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <fnmatch.h>
+#include <glob.h>
+#include <libintl.h>
+#include <paths.h>
+#include <pwd.h>
#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <pwd.h>
-#include <sys/types.h>
#include <string.h>
-#include <glob.h>
-#include <ctype.h>
+#include <sys/param.h>
+#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <paths.h>
-#include <errno.h>
-#include <sys/param.h>
-#include <stdio.h>
-#include <fnmatch.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
+#include <wordexp.h>
#include <stdio-common/_itoa.h>
if (!colon_seen && value)
/* Substitute NULL */
;
- else if (*pattern)
- fprintf (stderr, "%s: %s\n", env, pattern);
else
{
- fprintf (stderr, "%s: parameter null or not set\n", env);
- error = WRDE_BADVAL;
+ const char *str = pattern;
+
+ if (str[0] == '\0')
+ str = gettext ("parameter null or not set");
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s: %s\n", env, str);
+ else
+#endif
+ fprintf (stderr, "%s: %s\n", env, str);
}
if (free_value)