Skip to content

Commit

Permalink
* include/stdio.h (__fxprintf): Remove wfmt argument.
Browse files Browse the repository at this point in the history
	* stdio-common/fxprintf.c: Include assert.h, ctype.h and wchar.h.
	(__fxprintf): Remove wfmt argument, create wfmt format string on
	the fly from fmt.
	* argp/argp-fmtstream.c: Adjust all __fxprintf callers.
	* argp/argp-help.c: Likewise.
	* assert/assert-perr.c: Likewise.
	* assert/assert.c: Likewise.
	* gmon/gmon.c: Likewise.
	* inet/rcmd.c: Likewise.
	* malloc/obstack.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.
  • Loading branch information
Ulrich Drepper committed Jul 20, 2005
1 parent df6f896 commit 8a259a2
Show file tree
Hide file tree
Showing 31 changed files with 125 additions and 97 deletions.
35 changes: 35 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
2005-07-20 Jakub Jelinek <jakub@redhat.com>

* include/stdio.h (__fxprintf): Remove wfmt argument.
* stdio-common/fxprintf.c: Include assert.h, ctype.h and wchar.h.
(__fxprintf): Remove wfmt argument, create wfmt format string on
the fly from fmt.
* argp/argp-fmtstream.c: Adjust all __fxprintf callers.
* argp/argp-help.c: Likewise.
* assert/assert-perr.c: Likewise.
* assert/assert.c: Likewise.
* gmon/gmon.c: Likewise.
* inet/rcmd.c: Likewise.
* malloc/obstack.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.

2005-07-20 Ulrich Drepper <drepper@redhat.com>

