2008-03-05 07:05:13 +00:00
|
|
|
/* Print output of stream to given obstack.
|
2021-01-02 11:32:25 -08:00
|
|
|
Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
2008-03-05 07:05:13 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
|
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
2019-09-06 22:40:42 -07:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2008-03-05 07:05:13 +00:00
|
|
|
|
2018-03-07 14:32:03 -05:00
|
|
|
#include <libio/libioP.h>
|
2008-03-05 07:05:13 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2018-03-07 14:32:03 -05:00
|
|
|
__obstack_printf_chk (struct obstack *obstack, int flag, const char *format,
|
2008-03-05 07:05:13 +00:00
|
|
|
...)
|
|
|
|
|
{
|
2018-03-07 14:32:03 -05:00
|
|
|
/* For flag > 0 (i.e. __USE_FORTIFY_LEVEL > 1) request that %n
|
|
|
|
|
can only come from read-only format strings. */
|
|
|
|
|
unsigned int mode = (flag > 0) ? PRINTF_FORTIFY : 0;
|
2008-03-05 07:05:13 +00:00
|
|
|
va_list ap;
|
2018-03-07 14:32:03 -05:00
|
|
|
int ret;
|
|
|
|
|
|
2008-03-05 07:05:13 +00:00
|
|
|
va_start (ap, format);
|
2018-03-07 14:32:03 -05:00
|
|
|
ret = __obstack_vprintf_internal (obstack, format, ap, mode);
|
2008-03-05 07:05:13 +00:00
|
|
|
va_end (ap);
|
2018-03-07 14:32:03 -05:00
|
|
|
|
|
|
|
|
return ret;
|
2008-03-05 07:05:13 +00:00
|
|
|
}
|