[rtems commit] Fix rtems_print_printer_fprintf()
Sebastian Huber
sebh at rtems.org
Tue May 31 08:11:56 UTC 2016
Module: rtems
Branch: master
Commit: 3242614d92130639ea55c2457a17ae313662f0c4
Changeset: http://git.rtems.org/rtems/commit/?id=3242614d92130639ea55c2457a17ae313662f0c4
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue May 31 09:44:49 2016 +0200
Fix rtems_print_printer_fprintf()
We must use vfprintf().
---
cpukit/include/rtems/bspIo.h | 17 +++++++++++++++--
cpukit/libcsupport/src/print_fprintf.c | 7 ++++++-
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/cpukit/include/rtems/bspIo.h b/cpukit/include/rtems/bspIo.h
index 403b857..a7fd959 100644
--- a/cpukit/include/rtems/bspIo.h
+++ b/cpukit/include/rtems/bspIo.h
@@ -144,7 +144,7 @@ typedef int (*rtems_print_plugin_t)(void *, const char *format, va_list ap);
/**
* @brief Reporting Methods printk() Plugin
*
- * @param[in] context points to a user defined context.
+ * @param[in] context Unused.
* @param[in] fmt is a printf()-style format string
*
* @return The number of characters printed.
@@ -157,13 +157,26 @@ extern int printk_plugin(void *context, const char *fmt, va_list ap);
* This is a standard plug-in to support using printf() for output
* instead of printk().
*
- * @param[in] context points to a user defined context.
+ * @param[in] context Unused.
* @param[in] fmt is a printf()-style format string
*
* @return The number of characters printed.
*/
extern int rtems_printf_plugin(void *context, const char *fmt, va_list ap);
+/**
+ * @brief Reporting Methods fprintf() Plugin
+ *
+ * This is a standard plug-in to support using fprintf() for output
+ * instead of printk().
+ *
+ * @param[in] context The file stream.
+ * @param[in] fmt is a printf()-style format string
+ *
+ * @return The number of characters printed.
+ */
+extern int rtems_fprintf_plugin(void *context, const char *fmt, va_list ap);
+
/**@}*/
#ifdef __cplusplus
diff --git a/cpukit/libcsupport/src/print_fprintf.c b/cpukit/libcsupport/src/print_fprintf.c
index 5e46d1c..757293e 100644
--- a/cpukit/libcsupport/src/print_fprintf.c
+++ b/cpukit/libcsupport/src/print_fprintf.c
@@ -22,8 +22,13 @@
#include <stdio.h>
+int rtems_fprintf_plugin(void *context, const char *fmt, va_list ap)
+{
+ return vfprintf(context, fmt, ap);
+}
+
void rtems_print_printer_fprintf(rtems_printer *printer, FILE *file)
{
printer->context = file;
- printer->printer = (rtems_print_plugin_t) fprintf;
+ printer->printer = rtems_fprintf_plugin;
}
More information about the vc
mailing list