From 299a95b9f048679f1288512b0a6ab6ca16dd9d7c Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 3 Apr 1996 16:31:49 +0000 Subject: Tue Apr 2 21:27:01 1996 Andreas Schwab * posix/glob.c (glob_pattern_p): Avoid scanning past eos if the pattern ends with a backslash and quoting is enabled. * posix/fnmatch.c (fnmatch): Likewise; return FNM_NOMATCH for such patterns. --- stdio-common/printf-prs.c | 52 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) (limited to 'stdio-common/printf-prs.c') diff --git a/stdio-common/printf-prs.c b/stdio-common/printf-prs.c index 811a9cb7eb..d0756de7d4 100644 --- a/stdio-common/printf-prs.c +++ b/stdio-common/printf-prs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1995, 1996 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 @@ -20,6 +20,50 @@ Cambridge, MA 02139, USA. */ #include #include #include +#include + +#ifndef COMPILE_WPRINTF +# define CHAR_T char +# define UCHAR_T unsigned char +# define INT_T int +# define L_(Str) Str +# define ISDIGIT(Ch) isdigit (Ch) + +# ifdef USE_IN_LIBIO +# define PUT(F, S, N) _IO_sputn (F, S, N) +# define PAD(Padchar) \ + if (width > 0) \ + done += _IO_padn (s, Padchar, width) +# else +# define PUTC(C, F) putc (C, F) +ssize_t __printf_pad __P ((FILE *, char pad, size_t n)); +# define PAD(Padchar) \ + if (width > 0) \ + { if (__printf_pad (s, Padchar, width) == -1) \ + return -1; else done += width; } +# endif +#else +# define vfprintf vfwprintf +# define CHAR_T wchar_t +# define UCHAR_T uwchar_t +# define INT_T wint_t +# define L_(Str) L##Str +# define ISDIGIT(Ch) iswdigit (Ch) + +# ifdef USE_IN_LIBIO +# define PUT(F, S, N) _IO_sputn (F, S, N) +# define PAD(Padchar) \ + if (width > 0) \ + done += _IO_wpadn (s, Padchar, width) +# else +# define PUTC(C, F) wputc (C, F) +ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n)); +# define PAD(Padchar) \ + if (width > 0) \ + { if (__wprintf_pad (s, Padchar, width) == -1) \ + return -1; else done += width; } +# endif +#endif #include "printf-parse.h" @@ -33,15 +77,17 @@ parse_printf_format (fmt, n, argtypes) size_t nargs; /* Number of arguments. */ size_t max_ref_arg; /* Highest index used in a positional arg. */ struct printf_spec spec; + mbstate_t mbstate; nargs = 0; max_ref_arg = 0; + mbstate = 0; /* Search for format specifications. */ - for (fmt = find_spec (fmt); *fmt != '\0'; fmt = spec.next_fmt) + for (fmt = find_spec (fmt, &mbstate); *fmt != '\0'; fmt = spec.next_fmt) { /* Parse this spec. */ - nargs += parse_one_spec (fmt, nargs, &spec, &max_ref_arg); + nargs += parse_one_spec (fmt, nargs, &spec, &max_ref_arg, &mbstate); /* If the width is determined by an argument this is an int. */ if (spec.width_arg != -1 && spec.width_arg < n) -- cgit v1.2.3