2021-05-09 23:00:11 +02:00
|
|
|
#ifndef __STDIO_H__
|
|
|
|
# define __STDIO_H__
|
2020-09-17 19:27:01 +02:00
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdarg.h>
|
2021-05-16 18:02:46 +02:00
|
|
|
#include <bits/types/FILE.h>
|
|
|
|
|
2021-06-07 18:57:11 +02:00
|
|
|
/* Standard input, output and error streams. */
|
2021-05-16 18:02:46 +02:00
|
|
|
extern FILE *stdin;
|
|
|
|
extern FILE *stdout;
|
|
|
|
extern FILE *stderr;
|
|
|
|
/* Make them macros (7.19.1§3) */
|
|
|
|
#define stdin stdin
|
|
|
|
#define stdout stdout
|
|
|
|
#define stderr stderr
|
2020-09-17 19:27:01 +02:00
|
|
|
|
2021-06-07 18:57:11 +02:00
|
|
|
/*
|
|
|
|
** Formatted input/output functions.
|
|
|
|
**
|
|
|
|
** These functions implement most of printf(3)'s features, including:
|
|
|
|
** - Signed and unsigned integer formats (%d, %i, %o, %u, %x, %X)
|
|
|
|
** - Character, string and pointer formats (%c, %s, %p)
|
|
|
|
** - Character count and strerror() shorthand formats (%n, %m)
|
|
|
|
** - Format options (0, #, -, (space), length, precision)
|
|
|
|
** - Parameter length (hh, h, l, ll, z)
|
|
|
|
** - Limiting the size of the output and still returning the whole length
|
|
|
|
** - If __printf_enable_fp() from <fxlibc/printf.h> is called: floating-point
|
|
|
|
** formats (%e, %E, %f, %F, %g, %G) (disabled by default to save space)
|
|
|
|
**
|
|
|
|
** They do not support:
|
|
|
|
** - Hexadecimal floating-point (%a, %A)
|
|
|
|
** - Some size modifiers: long double (L), intmax_t (j), ptrdiff_t (t), and the
|
|
|
|
** nonstandard synonyms q (ll) and Z (z)
|
|
|
|
** - Dynamic length field (*)
|
|
|
|
** - Thousands separators (') and locale-aware digits (I)
|
|
|
|
** - Nonstandard synonyms %C (%lc) and %S (%ls)
|
|
|
|
**
|
|
|
|
** There are extensions, namely to allow for custom conversions to be added.
|
|
|
|
** One custom conversion can be enabled with __printf_enable_fixed() from
|
|
|
|
** <fxlibc/printf.h>: a decimal fixed-point format %k which is like %d but
|
|
|
|
** with a decimal point. See <fxlibc/printf.h> for details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Formatted print to file. */
|
|
|
|
extern int fprintf(FILE * restrict __fp, char const * restrict __format, ...);
|
|
|
|
|
|
|
|
/* Formatted print to stdout. */
|
|
|
|
extern int printf(char const * restrict __format, ...);
|
|
|
|
|
|
|
|
/* Formatted print to string (with limited size). */
|
|
|
|
extern int snprintf(char * restrict __str, size_t __size,
|
|
|
|
char const * restrict __format, ...);
|
|
|
|
|
|
|
|
/* Formatted print to string (with unlimited size!). */
|
|
|
|
extern int sprintf(char * restrict __str, char const * restrict __format, ...);
|
|
|
|
|
|
|
|
/* Formatted print to file (variable argument list). */
|
|
|
|
extern int vfprintf(FILE * restrict __fp, char const * restrict __format,
|
|
|
|
va_list __args);
|
|
|
|
|
|
|
|
/* Formatted print to stdout (variable argument list). */
|
|
|
|
extern int vprintf(char const * restrict __format, va_list __args);
|
|
|
|
|
|
|
|
/* Formatted print to string (limited size, variable argument list). */
|
|
|
|
extern int vsnprintf(char * restrict __str, size_t __size,
|
|
|
|
char const * restrict __format, va_list __args);
|
|
|
|
|
|
|
|
/* Formatted print to string (unlimited size!, variable argument list). */
|
|
|
|
extern int vsprintf(char * restrict __str, char const * restrict __format,
|
|
|
|
va_list __args);
|
2020-09-17 19:27:01 +02:00
|
|
|
|
|
|
|
/* putx() - display char / string */
|
|
|
|
extern int putchar(int c);
|
|
|
|
extern int puts(const char *s);
|
|
|
|
|
2021-06-07 18:57:11 +02:00
|
|
|
/* Extensions. */
|
|
|
|
|
|
|
|
/* Formatted print to file descriptor. */
|
|
|
|
extern int dprintf(int __fd, char const * restrict __format, ...);
|
|
|
|
|
|
|
|
/* Formatted print to file descriptor (variable argument list). */
|
|
|
|
extern int vdprintf(int __fd, char const * restrict __format, va_list __args);
|
|
|
|
|
2021-06-07 19:09:55 +02:00
|
|
|
/* Allocating sprintf(). */
|
|
|
|
extern int asprintf(char ** restrict __str,char const * restrict __format,...);
|
|
|
|
|
|
|
|
/* Allocating vsprintf(). */
|
|
|
|
extern int vasprintf(char ** restrict __str, char const * restrict __format,
|
|
|
|
va_list __args);
|
|
|
|
|
2021-05-09 23:00:11 +02:00
|
|
|
#endif /*__STDIO_H__*/
|