]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - argp/argp-fmtstream.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / argp / argp-fmtstream.c
index 55ac7f91839bd3d88d47c272e73cf5f098aa8946..1fff85cba059e5b4315d5f9dfcaf814c84184b8a 100644 (file)
@@ -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-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -14,9 +14,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 /* This package emulates glibc `line_wrap_stream' semantics for systems that
    don't have that.  */
@@ -31,7 +30,7 @@
 #include <stdarg.h>
 #include <ctype.h>
 
-#include "argp-fmtstream.h"
+#include <argp-fmtstream.h>
 #include "argp-namefrob.h"
 
 #ifndef ARGP_FMTSTREAM_USE_LINEWRAP
 #define isblank(ch) ((ch)==' ' || (ch)=='\t')
 #endif
 
-#if defined _LIBC && defined USE_IN_LIBIO
+#ifdef _LIBC
 # include <wchar.h>
 # include <libio/libioP.h>
-# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
 #endif
 
 #define INIT_BUF_SIZE 200
@@ -101,7 +99,7 @@ __argp_fmtstream_free (argp_fmtstream_t fs)
   __argp_fmtstream_update (fs);
   if (fs->p > fs->buf)
     {
-#ifdef USE_IN_LIBIO
+#ifdef _LIBC
       __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
 #else
       fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
@@ -150,7 +148,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
              size_t i;
              for (i = 0; i < pad; i++)
                {
-#ifdef USE_IN_LIBIO
+#ifdef _LIBC
                  if (_IO_fwide (fs->stream, 0) > 0)
                    putwc_unlocked (L' ', fs->stream);
                  else
@@ -315,7 +313,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
              *nl++ = ' ';
          else
            for (i = 0; i < fs->wmargin; ++i)
-#ifdef USE_IN_LIBIO
+#ifdef _LIBC
              if (_IO_fwide (fs->stream, 0) > 0)
                putwc_unlocked (L' ', fs->stream);
              else
@@ -414,7 +412,7 @@ __argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...)
 
       va_start (args, fmt);
       avail = fs->end - fs->p;
-      out = __vsnprintf (fs->p, avail, fmt, args);
+      out = __vsnprintf_internal (fs->p, avail, fmt, args, 0);
       va_end (args);
       if ((size_t) out >= avail)
        size_guess = out + 1;