Browse Source

Merge pull request #5508 from ibriano/master

cpu: native: Add [v]fprintf to syscalls
pr/spi.typo
Martine Lenders 7 years ago
parent
commit
b0d5b6d15e
  1. 26
      cpu/native/syscalls.c

26
cpu/native/syscalls.c

@ -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;

Loading…
Cancel
Save