aboutsummaryrefslogtreecommitdiffstats
path: root/os/various/chprintf.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-11-12 13:44:26 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-11-12 13:44:26 +0000
commitb6146e1fe402c875d6c4469ab6fec58715317b8a (patch)
tree75889adeb407620bee373beb8d3ad9d596a0860f /os/various/chprintf.c
parent70eadd26d747c10e6c985b44cdd14c7df408d873 (diff)
downloadChibiOS-b6146e1fe402c875d6c4469ab6fec58715317b8a.tar.gz
ChibiOS-b6146e1fe402c875d6c4469ab6fec58715317b8a.tar.bz2
ChibiOS-b6146e1fe402c875d6c4469ab6fec58715317b8a.zip
Added chvprintf() function to the chprintf module.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6471 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/various/chprintf.c')
-rw-r--r--os/various/chprintf.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/os/various/chprintf.c b/os/various/chprintf.c
index 787b6c7ab..ffb6650f8 100644
--- a/os/various/chprintf.c
+++ b/os/various/chprintf.c
@@ -13,8 +13,10 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
+
/*
- Concepts and parts of this file have been contributed by Fabio Utzig.
+ Concepts and parts of this file have been contributed by Fabio Utzig,
+ chvprintf() added by Brent Roman.
*/
/**
@@ -25,8 +27,6 @@
* @{
*/
-#include <stdarg.h>
-
#include "ch.h"
#include "chprintf.h"
@@ -86,7 +86,7 @@ static char *ftoa(char *p, double num) {
/**
* @brief System formatted output function.
- * @details This function implements a minimal @p printf() like functionality
+ * @details This function implements a minimal @p vprintf()-like functionality
* with output on a @p BaseSequentialStream.
* The general parameters format is: %[-][width|*][.precision|*][l|L]p.
* The following parameter types (p) are supported:
@@ -104,9 +104,11 @@ static char *ftoa(char *p, double num) {
*
* @param[in] chp pointer to a @p BaseSequentialStream implementing object
* @param[in] fmt formatting string
+ * @param[in] ap list of parameters
+ *
+ * @api
*/
-void chprintf(BaseSequentialStream *chp, const char *fmt, ...) {
- va_list ap;
+void chvprintf(BaseSequentialStream *chp, const char *fmt, va_list ap) {
char *p, *s, c, filler;
int i, precision, width;
bool is_long, left_align;
@@ -118,13 +120,10 @@ void chprintf(BaseSequentialStream *chp, const char *fmt, ...) {
char tmpbuf[MAX_FILLER + 1];
#endif
- va_start(ap, fmt);
while (TRUE) {
c = *fmt++;
- if (c == 0) {
- va_end(ap);
+ if (c == 0)
return;
- }
if (c != '%') {
chSequentialStreamPut(chp, (uint8_t)c);
continue;