Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | 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
<>, <>---print to a file descriptor
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 
22
	int dprintf(int <[fd]>, const char *<[format]>, ...);
23
	int vdprintf(int <[fd]>, const char *<[format]>, va_list <[ap]>);
24
	int _dprintf_r(struct _reent *<[ptr]>, int <[fd]>,
25
			const char *<[format]>, ...);
26
	int _vdprintf_r(struct _reent *<[ptr]>, int <[fd]>,
27
			const char *<[format]>, va_list <[ap]>);
28
 
29
DESCRIPTION
30
<> and <> allow printing a format, similarly to
31
<>, but write to a file descriptor instead of to a <>
32
stream.
33
 
34
The functions <<_dprintf_r>> and <<_vdprintf_r>> are simply
35
reentrant versions of the functions above.
36
 
37
RETURNS
38
The return value and errors are exactly as for <>, except that
39
<> may also be set to <> if the heap is exhausted.
40
 
41
PORTABILITY
42
This function is originally a GNU extension in glibc and is not portable.
43
 
44
Supporting OS subroutines required: <>, <>.
45
*/
46
 
47
#include <_ansi.h>
48
#include 
49
#include 
50
#include 
51
#include 
52
#include "local.h"
53
 
54
int
55
_DEFUN(_dprintf_r, (ptr, fd, format),
56
       struct _reent *ptr _AND
57
       int fd _AND
58
       const char *format _DOTS)
59
{
60
	va_list ap;
61
	int n;
62
	_REENT_SMALL_CHECK_INIT (ptr);
63
	va_start (ap, format);
64
	n = _vdprintf_r (ptr, fd, format, ap);
65
	va_end (ap);
66
	return n;
67
}
68
 
69
#ifndef _REENT_ONLY
70
 
71
int
72
_DEFUN(dprintf, (fd, format),
73
       int fd _AND
74
       const char *format _DOTS)
75
{
76
  va_list ap;
77
  int n;
78
  struct _reent *ptr = _REENT;
79
 
80
  _REENT_SMALL_CHECK_INIT (ptr);
81
  va_start (ap, format);
82
  n = _vdprintf_r (ptr, fd, format, ap);
83
  va_end (ap);
84
  return n;
85
}
86
 
87
#endif /* ! _REENT_ONLY */