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 <zephyr/toolchain.h>
13 #include <stdarg.h>     /* Needed to get definition of va_list */
14 #include <stddef.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #if !defined(__FILE_defined)
21 #define __FILE_defined
22 typedef int  FILE;
23 #endif
24 
25 #if !defined(EOF)
26 #define EOF  (-1)
27 #endif
28 
29 #define stdin  ((FILE *) 1)
30 #define stdout ((FILE *) 2)
31 #define stderr ((FILE *) 3)
32 
33 #define SEEK_SET	0	/* Seek from beginning of file.  */
34 #define SEEK_CUR	1	/* Seek from current position.  */
35 #define SEEK_END	2	/* Seek from end of file.  */
36 
37 int __printf_like(1, 2) printf(const char *ZRESTRICT format, ...);
38 int __printf_like(3, 4) snprintf(char *ZRESTRICT str, size_t len,
39 				 const char *ZRESTRICT format, ...);
40 int __printf_like(2, 3) sprintf(char *ZRESTRICT str,
41 				const char *ZRESTRICT format, ...);
42 int __printf_like(2, 3) fprintf(FILE *ZRESTRICT stream,
43 				const char *ZRESTRICT format, ...);
44 
45 
46 int __printf_like(1, 0) vprintf(const char *ZRESTRICT format, va_list list);
47 int __printf_like(3, 0) vsnprintf(char *ZRESTRICT str, size_t len,
48 				  const char *ZRESTRICT format,
49 				  va_list list);
50 int __printf_like(2, 0) vsprintf(char *ZRESTRICT str,
51 				 const char *ZRESTRICT format, va_list list);
52 int __printf_like(2, 0) vfprintf(FILE *ZRESTRICT stream,
53 				 const char *ZRESTRICT format,
54 				 va_list ap);
55 
56 void perror(const char *s);
57 int puts(const char *s);
58 
59 int fputc(int c, FILE *stream);
60 int fputs(const char *ZRESTRICT s, FILE *ZRESTRICT stream);
61 size_t fwrite(const void *ZRESTRICT ptr, size_t size, size_t nitems,
62 	      FILE *ZRESTRICT stream);
63 int remove(const char *path);
64 #define putc(c, stream) fputc(c, stream)
65 #define putchar(c) putc(c, stdout)
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDIO_H_ */
72