]> Git Repo - J-u-boot.git/blob - include/stdio.h
net: wget: let wget_with_dns work with dns disabled
[J-u-boot.git] / include / stdio.h
1 #ifndef __STDIO_H
2 #define __STDIO_H
3
4 #include <stdarg.h>
5 #include <linux/compiler.h>
6
7 /* stdin */
8 int getchar(void);
9 int tstc(void);
10
11 /* stdout */
12 #if !defined(CONFIG_XPL_BUILD) || CONFIG_IS_ENABLED(SERIAL)
13 void putc(const char c);
14 void puts(const char *s);
15 #ifdef CONFIG_CONSOLE_FLUSH_SUPPORT
16 void flush(void);
17 #else
18 static inline void flush(void) {}
19 #endif
20 int __printf(1, 2) printf(const char *fmt, ...);
21 int vprintf(const char *fmt, va_list args);
22 #else
23 static inline void putc(const char c)
24 {
25 }
26
27 static inline void puts(const char *s)
28 {
29 }
30
31 static inline void flush(void)
32 {
33 }
34
35 static inline int __printf(1, 2) printf(const char *fmt, ...)
36 {
37         return 0;
38 }
39
40 static inline int vprintf(const char *fmt, va_list args)
41 {
42         return 0;
43 }
44 #endif
45
46 /**
47  * Format a string and place it in a buffer
48  *
49  * @buf: The buffer to place the result into
50  * @size: The size of the buffer, including the trailing null space
51  * @fmt: The format string to use
52  * @...: Arguments for the format string
53  * Return: the number of characters which would be
54  * generated for the given input, excluding the trailing null,
55  * as per ISO C99.  If the return is greater than or equal to
56  * @size, the resulting string is truncated.
57  *
58  * See the vsprintf() documentation for format string extensions over C99.
59  */
60 int snprintf(char *buf, size_t size, const char *fmt, ...)
61              __attribute__ ((format (__printf__, 3, 4)));
62
63 /*
64  * FILE based functions (can only be used AFTER relocation!)
65  */
66 #define stdin           0
67 #define stdout          1
68 #define stderr          2
69 #define MAX_FILES       3
70
71 /* stderr */
72 #define eputc(c)                fputc(stderr, c)
73 #define eputs(s)                fputs(stderr, s)
74 #define eflush()                fflush(stderr)
75 #define eprintf(fmt, args...)   fprintf(stderr, fmt, ##args)
76
77 int __printf(2, 3) fprintf(int file, const char *fmt, ...);
78 void fputs(int file, const char *s);
79 void fputc(int file, const char c);
80 #ifdef CONFIG_CONSOLE_FLUSH_SUPPORT
81 void fflush(int file);
82 #else
83 static inline void fflush(int file) {}
84 #endif
85 int ftstc(int file);
86 int fgetc(int file);
87
88 #endif /* __STDIO_H */
This page took 0.028894 seconds and 4 git commands to generate.