Rev 4921 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 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. |
||
4 | */ |
||
5 | |||
6 | /* |
||
7 | FUNCTION |
||
8 | < |
||
9 | |||
10 | INDEX |
||
11 | dprintf |
||
12 | INDEX |
||
13 | _dprintf_r |
||
14 | INDEX |
||
15 | vdprintf |
||
16 | INDEX |
||
17 | _vdprintf_r |
||
18 | |||
19 | ANSI_SYNOPSIS |
||
20 | #include |
||
21 | #include |
||
4921 | Serge | 22 | int dprintf(int <[fd]>, const char *restrict <[format]>, ...); |
23 | int vdprintf(int <[fd]>, const char *restrict <[format]>, |
||
24 | va_list <[ap]>); |
||
4349 | Serge | 25 | int _dprintf_r(struct _reent *<[ptr]>, int <[fd]>, |
4921 | Serge | 26 | const char *restrict <[format]>, ...); |
4349 | Serge | 27 | int _vdprintf_r(struct _reent *<[ptr]>, int <[fd]>, |
4921 | Serge | 28 | const char *restrict <[format]>, va_list <[ap]>); |
4349 | Serge | 29 | |
30 | DESCRIPTION |
||
31 | < |
||
32 | < |
||
33 | stream. |
||
34 | |||
35 | The functions <<_dprintf_r>> and <<_vdprintf_r>> are simply |
||
36 | reentrant versions of the functions above. |
||
37 | |||
38 | RETURNS |
||
39 | The return value and errors are exactly as for < |
||
40 | < |
||
41 | |||
42 | PORTABILITY |
||
43 | This function is originally a GNU extension in glibc and is not portable. |
||
44 | |||
45 | Supporting OS subroutines required: < |
||
46 | */ |
||
47 | |||
48 | #include <_ansi.h> |
||
49 | #include |
||
50 | #include |
||
51 | #include |
||
52 | #include |
||
53 | #include "local.h" |
||
54 | |||
55 | int |
||
56 | _DEFUN(_dprintf_r, (ptr, fd, format), |
||
57 | struct _reent *ptr _AND |
||
58 | int fd _AND |
||
4921 | Serge | 59 | const char *__restrict format _DOTS) |
4349 | Serge | 60 | { |
61 | va_list ap; |
||
62 | int n; |
||
63 | _REENT_SMALL_CHECK_INIT (ptr); |
||
64 | va_start (ap, format); |
||
65 | n = _vdprintf_r (ptr, fd, format, ap); |
||
66 | va_end (ap); |
||
67 | return n; |
||
68 | } |
||
69 | |||
6099 | serge | 70 | #ifdef _NANO_FORMATTED_IO |
71 | int |
||
72 | _EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...) |
||
73 | _ATTRIBUTE ((__alias__("_dprintf_r")))); |
||
74 | #endif |
||
75 | |||
4349 | Serge | 76 | #ifndef _REENT_ONLY |
77 | |||
78 | int |
||
79 | _DEFUN(dprintf, (fd, format), |
||
80 | int fd _AND |
||
4921 | Serge | 81 | const char *__restrict format _DOTS) |
4349 | Serge | 82 | { |
83 | va_list ap; |
||
84 | int n; |
||
85 | struct _reent *ptr = _REENT; |
||
86 | |||
87 | _REENT_SMALL_CHECK_INIT (ptr); |
||
88 | va_start (ap, format); |
||
89 | n = _vdprintf_r (ptr, fd, format, ap); |
||
90 | va_end (ap); |
||
91 | return n; |
||
92 | } |
||
93 | |||
6099 | serge | 94 | #ifdef _NANO_FORMATTED_IO |
95 | int |
||
96 | _EXFUN(diprintf, (int, const char *, ...) |
||
97 | _ATTRIBUTE ((__alias__("dprintf")))); |
||
98 | #endif |
||
4349 | Serge | 99 | #endif /* ! _REENT_ONLY */ |