xref: /rk3399_rockchip-uboot/include/vsprintf.h (revision 046a37bd53f479915bcd5041e0834dad576371a2)
19785c905SSimon Glass /*
29785c905SSimon Glass  * (C) Copyright 2000-2009
39785c905SSimon Glass  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
49785c905SSimon Glass  *
59785c905SSimon Glass  * See file CREDITS for list of people who contributed to this
69785c905SSimon Glass  * project.
79785c905SSimon Glass  *
89785c905SSimon Glass  * This program is free software; you can redistribute it and/or
99785c905SSimon Glass  * modify it under the terms of the GNU General Public License as
109785c905SSimon Glass  * published by the Free Software Foundation; either version 2 of
119785c905SSimon Glass  * the License, or (at your option) any later version.
129785c905SSimon Glass  *
139785c905SSimon Glass  * This program is distributed in the hope that it will be useful,
149785c905SSimon Glass  * but WITHOUT ANY WARRANTY; without even the implied warranty of
159785c905SSimon Glass  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
169785c905SSimon Glass  * GNU General Public License for more details.
179785c905SSimon Glass  *
189785c905SSimon Glass  * You should have received a copy of the GNU General Public License
199785c905SSimon Glass  * along with this program; if not, write to the Free Software
209785c905SSimon Glass  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
219785c905SSimon Glass  * MA 02111-1307 USA
229785c905SSimon Glass  */
239785c905SSimon Glass 
249785c905SSimon Glass #ifndef __VSPRINTF_H
259785c905SSimon Glass #define __VSPRINTF_H
269785c905SSimon Glass 
279785c905SSimon Glass ulong simple_strtoul(const char *cp, char **endp, unsigned int base);
289785c905SSimon Glass int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
299785c905SSimon Glass unsigned long long simple_strtoull(const char *cp, char **endp,
309785c905SSimon Glass 					unsigned int base);
319785c905SSimon Glass long simple_strtol(const char *cp, char **endp, unsigned int base);
329785c905SSimon Glass void panic(const char *fmt, ...)
339785c905SSimon Glass 		__attribute__ ((format (__printf__, 1, 2), noreturn));
349785c905SSimon Glass int sprintf(char *buf, const char *fmt, ...)
359785c905SSimon Glass 		__attribute__ ((format (__printf__, 2, 3)));
369785c905SSimon Glass int vsprintf(char *buf, const char *fmt, va_list args);
379785c905SSimon Glass char *simple_itoa(ulong i);
389785c905SSimon Glass 
39*046a37bdSSonny Rao #ifdef CONFIG_SYS_VSNPRINTF
40*046a37bdSSonny Rao int snprintf(char *buf, size_t size, const char *fmt, ...)
41*046a37bdSSonny Rao 		__attribute__ ((format (__printf__, 3, 4)));
42*046a37bdSSonny Rao int scnprintf(char *buf, size_t size, const char *fmt, ...)
43*046a37bdSSonny Rao 		__attribute__ ((format (__printf__, 3, 4)));
44*046a37bdSSonny Rao int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
45*046a37bdSSonny Rao int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
46*046a37bdSSonny Rao #else
47*046a37bdSSonny Rao /*
48*046a37bdSSonny Rao  * Use macros to silently drop the size parameter. Note that the 'cn'
49*046a37bdSSonny Rao  * versions are the same as the 'n' versions since the functions assume
50*046a37bdSSonny Rao  * there is always enough buffer space when !CONFIG_SYS_VSNPRINTF
51*046a37bdSSonny Rao  */
52*046a37bdSSonny Rao #define snprintf(buf, size, fmt, args...) sprintf(buf, fmt, ##args)
53*046a37bdSSonny Rao #define scnprintf(buf, size, fmt, args...) sprintf(buf, fmt, ##args)
54*046a37bdSSonny Rao #define vsnprintf(buf, size, fmt, args...) vsprintf(buf, fmt, ##args)
55*046a37bdSSonny Rao #define vscnprintf(buf, size, fmt, args...) vsprintf(buf, fmt, ##args)
56*046a37bdSSonny Rao #endif /* CONFIG_SYS_VSNPRINTF */
57*046a37bdSSonny Rao 
589785c905SSimon Glass #endif
59