summaryrefslogtreecommitdiffstats
path: root/include/stdio.h
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2009-03-04 03:38:51 +0000
committerdas <das@FreeBSD.org>2009-03-04 03:38:51 +0000
commitd92111a8dc86baa72bb5660ebba5ad3f2665dca9 (patch)
treea1df347e1257183601e8006328d2dc04e287ede2 /include/stdio.h
parentee4adcf1a9a52bc4415201969e0fbc0451c46b47 (diff)
downloadFreeBSD-src-d92111a8dc86baa72bb5660ebba5ad3f2665dca9.zip
FreeBSD-src-d92111a8dc86baa72bb5660ebba5ad3f2665dca9.tar.gz
Add dprintf() and vdprintf() from POSIX.1-2008. Like getline(),
dprintf() is a simple wrapper around another function, so we may as well implement it. But also like getline(), we can't prototype it by default right now because it would break too many ports.
Diffstat (limited to 'include/stdio.h')
-rw-r--r--include/stdio.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/include/stdio.h b/include/stdio.h
index 1de521e..78c62e8 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -345,12 +345,14 @@ char *tempnam(const char *, const char *);
ssize_t getdelim(char ** __restrict, size_t * __restrict, int,
FILE * __restrict);
int renameat(int, const char *, int, const char *);
+int vdprintf(int, const char * __restrict, __va_list);
/*
- * Every programmer and his dog wrote functions called getline()
- * before POSIX.1-2008 came along and decided to usurp the name, so we
- * don't prototype getline() by default unless one of the following is true:
- * a) the app has requested it specifically by defining _WITH_GETLINE
+ * Every programmer and his dog wrote functions called getline() and dprintf()
+ * before POSIX.1-2008 came along and decided to usurp the names, so we
+ * don't prototype them by default unless one of the following is true:
+ * a) the app has requested them specifically by defining _WITH_GETLINE or
+ * _WITH_DPRINTF, respectively
* b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE
* c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE
*/
@@ -368,6 +370,20 @@ int renameat(int, const char *, int, const char *);
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
#endif
+#ifndef _WITH_DPRINTF
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define _WITH_DPRINTF
+#elif defined(_POSIX_C_SOURCE)
+#if _POSIX_C_SOURCE > 200809
+#define _WITH_DPRINTF
+#endif
+#endif
+#endif
+
+#ifdef _WITH_DPRINTF
+int dprintf(int, const char * __restrict, ...);
+#endif
+
#endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 */
/*
OpenPOWER on IntegriCloud