1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2014, STMicroelectronics International N.V.
4  */
5 #ifndef __STDIO_H
6 #define __STDIO_H
7 
8 #include <stddef.h>
9 #include <stdarg.h>
10 
11 typedef struct _FILE FILE;
12 
13 int printf(const char *fmt, ...)
14                     __attribute__ ((__format__ (__printf__, 1, 2)));
15 /* sprintf() is unsafe and should not be used. Prefer snprintf(). */
16 int sprintf(char *str, const char *fmt, ...)
17                     __attribute__ ((__format__ (__printf__, 2, 3)))
18                     __attribute__ ((deprecated));
19 int snprintf(char *str, size_t size, const char *fmt, ...)
20                     __attribute__ ((__format__ (__printf__, 3, 4)));
21 int vsnprintf (char *str, size_t size, const char *fmt, va_list ap)
22                     __attribute__ ((__format__ (__printf__, 3, 0)));
23 int __sprintf_chk(char *str, int flag, size_t slen, const char *fmt, ...)
24                     __attribute__ ((__format__ (__printf__, 4, 5)));
25 
26 int puts(const char *str);
27 int putchar(int c);
28 
29 #ifndef __KERNEL__
30 
31 extern FILE *stdout;
32 extern FILE *stderr;
33 
34 /*
35  * The functions below send their output synchronously to the secure console.
36  * They treat stdout and stderr the same, and will abort if stream is not one or
37  * the other.
38  */
39 
40 int fputc(int c, FILE *stream);
41 int fputs(const char *s, FILE *stream);
42 size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
43 #endif
44 
45 #endif /*__STDIO_H*/
46