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