about summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/fxprintf.c18
-rw-r--r--stdio-common/perror.c2
-rw-r--r--stdio-common/psignal.c7
3 files changed, 19 insertions, 8 deletions
diff --git a/stdio-common/fxprintf.c b/stdio-common/fxprintf.c
index 82a2ac8bd7..298e5f22b0 100644
--- a/stdio-common/fxprintf.c
+++ b/stdio-common/fxprintf.c
@@ -17,22 +17,34 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
+#include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>
+#include <wchar.h>
 
 
 int
-__fxprintf (FILE *fp, const char *fmt, const wchar_t *wfmt, ...)
+__fxprintf (FILE *fp, const char *fmt, ...)
 {
   if (fp == NULL)
     fp = stderr;
 
   va_list ap;
-  va_start (ap, wfmt);
+  va_start (ap, fmt);
 
   int res;
   if (_IO_fwide (fp, 0) > 0)
-    res = __vfwprintf (fp, wfmt, ap);
+    {
+      size_t len = strlen (fmt) + 1, i;
+      wchar_t wfmt[len];
+      for (i = 0; i < len; ++i)
+	{
+	  assert (isascii (fmt[i]));
+	  wfmt[i] = fmt[i];
+	}
+      res = __vfwprintf (fp, wfmt, ap);
+    }
   else
     res = _IO_vfprintf (fp, fmt, ap);
 
diff --git a/stdio-common/perror.c b/stdio-common/perror.c
index 6d32e6d6e1..3ee61520f4 100644
--- a/stdio-common/perror.c
+++ b/stdio-common/perror.c
@@ -37,7 +37,7 @@ perror_internal (FILE *fp, const char *s, int errnum)
 
   errstring = __strerror_r (errnum, buf, sizeof buf);
 
-  (void) __fxprintf (fp, "%s%s%s\n", L"%s%s%s\n", s, colon, errstring);
+  (void) __fxprintf (fp, "%s%s%s\n", s, colon, errstring);
 }
 
 
diff --git a/stdio-common/psignal.c b/stdio-common/psignal.c
index 6c4e823b91..be95095350 100644
--- a/stdio-common/psignal.c
+++ b/stdio-common/psignal.c
@@ -47,17 +47,16 @@ psignal (int sig, const char *s)
     colon = ": ";
 
   if (sig >= 0 && sig < NSIG && (desc = INTUSE(_sys_siglist)[sig]) != NULL)
-    (void) __fxprintf (NULL, L"%s%s%s\n", "%s%s%s\n", s, colon, _(desc));
+    (void) __fxprintf (NULL, "%s%s%s\n", s, colon, _(desc));
   else
     {
       char *buf;
 
       if (__asprintf (&buf, _("%s%sUnknown signal %d\n"), s, colon, sig) < 0)
-	(void) __fxprintf (NULL, "%s%s%s\n", L"%s%s%s\n",
-			   s, colon, _("Unknown signal"));
+	(void) __fxprintf (NULL, "%s%s%s\n", s, colon, _("Unknown signal"));
       else
 	{
-	  (void) __fxprintf (NULL, L"%s", "%s", buf);
+	  (void) __fxprintf (NULL, "%s", buf);
 
 	  free (buf);
 	}