source: trunk/libs/newlib/src/newlib/libc/stdio/diprintf.c @ 471

Last change on this file since 471 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.6 KB
Line 
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/*
7FUNCTION
8<<diprintf>>, <<vdiprintf>>---print to a file descriptor (integer only)
9
10INDEX
11        diprintf
12INDEX
13        _diprintf_r
14INDEX
15        vdiprintf
16INDEX
17        _vdiprintf_r
18
19SYNOPSIS
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]>);
28
29DESCRIPTION
30<<diprintf>> and <<vdiprintf>> are similar to <<dprintf>> and <<vdprintf>>,
31except that only integer format specifiers are processed.
32
33The functions <<_diprintf_r>> and <<_vdiprintf_r>> are simply
34reentrant versions of the functions above.
35
36RETURNS
37Similar to <<dprintf>> and <<vdprintf>>.
38
39PORTABILITY
40This set of functions is an integer-only extension, and is not portable.
41
42Supporting OS subroutines required: <<sbrk>>, <<write>>.
43*/
44
45#include <_ansi.h>
46#include <reent.h>
47#include <stdio.h>
48#include <unistd.h>
49#include <stdarg.h>
50
51int
52_diprintf_r (struct _reent *ptr,
53       int fd,
54       const char *format, ...)
55{
56  va_list ap;
57  int n;
58
59  va_start (ap, format);
60  n = _vdiprintf_r (ptr, fd, format, ap);
61  va_end (ap);
62  return n;
63}
64
65#ifndef _REENT_ONLY
66
67int
68diprintf (int fd,
69       const char *format, ...)
70{
71  va_list ap;
72  int n;
73
74  va_start (ap, format);
75  n = _vdiprintf_r (_REENT, fd, format, ap);
76  va_end (ap);
77  return n;
78}
79
80#endif /* ! _REENT_ONLY */
Note: See TracBrowser for help on using the repository browser.