* wcsmbs/bits/wchar2.h: Add definitions for wcrtomb, mbsrtowcs,
Expand Down
8 changes: 3 additions & 5 deletions argp/argp-fmtstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ __argp_fmtstream_free (argp_fmtstream_t fs)
if (fs->p > fs->buf)
{
#ifdef USE_IN_LIBIO
__fxprintf (fs->stream, "%.*s", L"%.*s",
(int) (fs->p - fs->buf), fs->buf);
__fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
#else
fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
#endif
Expand Down Expand Up @@ -292,7 +291,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
/* Output the first line so we can use the space. */
{
#ifdef _LIBC
__fxprintf (fs->stream, "%.*s\n", L"%.*s\n",
__fxprintf (fs->stream, "%.*s\n",
(int) (nl - fs->buf), fs->buf);
#else
if (nl > fs->buf)
Expand Down Expand Up @@ -359,8 +358,7 @@ __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
__argp_fmtstream_update (fs);

#ifdef _LIBC
__fxprintf (fs->stream, "%.*s", L"%.*s",
(int) (fs->p - fs->buf), fs->buf);
__fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
wrote = fs->p - fs->buf;
#else
wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
Expand Down
8 changes: 4 additions & 4 deletions argp/argp-help.c
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ __argp_error (const struct argp_state *state, const char *fmt, ...)
if (__asprintf (&buf, fmt, ap) < 0)
buf = NULL;

__fxprintf (stream, "%s: %s\n", L"%s: %s\n",
__fxprintf (stream, "%s: %s\n",
state ? state->name : __argp_short_program_name (), buf);

free (buf);
Expand Down Expand Up @@ -1821,7 +1821,7 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
#endif

#ifdef _LIBC
__fxprintf (stream, "%s", L"%s",
__fxprintf (stream, "%s",
state ? state->name : __argp_short_program_name ());
#else
fputs_unlocked (state ? state->name : __argp_short_program_name (),
Expand All @@ -1839,7 +1839,7 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
if (__asprintf (&buf, fmt, ap) < 0)
buf = NULL;

__fxprintf (stream, ": %s", L": %s", buf);
__fxprintf (stream, ": %s", buf);

free (buf);
#else
Expand All @@ -1857,7 +1857,7 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
char buf[200];

#ifdef _LIBC
__fxprintf (stream, ": %s", L": %s",
__fxprintf (stream, ": %s",
__strerror_r (errnum, buf, sizeof (buf)));
#else
putc_unlocked (':', stream);
Expand Down
2 changes: 1 addition & 1 deletion assert/assert-perr.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ __assert_perror_fail (int errnum,
__strerror_r (errnum, errbuf, sizeof errbuf)) >= 0)
{
/* Print the message. */
(void) __fxprintf (NULL, "%s", L"%s", buf);
(void) __fxprintf (NULL, "%s", buf);
(void) fflush (stderr);

/* We have to free the buffer since the appplication might catch the
Expand Down
2 changes: 1 addition & 1 deletion assert/assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ __assert_fail (const char *assertion, const char *file, unsigned int line,
assertion) >= 0)
{
/* Print the message. */
(void) __fxprintf (NULL, "%s", L"%s", buf);
(void) __fxprintf (NULL, "%s", buf);
(void) fflush (stderr);

/* We have to free the buffer since the application might catch the
Expand Down
1 change: 0 additions & 1 deletion gmon/gmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ write_gmon (void)
char buf[300];
int errnum = errno;
__fxprintf (NULL, "_mcleanup: gmon.out: %s\n",
L"_mcleanup: gmon.out: %s\n",
__strerror_r (errnum, buf, sizeof buf));
return;
}
Expand Down
4 changes: 2 additions & 2 deletions include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ extern int __ftrylockfile (FILE *__stream);
extern int __getc_unlocked (FILE *__fp);
extern wint_t __getwc_unlocked (FILE *__fp);

extern int __fxprintf (FILE *__fp, const char *__fmt, const wchar_t *__wfmt,
...) __attribute__ ((__format__ (__printf__, 2, 4)));
extern int __fxprintf (FILE *__fp, const char *__fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));

extern __const char *__const _sys_errlist_internal[] attribute_hidden;
extern int _sys_nerr_internal attribute_hidden;
Expand Down
28 changes: 12 additions & 16 deletions inet/rcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
error = getaddrinfo(*ahost, num, &hints, &res);
if (error) {
if (error == EAI_NONAME && *ahost != NULL)
__fxprintf(NULL, "%s: Unknown host\n",
L"%s: Unknown host\n", *ahost);
__fxprintf(NULL, "%s: Unknown host\n", *ahost);
else
__fxprintf(NULL, "rcmd: getaddrinfo: %s\n",
L"rcmd: getaddrinfo: %s\n",
gai_strerror(error));

return -1;
Expand All @@ -155,7 +153,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
free (ahostbuf);
ahostbuf = strdup (res->ai_canonname);
if (ahostbuf == NULL) {
__fxprintf(NULL, "%s", L"%s",
__fxprintf(NULL, "%s",
_("rcmd: Cannot allocate memory\n"));
return -1;
}
Expand All @@ -171,11 +169,10 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
s = rresvport_af(&lport, ai->ai_family);
if (s < 0) {
if (errno == EAGAIN)
__fxprintf(NULL, "%s", L"%s", _("\
__fxprintf(NULL, "%s", _("\
rcmd: socket: All ports in use\n"));
else
__fxprintf(NULL, "rcmd: socket: %m\n",
L"rcmd: socket: %m\n");
__fxprintf(NULL, "rcmd: socket: %m\n");

__sigsetmask(oldmask);
freeaddrinfo(res);
Expand Down Expand Up @@ -203,7 +200,7 @@ rcmd: socket: All ports in use\n"));
if (__asprintf (&buf, _("connect to address %s: "),
paddr) >= 0)
{
__fxprintf(NULL, "%s", L"%s", buf);
__fxprintf(NULL, "%s", buf);
free (buf);
}
__set_errno (oerrno);
Expand All @@ -215,7 +212,7 @@ rcmd: socket: All ports in use\n"));
NI_NUMERICHOST);
if (__asprintf (&buf, _("Trying %s...\n"), paddr) >= 0)
{
__fxprintf (NULL, "%s", L"%s", buf);
__fxprintf (NULL, "%s", buf);
free (buf);
}
continue;
Expand All @@ -228,7 +225,7 @@ rcmd: socket: All ports in use\n"));
continue;
}
freeaddrinfo(res);
(void)__fxprintf(NULL, "%s: %s\n", L"%s: %s\n", *ahost,
(void)__fxprintf(NULL, "%s: %s\n", *ahost,
__strerror_r(errno, errbuf, sizeof (errbuf)));
__sigsetmask(oldmask);
return -1;
Expand All @@ -252,7 +249,7 @@ rcmd: socket: All ports in use\n"));
if (__asprintf (&buf, _("\
rcmd: write (setting up stderr): %m\n")) >= 0)
{
__fxprintf(NULL, "%s", L"%s", buf);
__fxprintf(NULL, "%s", buf);
free (buf);
}
(void)__close(s2);
Expand All @@ -271,7 +268,7 @@ rcmd: poll (setting up stderr): %m\n")) >= 0)
&& __asprintf(&buf, _("\
poll: protocol failure in circuit setup\n")) >= 0))
{
__fxprintf (NULL, "%s", L"%s", buf);
__fxprintf (NULL, "%s", buf);
free (buf);
}
(void)__close(s2);
Expand All @@ -292,8 +289,7 @@ poll: protocol failure in circuit setup\n")) >= 0))
}
(void)__close(s2);
if (s3 < 0) {
(void)__fxprintf(NULL, "rcmd: accept: %m\n",
L"rcmd: accept: %m\n");
(void)__fxprintf(NULL, "rcmd: accept: %m\n");
lport = 0;
goto bad;
}
Expand All @@ -305,7 +301,7 @@ poll: protocol failure in circuit setup\n")) >= 0))
if (__asprintf(&buf, _("\
socket: protocol failure in circuit setup\n")) >= 0)
{
__fxprintf (NULL, "%s", L"%s", buf);
__fxprintf (NULL, "%s", buf);
free (buf);
}
goto bad2;
Expand All @@ -331,7 +327,7 @@ socket: protocol failure in circuit setup\n")) >= 0)
|| (n != 0
&& __asprintf(&buf, "rcmd: %s: %m\n", *ahost) >= 0))
{
__fxprintf (NULL, "%s", L"%s", buf);
__fxprintf (NULL, "%s", buf);
free (buf);
}
goto bad2;
Expand Down
2 changes: 1 addition & 1 deletion malloc/obstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ print_and_abort (void)
happen because the "memory exhausted" message appears in other places
like this and the translation should be reused instead of creating
a very similar string which requires a separate translation. */
(void) __fxprintf (NULL, "%s\n", L"%s\n", _("memory exhausted"));
(void) __fxprintf (NULL, "%s\n", _("memory exhausted"));
exit (obstack_exit_failure);
}

Expand Down
10 changes: 5 additions & 5 deletions misc/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ print_errno_message (int errnum)
#endif

#if _LIBC
__fxprintf (NULL, ": %s", L": %s", s);
__fxprintf (NULL, ": %s", s);
#else
fprintf (stderr, ": %s", s);
#endif
Expand Down Expand Up @@ -243,7 +243,7 @@ error_tail (int status, int errnum, const char *message, va_list args)
if (errnum)
print_errno_message (errnum);
# if _LIBC
__fxprintf (NULL, "\n", L"\n");
__fxprintf (NULL, "\n");
# else
putc ('\n', stderr);
# endif
Expand Down Expand Up @@ -291,7 +291,7 @@ error (status, errnum, message, va_alist)
else
{
#if _LIBC
__fxprintf (NULL, "%s: ", L"%s: ", program_name);
__fxprintf (NULL, "%s: ", program_name);
#else
fprintf (stderr, "%s: ", program_name);
#endif
Expand Down Expand Up @@ -374,7 +374,7 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
else
{
#if _LIBC
__fxprintf (NULL, "%s:", L"%s: ", program_name);
__fxprintf (NULL, "%s:", program_name);
#else
fprintf (stderr, "%s:", program_name);
#endif
Expand All @@ -383,7 +383,7 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
if (file_name != NULL)
{
#if _LIBC
__fxprintf (NULL, "%s:%d: ", L"%s:%d: ", file_name, line_number);
__fxprintf (NULL, "%s:%d: ", file_name, line_number);
#else
fprintf (stderr, "%s:%d: ", file_name, line_number);
#endif
Expand Down
4 changes: 2 additions & 2 deletions misc/getpass.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ getpass (prompt)
tty_changed = 0;

/* Write the prompt. */
__fxprintf (out, "%s", L"%s", prompt);
__fxprintf (out, "%s", prompt);
fflush_unlocked (out);

/* Read the password. */
Expand All @@ -106,7 +106,7 @@ getpass (prompt)
buf[nread - 1] = '\0';
if (tty_changed)
/* Write the newline that was not echoed. */
__fxprintf (out, "%c", L"%c", '\n');
__fxprintf (out, "\n");
}
}

Expand Down
Loading

0 comments on commit 8a259a2

Please sign in to comment.