summaryrefslogtreecommitdiffstats
path: root/common/console_none.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-02-04 15:49:00 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-02-04 15:49:00 +0100
commitda5fe0ba470283b384760c4976815fc20c1d45bd (patch)
tree11f2a08de885570d5d8c453f0c8b384427c666c0 /common/console_none.c
parentaacd51bfd2d20138b6f9c549fb4f1aa66e88243b (diff)
parent195310fd7b48e2c1198f216f9b4122d8f63e620e (diff)
downloadbarebox-da5fe0ba470283b384760c4976815fc20c1d45bd.tar.gz
barebox-da5fe0ba470283b384760c4976815fc20c1d45bd.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'common/console_none.c')
-rw-r--r--common/console_none.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/common/console_none.c b/common/console_none.c
new file mode 100644
index 0000000000..b6018148d2
--- /dev/null
+++ b/common/console_none.c
@@ -0,0 +1,42 @@
+#include <config.h>
+#include <common.h>
+#include <fs.h>
+#include <errno.h>
+#include <debug_ll.h>
+
+int fputc(int fd, char c)
+{
+ if (fd != 1 && fd != 2)
+ return write(fd, &c, 1);
+ return 0;
+}
+EXPORT_SYMBOL(fputc);
+
+int fputs(int fd, const char *s)
+{
+ if (fd != 1 && fd != 2)
+ return write(fd, s, strlen(s));
+ return 0;
+}
+EXPORT_SYMBOL(fputs);
+
+int fprintf(int file, const char *fmt, ...)
+{
+ va_list args;
+ uint i;
+ char printbuffer[CFG_PBSIZE];
+
+ va_start (args, fmt);
+
+ /* For this to work, printbuffer must be larger than
+ * anything we ever want to print.
+ */
+ i = vsprintf (printbuffer, fmt, args);
+ va_end (args);
+
+ /* Print the string */
+ fputs(file, printbuffer);
+
+ return i;
+}
+EXPORT_SYMBOL(fprintf);