Created
January 10, 2019 02:23
-
-
Save mcandre/f51d7a3bffdf60e3789bbd4c81d74554 to your computer and use it in GitHub Desktop.
crude dprintf() shim for Illumos and Haiku OS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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