summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRouven Czerwinski <r.czerwinski@pengutronix.de>2019-08-06 07:11:01 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-08-07 09:42:15 +0200
commit896acd4688b62a4d3f75f9e7e3c4f1ef6a6c4b63 (patch)
tree868f76dab4a84c1f75eb3de644c552f8018ababa
parenta3a1b708ee192d02603f615d08bfa934ed9464ea (diff)
downloadbarebox-896acd4688b62a4d3f75f9e7e3c4f1ef6a6c4b63.tar.gz
barebox-896acd4688b62a4d3f75f9e7e3c4f1ef6a6c4b63.tar.xz
stdio: puts and putchar static inline wrappers
Add static inline wrappers for puts and putchar. This allows the usage of puts and putchar within the PBL even if the PBL_CONSOLE is disabled. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/stdio.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/stdio.h b/include/stdio.h
index 7b2a42b817..46e277889d 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -71,23 +71,32 @@ static inline int ctrlc (void)
#if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
(defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
+
+static inline int puts(const char *s)
+{
+ return console_puts(CONSOLE_STDOUT, s);
+}
+
+static inline void putchar(char c)
+{
+ console_putc(CONSOLE_STDOUT, c);
+}
#else
static int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
static inline int printf(const char *fmt, ...)
{
return 0;
}
-#endif
-
static inline int puts(const char *s)
{
- return console_puts(CONSOLE_STDOUT, s);
+ return 0;
}
static inline void putchar(char c)
{
- console_putc(CONSOLE_STDOUT, c);
+ return;
}
+#endif
/*
* FILE based functions