Skip to content
Snippets Groups Projects
Commit b0d5b6d1 authored by Martine Lenders's avatar Martine Lenders
Browse files

Merge pull request #5508 from ibriano/master

cpu: native: Add [v]fprintf to syscalls
parents 8426ca99 6846b4eb
No related branches found
No related tags found
No related merge requests found
......@@ -289,21 +289,33 @@ int printf(const char *format, ...)
{
int r;
va_list argp;
char *m;
va_start(argp, format);
if ((m = make_message(format, argp)) == NULL) {
err(EXIT_FAILURE, "malloc");
}
r = _native_write(STDOUT_FILENO, m, strlen(m));
r = vfprintf(stdout, format, argp);
va_end(argp);
free(m);
return r;
}
int vprintf(const char *format, va_list argp)
{
return vfprintf(stdout, format, argp);
}
int fprintf(FILE *fp, const char *format, ...)
{
int r;
va_list argp;
va_start(argp, format);
r = vfprintf(fp, format, argp);
va_end(argp);
return r;
}
int vfprintf(FILE *fp, const char *format, va_list argp)
{
int r;
char *m;
......@@ -311,7 +323,7 @@ int vprintf(const char *format, va_list argp)
if ((m = make_message(format, argp)) == NULL) {
err(EXIT_FAILURE, "malloc");
}
r = _native_write(STDOUT_FILENO, m, strlen(m));
r = _native_write(fileno(fp), m, strlen(m));
free(m);
return r;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment