Mercurial > flash_v2
comparison packages/language/c/libc/current/include/stdio.inl @ 0:3111d98ba7b3 ecos-v1_1-release
Initial commit of eCos version 1.1
| author | jlarmour |
|---|---|
| date | Tue, 11 May 1999 11:16:07 +0000 |
| parents | |
| children | 443894e2e912 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:3111d98ba7b3 |
|---|---|
| 1 #ifndef CYGONCE_LIBC_STDIO_INL | |
| 2 #define CYGONCE_LIBC_STDIO_INL | |
| 3 //=========================================================================== | |
| 4 // | |
| 5 // stdio.inl | |
| 6 // | |
| 7 // ANSI standard I/O routines - inlined functions | |
| 8 // | |
| 9 //=========================================================================== | |
| 10 //####COPYRIGHTBEGIN#### | |
| 11 // | |
| 12 // ------------------------------------------- | |
| 13 // The contents of this file are subject to the Cygnus eCos Public License | |
| 14 // Version 1.0 (the "License"); you may not use this file except in | |
| 15 // compliance with the License. You may obtain a copy of the License at | |
| 16 // http://sourceware.cygnus.com/ecos | |
| 17 // | |
| 18 // Software distributed under the License is distributed on an "AS IS" | |
| 19 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 20 // License for the specific language governing rights and limitations under | |
| 21 // the License. | |
| 22 // | |
| 23 // The Original Code is eCos - Embedded Cygnus Operating System, released | |
| 24 // September 30, 1998. | |
| 25 // | |
| 26 // The Initial Developer of the Original Code is Cygnus. Portions created | |
| 27 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. | |
| 28 // ------------------------------------------- | |
| 29 // | |
| 30 //####COPYRIGHTEND#### | |
| 31 //=========================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 34 // Author(s): jlarmour | |
| 35 // Contributors: jlarmour@cygnus.co.uk | |
| 36 // Date: 1998-02-13 | |
| 37 // Purpose: | |
| 38 // Description: | |
| 39 // Usage: #include <stdio.h> - do not include this file directly | |
| 40 // | |
| 41 //####DESCRIPTIONEND#### | |
| 42 // | |
| 43 //=========================================================================== | |
| 44 | |
| 45 // CONFIGURATION | |
| 46 | |
| 47 #include <pkgconf/libc.h> // Configuration header | |
| 48 | |
| 49 // Include the C library? And do we want the stdio stuff? | |
| 50 #if defined(CYGPKG_LIBC) && defined(CYGPKG_LIBC_STDIO) | |
| 51 | |
| 52 // INCLUDES | |
| 53 | |
| 54 #include <cyg/infra/cyg_type.h> // Common type definitions and support | |
| 55 #include <stddef.h> // NULL and size_t from compiler | |
| 56 #include <stdarg.h> // va_list | |
| 57 #include <stdio.h> // Just be sure it has been included | |
| 58 #include <errno.h> // Definition of error codes and errno | |
| 59 #include <string.h> // Definition of strerror() for perror() | |
| 60 #include <limits.h> // INT_MAX | |
| 61 | |
| 62 // INLINE FUNCTION DEFINITIONS | |
| 63 | |
| 64 //=========================================================================== | |
| 65 | |
| 66 // 7.9.5 File access functions | |
| 67 | |
| 68 CYGPRI_LIBC_INLINE void | |
| 69 setbuf( FILE *stream, char *buf ) | |
| 70 { | |
| 71 if (buf == NULL) | |
| 72 setvbuf( stream, NULL, _IOFBF, BUFSIZE ); | |
| 73 else | |
| 74 setvbuf( stream, buf, _IONBF, BUFSIZE ); | |
| 75 | |
| 76 } // setbuf() | |
| 77 | |
| 78 //=========================================================================== | |
| 79 | |
| 80 // 7.9.6 Formatted input/output functions | |
| 81 | |
| 82 CYGPRI_LIBC_INLINE int | |
| 83 vfprintf( FILE *stream, const char *format, va_list arg ) | |
| 84 { | |
| 85 return vfnprintf(stream, INT_MAX, format, arg); | |
| 86 } // vfprintf() | |
| 87 | |
| 88 | |
| 89 CYGPRI_LIBC_INLINE int | |
| 90 vprintf( const char *format, va_list arg ) | |
| 91 { | |
| 92 return vfnprintf(stdout, INT_MAX, format, arg); | |
| 93 } // vprintf() | |
| 94 | |
| 95 | |
| 96 CYGPRI_LIBC_INLINE int | |
| 97 vsprintf( char *s, const char *format, va_list arg ) | |
| 98 { | |
| 99 return vsnprintf(s, INT_MAX, format, arg); | |
| 100 } // vsprintf() | |
| 101 | |
| 102 | |
| 103 //=========================================================================== | |
| 104 | |
| 105 // 7.9.7 Character input/output functions | |
| 106 | |
| 107 CYGPRI_LIBC_INLINE int | |
| 108 puts( const char *s ) | |
| 109 { | |
| 110 int rc; | |
| 111 | |
| 112 rc = fputs( s, stdout ); | |
| 113 | |
| 114 if (rc >= 0) | |
| 115 rc = fputc('\n', stdout ); | |
| 116 | |
| 117 return rc; | |
| 118 } // puts() | |
| 119 | |
| 120 | |
| 121 //=========================================================================== | |
| 122 | |
| 123 // 7.9.10 Error-handling functions | |
| 124 | |
| 125 CYGPRI_LIBC_INLINE void | |
| 126 perror( const char *s ) | |
| 127 { | |
| 128 if (s && *s) | |
| 129 fprintf( stderr, "%s: %s\n", s, strerror(errno) ); | |
| 130 else | |
| 131 fputs( strerror(errno), stderr ); | |
| 132 | |
| 133 } // perror() | |
| 134 | |
| 135 //=========================================================================== | |
| 136 | |
| 137 // Other non-ANSI functions | |
| 138 | |
| 139 CYGPRI_LIBC_INLINE int | |
| 140 vscanf( const char *format, va_list arg ) | |
| 141 { | |
| 142 return vfscanf( stdin, format, arg ); | |
| 143 } // vscanf() | |
| 144 | |
| 145 | |
| 146 #endif // if defined(CYGPKG_LIBC) && defined(CYGPKG_LIBC_STDIO) | |
| 147 | |
| 148 #endif // CYGONCE_LIBC_STDIO_INL multiple inclusion protection | |
| 149 | |
| 150 // EOF stdio.inl |
