1 /* Copyright 2005, 2007 Shaun Jackman
2 * Permission to use, copy, modify, and distribute this software
3 * is freely granted, provided that this notice is preserved.
8 <<dprintf>>, <<vdprintf>>---print to a file descriptor
22 int dprintf(int <[fd]>, const char *restrict <[format]>, ...);
23 int vdprintf(int <[fd]>, const char *restrict <[format]>,
25 int _dprintf_r(struct _reent *<[ptr]>, int <[fd]>,
26 const char *restrict <[format]>, ...);
27 int _vdprintf_r(struct _reent *<[ptr]>, int <[fd]>,
28 const char *restrict <[format]>, va_list <[ap]>);
31 <<dprintf>> and <<vdprintf>> allow printing a format, similarly to
32 <<printf>>, but write to a file descriptor instead of to a <<FILE>>
35 The functions <<_dprintf_r>> and <<_vdprintf_r>> are simply
36 reentrant versions of the functions above.
39 The return value and errors are exactly as for <<write>>, except that
40 <<errno>> may also be set to <<ENOMEM>> if the heap is exhausted.
43 This function is originally a GNU extension in glibc and is not portable.
45 Supporting OS subroutines required: <<sbrk>>, <<write>>.
56 _dprintf_r (struct _reent
*ptr
,
58 const char *__restrict format
, ...)
62 _REENT_SMALL_CHECK_INIT (ptr
);
63 va_start (ap
, format
);
64 n
= _vdprintf_r (ptr
, fd
, format
, ap
);
69 #ifdef _NANO_FORMATTED_IO
71 _diprintf_r (struct _reent
*, int, const char *, ...)
72 _ATTRIBUTE ((__alias__("_dprintf_r")));
79 const char *__restrict format
, ...)
83 struct _reent
*ptr
= _REENT
;
85 _REENT_SMALL_CHECK_INIT (ptr
);
86 va_start (ap
, format
);
87 n
= _vdprintf_r (ptr
, fd
, format
, ap
);
92 #ifdef _NANO_FORMATTED_IO
94 diprintf (int, const char *, ...)
95 _ATTRIBUTE ((__alias__("dprintf")));
97 #endif /* ! _REENT_ONLY */