1 /* Copyright (C) 2005, 2007 Shaun Jackman
2 * Permission to use, copy, modify, and distribute this software
3 * is freely granted, provided that this notice is preserved.
4 */
5
6 /*
7 FUNCTION
8 <<diprintf>>, <<vdiprintf>>---print to a file descriptor (integer only)
9
10 INDEX
11 diprintf
12 INDEX
13 _diprintf_r
14 INDEX
15 vdiprintf
16 INDEX
17 _vdiprintf_r
18
19 SYNOPSIS
20 #include <stdio.h>
21 #include <stdarg.h>
22 int diprintf(int <[fd]>, const char *<[format]>, ...);
23 int vdiprintf(int <[fd]>, const char *<[format]>, va_list <[ap]>);
24 int diprintf( int <[fd]>,
25 const char *<[format]>, ...);
26 int vdiprintf( int <[fd]>,
27 const char *<[format]>, va_list <[ap]>);
28
29 DESCRIPTION
30 <<diprintf>> and <<vdiprintf>> are similar to <<dprintf>> and <<vdprintf>>,
31 except that only integer format specifiers are processed.
32
33 The functions <<_diprintf_r>> and <<_vdiprintf_r>> are simply
34 reentrant versions of the functions above.
35
36 RETURNS
37 Similar to <<dprintf>> and <<vdprintf>>.
38
39 PORTABILITY
40 This set of functions is an integer-only extension, and is not portable.
41
42 Supporting OS subroutines required: <<sbrk>>, <<write>>.
43 */
44
45 #define _DEFAULT_SOURCE
46 #include <_ansi.h>
47 #include <stdio.h>
48 #include <unistd.h>
49 #include <stdarg.h>
50
51 int
diprintf(int fd,const char * format,...)52 diprintf (int fd,
53 const char *format, ...)
54 {
55 va_list ap;
56 int n;
57
58 va_start (ap, format);
59 n = vdiprintf ( fd, format, ap);
60 va_end (ap);
61 return n;
62 }
63