4 * Copyright (C) 2002,2004 Develer S.r.l. (http://www.develer.com/)
5 * This file is part of DevLib - See devlib/README for information.
10 * \author Bernardo Innocenti <bernie@develer.com>
12 * \brief Simple sprintf() implementation based on _formatted_write()
17 * Revision 1.3 2004/06/27 15:20:26 aleph
18 * Change UNUSED() macro to accept two arguments: type and name;
19 * Add macro GNUC_PREREQ to detect GCC version during build;
20 * Some spacing cleanups and typo fix
22 * Revision 1.2 2004/06/03 11:27:09 bernie
23 * Add dual-license information.
25 * Revision 1.1 2004/05/23 15:43:16 bernie
26 * Import mware modules.
28 * Revision 1.4 2004/04/03 20:42:27 aleph
29 * Remove duplicated defines
31 * Revision 1.3 2004/03/24 15:48:53 bernie
32 * Remove Copyright messages from Doxygen output
34 * Revision 1.2 2004/03/19 16:51:30 bernie
37 * Revision 1.1 2004/02/23 09:45:09 aleph
38 * Add missing library functions.
40 * Revision 1.1 2003/11/13 16:56:37 aleph
41 * Add first implementation of dsp firmware
50 static void __str_put_char(char c, void *ptr)
53 * This Does not work on Code Warrior. Hmm...
54 * *(*((char **)ptr))++ = c;
61 static void __null_put_char(UNUSED(char, c), UNUSED(void *, ptr))
67 int PGM_FUNC(vsprintf)(char * str, const char * PGM_ATTR fmt, va_list ap)
71 result = PGM_FUNC(_formatted_write)(
72 fmt, (str ? __str_put_char : __null_put_char), &str, ap);
74 /* terminate string */
80 /* FIXME: sprintf_P is incorrectly declared in <stdio.h> */
81 int PGM_FUNC(sprintf)(char *str, const char * fmt, ...)
87 result = PGM_FUNC(vsprintf)(str, fmt, ap);
90 /* terminate string */