rm_/lib/xprintf.h

57 lines
1.9 KiB
C
Raw Permalink Normal View History

2020-09-02 16:47:03 +08:00
/* printf wrappers that fail immediately for non-file-related errors
2022-07-28 14:16:50 +08:00
Copyright (C) 2007-2022 Free Software Foundation, Inc.
2020-09-02 16:47:03 +08:00
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
2022-07-28 14:16:50 +08:00
the Free Software Foundation, either version 3 of the License, or
2020-09-02 16:47:03 +08:00
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _XPRINTF_H
#define _XPRINTF_H
#include <stdarg.h>
#include <stdio.h>
2022-07-28 14:16:50 +08:00
extern int xprintf (char const *restrict format, ...)
#if GNULIB_VPRINTF_POSIX
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2))
2020-09-02 16:47:03 +08:00
#else
2022-07-28 14:16:50 +08:00
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 1, 2))
2020-09-02 16:47:03 +08:00
#endif
2022-07-28 14:16:50 +08:00
;
2020-09-02 16:47:03 +08:00
extern int xvprintf (char const *restrict format, va_list args)
2022-07-28 14:16:50 +08:00
#if GNULIB_VPRINTF_POSIX
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0))
#else
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 1, 0))
#endif
;
2020-09-02 16:47:03 +08:00
extern int xfprintf (FILE *restrict stream, char const *restrict format, ...)
2022-07-28 14:16:50 +08:00
#if GNULIB_VFPRINTF_POSIX
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 2, 3))
#else
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 2, 3))
#endif
;
2020-09-02 16:47:03 +08:00
extern int xvfprintf (FILE *restrict stream, char const *restrict format,
va_list args)
2022-07-28 14:16:50 +08:00
#if GNULIB_VFPRINTF_POSIX
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 2, 0))
#else
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 2, 0))
#endif
;
2020-09-02 16:47:03 +08:00
#endif