1 /* stdio.h */
2
3 /*
4 * Copyright (c) 2014 Wind River Systems, Inc.
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9 #ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDIO_H_
10 #define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDIO_H_
11
12 #include <toolchain.h>
13 #include <stdarg.h> /* Needed to get definition of va_list */
14 #include <bits/restrict.h>
15 #include <stddef.h>
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 #if !defined(__FILE_defined)
22 #define __FILE_defined
23 typedef int FILE;
24 #endif
25
26 #if !defined(EOF)
27 #define EOF (-1)
28 #endif
29
30 #define stdin ((FILE *) 1)
31 #define stdout ((FILE *) 2)
32 #define stderr ((FILE *) 3)
33
34 int __printf_like(1, 2) printf(const char *_MLIBC_RESTRICT format, ...);
35 int __printf_like(3, 4) snprintf(char *_MLIBC_RESTRICT str, size_t len,
36 const char *_MLIBC_RESTRICT format, ...);
37 int __printf_like(2, 3) sprintf(char *_MLIBC_RESTRICT str,
38 const char *_MLIBC_RESTRICT format, ...);
39 int __printf_like(2, 3) fprintf(FILE * _MLIBC_RESTRICT stream,
40 const char *_MLIBC_RESTRICT format, ...);
41
42
43 int __printf_like(1, 0) vprintf(const char *_MLIBC_RESTRICT format, va_list list);
44 int __printf_like(3, 0) vsnprintf(char *_MLIBC_RESTRICT str, size_t len,
45 const char *_MLIBC_RESTRICT format,
46 va_list list);
47 int __printf_like(2, 0) vsprintf(char *_MLIBC_RESTRICT str,
48 const char *_MLIBC_RESTRICT format, va_list list);
49 int __printf_like(2, 0) vfprintf(FILE * _MLIBC_RESTRICT stream,
50 const char *_MLIBC_RESTRICT format,
51 va_list ap);
52
53 int puts(const char *s);
54
55 int fputc(int c, FILE *stream);
56 int fputs(const char *_MLIBC_RESTRICT s, FILE *_MLIBC_RESTRICT stream);
57 size_t fwrite(const void *_MLIBC_RESTRICT ptr, size_t size, size_t nitems,
58 FILE *_MLIBC_RESTRICT stream);
putc(int c,FILE * stream)59 static inline int putc(int c, FILE *stream)
60 {
61 return fputc(c, stream);
62 }
putchar(int c)63 static inline int putchar(int c)
64 {
65 return putc(c, stdout);
66 }
67
68 #ifdef __cplusplus
69 }
70 #endif
71
72 #endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDIO_H_ */
73