Skip to content

Instantly share code, notes, and snippets.

@mcandre
Created January 10, 2019 02:23
Show Gist options
  • Save mcandre/f51d7a3bffdf60e3789bbd4c81d74554 to your computer and use it in GitHub Desktop.
Save mcandre/f51d7a3bffdf60e3789bbd4c81d74554 to your computer and use it in GitHub Desktop.
crude dprintf() shim for Illumos and Haiku OS
int dprintf(int fd, const char *restrict format, ...) {
va_list ap;
FILE *f = fdopen(fd, "w");
if (!f) {
return -1;
}
va_start(ap, format);
int result = fprintf(f, format, ap);
va_end(ap);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment