diff options
author | Roland McGrath <roland@gnu.org> | 1996-04-03 16:31:49 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-04-03 16:31:49 +0000 |
commit | 299a95b9f048679f1288512b0a6ab6ca16dd9d7c (patch) | |
tree | 4788a62ee8f131887e5817e8daa3339084dbe764 /stdio-common/printf-prs.c | |
parent | 30de3b18a526acc837957865129b7fa6d8ac91d1 (diff) | |
download | glibc-299a95b9f048679f1288512b0a6ab6ca16dd9d7c.zip glibc-299a95b9f048679f1288512b0a6ab6ca16dd9d7c.tar.gz glibc-299a95b9f048679f1288512b0a6ab6ca16dd9d7c.tar.bz2 |
Tue Apr 2 21:27:01 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* 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.
Diffstat (limited to 'stdio-common/printf-prs.c')
-rw-r--r-- | stdio-common/printf-prs.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/stdio-common/printf-prs.c b/stdio-common/printf-prs.c index 811a9cb..d0756de 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 <printf.h> #include <stdlib.h> #include <string.h> +#include <wchar.h> + +#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) |