Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / stdio / diprintf.c
blob8ac58354a81c7b6f372efe6d6719144806a04ddb
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 */
6 /*
7 FUNCTION
8 <<diprintf>>, <<vdiprintf>>---print to a file descriptor (integer only)
10 INDEX
11 diprintf
12 INDEX
13 _diprintf_r
14 INDEX
15 vdiprintf
16 INDEX
17 _vdiprintf_r
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_r(struct _reent *<[ptr]>, int <[fd]>,
25 const char *<[format]>, ...);
26 int _vdiprintf_r(struct _reent *<[ptr]>, int <[fd]>,
27 const char *<[format]>, va_list <[ap]>);
29 DESCRIPTION
30 <<diprintf>> and <<vdiprintf>> are similar to <<dprintf>> and <<vdprintf>>,
31 except that only integer format specifiers are processed.
33 The functions <<_diprintf_r>> and <<_vdiprintf_r>> are simply
34 reentrant versions of the functions above.
36 RETURNS
37 Similar to <<dprintf>> and <<vdprintf>>.
39 PORTABILITY
40 This set of functions is an integer-only extension, and is not portable.
42 Supporting OS subroutines required: <<sbrk>>, <<write>>.
45 #include <_ansi.h>
46 #include <reent.h>
47 #include <stdio.h>
48 #include <unistd.h>
49 #include <stdarg.h>
51 int
52 _diprintf_r (struct _reent *ptr,
53 int fd,
54 const char *format, ...)
56 va_list ap;
57 int n;
59 va_start (ap, format);
60 n = _vdiprintf_r (ptr, fd, format, ap);
61 va_end (ap);
62 return n;
65 #ifndef _REENT_ONLY
67 int
68 diprintf (int fd,
69 const char *format, ...)
71 va_list ap;
72 int n;
74 va_start (ap, format);
75 n = _vdiprintf_r (_REENT, fd, format, ap);
76 va_end (ap);
77 return n;
80 #endif /* ! _REENT_ONLY */