OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [stdio/] [dprintf.c] - Diff between revs 148 and 158

Only display areas with differences | Details | Blame | View Log

Rev 148 Rev 158
/* Copyright 2005, 2007 Shaun Jackman
/* Copyright 2005, 2007 Shaun Jackman
 * Permission to use, copy, modify, and distribute this software
 * Permission to use, copy, modify, and distribute this software
 * is freely granted, provided that this notice is preserved.
 * is freely granted, provided that this notice is preserved.
 */
 */
 
 
/*
/*
FUNCTION
FUNCTION
<<dprintf>>, <<vdprintf>>---print to a file descriptor
<<dprintf>>, <<vdprintf>>---print to a file descriptor
 
 
INDEX
INDEX
        dprintf
        dprintf
INDEX
INDEX
        _dprintf_r
        _dprintf_r
INDEX
INDEX
        vdprintf
        vdprintf
INDEX
INDEX
        _vdprintf_r
        _vdprintf_r
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <stdio.h>
        #include <stdio.h>
        #include <stdarg.h>
        #include <stdarg.h>
        int dprintf(int <[fd]>, const char *<[format]>, ...);
        int dprintf(int <[fd]>, const char *<[format]>, ...);
        int vdprintf(int <[fd]>, const char *<[format]>, va_list <[ap]>);
        int vdprintf(int <[fd]>, const char *<[format]>, va_list <[ap]>);
        int _dprintf_r(struct _reent *<[ptr]>, int <[fd]>,
        int _dprintf_r(struct _reent *<[ptr]>, int <[fd]>,
                        const char *<[format]>, ...);
                        const char *<[format]>, ...);
        int _vdprintf_r(struct _reent *<[ptr]>, int <[fd]>,
        int _vdprintf_r(struct _reent *<[ptr]>, int <[fd]>,
                        const char *<[format]>, va_list <[ap]>);
                        const char *<[format]>, va_list <[ap]>);
 
 
DESCRIPTION
DESCRIPTION
<<dprintf>> and <<vdprintf>> allow printing a format, similarly to
<<dprintf>> and <<vdprintf>> allow printing a format, similarly to
<<printf>>, but write to a file descriptor instead of to a <<FILE>>
<<printf>>, but write to a file descriptor instead of to a <<FILE>>
stream.
stream.
 
 
The functions <<_dprintf_r>> and <<_vdprintf_r>> are simply
The functions <<_dprintf_r>> and <<_vdprintf_r>> are simply
reentrant versions of the functions above.
reentrant versions of the functions above.
 
 
RETURNS
RETURNS
The return value and errors are exactly as for <<write>>, except that
The return value and errors are exactly as for <<write>>, except that
<<errno>> may also be set to <<ENOMEM>> if the heap is exhausted.
<<errno>> may also be set to <<ENOMEM>> if the heap is exhausted.
 
 
PORTABILITY
PORTABILITY
This function is originally a GNU extension in glibc and is not portable.
This function is originally a GNU extension in glibc and is not portable.
 
 
Supporting OS subroutines required: <<sbrk>>, <<write>>.
Supporting OS subroutines required: <<sbrk>>, <<write>>.
*/
*/
 
 
#include <_ansi.h>
#include <_ansi.h>
#include <reent.h>
#include <reent.h>
#include <stdio.h>
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdarg.h>
#include "local.h"
#include "local.h"
 
 
int
int
_DEFUN(_dprintf_r, (ptr, fd, format),
_DEFUN(_dprintf_r, (ptr, fd, format),
       struct _reent *ptr _AND
       struct _reent *ptr _AND
       int fd _AND
       int fd _AND
       const char *format _DOTS)
       const char *format _DOTS)
{
{
        va_list ap;
        va_list ap;
        int n;
        int n;
        _REENT_SMALL_CHECK_INIT (ptr);
        _REENT_SMALL_CHECK_INIT (ptr);
        va_start (ap, format);
        va_start (ap, format);
        n = _vdprintf_r (ptr, fd, format, ap);
        n = _vdprintf_r (ptr, fd, format, ap);
        va_end (ap);
        va_end (ap);
        return n;
        return n;
}
}
 
 
#ifndef _REENT_ONLY
#ifndef _REENT_ONLY
 
 
int
int
_DEFUN(dprintf, (fd, format),
_DEFUN(dprintf, (fd, format),
       int fd _AND
       int fd _AND
       const char *format _DOTS)
       const char *format _DOTS)
{
{
  va_list ap;
  va_list ap;
  int n;
  int n;
  struct _reent *ptr = _REENT;
  struct _reent *ptr = _REENT;
 
 
  _REENT_SMALL_CHECK_INIT (ptr);
  _REENT_SMALL_CHECK_INIT (ptr);
  va_start (ap, format);
  va_start (ap, format);
  n = _vdprintf_r (ptr, fd, format, ap);
  n = _vdprintf_r (ptr, fd, format, ap);
  va_end (ap);
  va_end (ap);
  return n;
  return n;
}
}
 
 
#endif /* ! _REENT_ONLY */
#endif /* ! _REENT_ONLY */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.