2 * This file is part of the coreboot project.
4 * Copyright (C) 2009 coresystems GmbH
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <console/vtxprintf.h>
21 struct vsnprintf_context
{
26 static void str_tx_byte(unsigned char byte
, void *data
)
28 struct vsnprintf_context
*ctx
= data
;
36 int vsnprintf(char *buf
, size_t size
, const char *fmt
, va_list args
)
39 struct vsnprintf_context ctx
;
44 ctx
.buf_limit
= size
? size
- 1 : 0;
45 i
= vtxprintf(str_tx_byte
, fmt
, args
, &ctx
);
54 int snprintf(char *buf
, size_t size
, const char *fmt
, ...)
60 i
= vsnprintf(buf
, size
, fmt
, args
);