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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [language/] [c/] [libc/] [stdio/] [v2_0/] [src/] [common/] [stdioinlines.cxx] - Blame information for rev 466

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//===========================================================================
2
//
3
//      stdioinlines.cxx
4
//
5
//      ANSI standard I/O routines - real alternatives for inlined functions
6
//
7
//===========================================================================
8
//####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
// for more details.
21
//
22
// You should have received a copy of the GNU General Public License along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//===========================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):    jlarmour
44
// Contributors: 
45
// Date:         2000-04-20
46
// Purpose:     
47
// Description: 
48
// Usage:
49
//
50
//####DESCRIPTIONEND####
51
//
52
//===========================================================================
53
 
54
// CONFIGURATION
55
 
56
#include <pkgconf/libc_stdio.h>   // Configuration header
57
 
58
// INCLUDES
59
 
60
// We don't want the inline versions of stdio functions defined here
61
 
62
#ifdef CYGIMP_LIBC_STDIO_INLINES
63
#undef CYGIMP_LIBC_STDIO_INLINES
64
#endif
65
 
66
#include <cyg/infra/cyg_type.h>    // Common type definitions and support
67
#include <stddef.h>                // NULL and size_t from compiler
68
#include <stdarg.h>                // va_list
69
#include <stdio.h>                 // Header for this file
70
#include <errno.h>                 // Definition of error codes and errno
71
#include <string.h>                // Definition of strerror() for perror()
72
#include <limits.h>                // INT_MAX
73
 
74
 
75
// FUNCTIONS
76
 
77
//===========================================================================
78
 
79
// 7.9.5 File access functions
80
 
81
externC void
82
setbuf( FILE *stream, char *buf )
83
{
84
    if (buf == NULL)
85
        setvbuf( stream, NULL, _IONBF, 0 );
86
    else
87
        // NB: Should use full buffering by default ordinarily, but in
88
        // the current system we're always connected to an interactive
89
        // terminal, so use line buffering
90
        setvbuf( stream, buf, _IOLBF, BUFSIZ );
91
 
92
} // setbuf()
93
 
94
//===========================================================================
95
 
96
// 7.9.6 Formatted input/output functions
97
 
98
 
99
externC int
100
vfprintf( FILE *stream, const char *format, va_list arg )
101
{
102
    return vfnprintf(stream, INT_MAX, format, arg);
103
} // vfprintf()
104
 
105
 
106
externC int
107
vprintf( const char *format, va_list arg)
108
{
109
    return vfnprintf( stdout, INT_MAX, format, arg );
110
} // vprintf()
111
 
112
 
113
externC int
114
vsprintf( char *s, const char *format, va_list arg )
115
{
116
    return vsnprintf(s, INT_MAX, format, arg);
117
} // vsprintf()
118
 
119
 
120
//===========================================================================
121
 
122
// 7.9.7 Character input/output functions
123
 
124
externC int
125
puts( const char *s )
126
{
127
    int rc;
128
 
129
    rc = fputs( s, stdout );
130
 
131
    if (rc >= 0)
132
        rc = fputc('\n', stdout );
133
 
134
    return rc;
135
} // puts()
136
 
137
 
138
//===========================================================================
139
 
140
// 7.9.10 Error-handling functions
141
 
142
externC void
143
perror( const char *s )
144
{
145
    if (s && *s)
146
        fprintf( stderr, "%s: %s\n", s, strerror(errno) );
147
    else
148
        fputs( strerror(errno), stderr );
149
 
150
} // perror()
151
 
152
//===========================================================================
153
 
154
// Other non-ANSI functions
155
 
156
#ifdef CYGFUN_LIBC_STDIO_ungetc
157
externC int
158
vscanf( const char *format, va_list arg )
159
{
160
    return vfscanf( stdin, format, arg );
161
} // vscanf()
162
#endif
163
 
164
// EOF stdioinlines.cxx

powered by: WebSVN 2.1.0

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