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/] [include/] [stdio.inl] - Blame information for rev 174

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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