xref: /optee_os/lib/libutils/isoc/include/stdio.h (revision 9fc2442cc66c279cb962c90c4375746fc9b28bb9)
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 
24 int puts(const char *str);
25 int putchar(int c);
26 
27 #ifndef __KERNEL__
28 
29 extern FILE *stdout;
30 extern FILE *stderr;
31 
32 /*
33  * The functions below send their output synchronously to the secure console.
34  * They treat stdout and stderr the same, and will abort if stream is not one or
35  * the other.
36  */
37 
38 int fputc(int c, FILE *stream);
39 int fputs(const char *s, FILE *stream);
40 size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
41 #endif
42 
43 #endif /*STDIO_H*/
44