Stub out FILE*, stdout/stdin/stderr and implement fprintf on these

- Add FILE*
- Add stdout, stdin, stderr stubs
- Add fprintf that redirects to printf for stdout and stderr and fails otherwise

Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Acked-by: Stefan Reinauer <stefan.reinauer@coreboot.org> 


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6358 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Patrick Georgi
2011-02-14 19:25:27 +00:00
committed by Patrick Georgi
parent a4a022c941
commit cd913bdf5c
2 changed files with 24 additions and 1 deletions

View File

@ -723,6 +723,20 @@ int sprintf(char *str, const char *fmt, ...)
return ret;
}
int fprintf(FILE *file, const char *fmt, ...)
{
int ret;
if ((file == stdout) || (file == stderr)) {
va_list args;
va_start(args, fmt);
ret = vprintf(fmt, args);
va_end(args);
return ret;
}
return -1;
}
struct vsnprintf_data {
size_t size; /* Total space for string */
size_t len; /* Count of currently used characters */