about summary refs log tree commit diff
path: root/argp/argp-fmtstream.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /argp/argp-fmtstream.c
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.xz
glibc-a334319f6530564d22e775935d9c91663623a1b4.zip
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'argp/argp-fmtstream.c')
-rw-r--r--argp/argp-fmtstream.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/argp/argp-fmtstream.c b/argp/argp-fmtstream.c
index 55ac7f9183..215160bdcd 100644
--- a/argp/argp-fmtstream.c
+++ b/argp/argp-fmtstream.c
@@ -1,5 +1,5 @@
 /* Word-wrapping and line-truncating streams
-   Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2001,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -22,7 +22,7 @@
    don't have that.  */
 
 #ifdef HAVE_CONFIG_H
-# include <config.h>
+#include <config.h>
 #endif
 
 #include <stdlib.h>
@@ -102,10 +102,11 @@ __argp_fmtstream_free (argp_fmtstream_t fs)
   if (fs->p > fs->buf)
     {
 #ifdef USE_IN_LIBIO
-      __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
-#else
-      fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
+      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);
@@ -290,15 +291,17 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
 	      else
 		/* Output the first line so we can use the space.  */
 		{
-#ifdef _LIBC
-		  __fxprintf (fs->stream, "%.*s\n",
-			      (int) (nl - fs->buf), fs->buf);
-#else
-		  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;
 		}
@@ -357,12 +360,15 @@ __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
       /* Flush FS's buffer.  */
       __argp_fmtstream_update (fs);
 
-#ifdef _LIBC
-      __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);
+#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;