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

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [posix/] [libposix/] [include/] [posix/] [stdio.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
   Copyright (C) 1991,1994-2002,2003,2004 Free Software Foundation, Inc.
3
   This file is part of the GNU C Library.
4
 
5
   The GNU C Library is free software; you can redistribute it and/or
6
   modify it under the terms of the GNU Lesser General Public
7
   License as published by the Free Software Foundation; either
8
   version 2.1 of the License, or (at your option) any later version.
9
 
10
   The GNU C Library is distributed in the hope that it will be useful,
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
   Lesser General Public License for more details.
14
 
15
   You should have received a copy of the GNU Lesser General Public
16
   License along with the GNU C Library; if not, write to the Free
17
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18
   02111-1307 USA.  */
19
 
20
/*
21
 *      ISO C99 Standard: 7.19 Input/output     <stdio.h>
22
 */
23
 
24
#ifndef _STDIO_H
25
 
26
#if !defined __need_FILE && !defined __need___FILE
27
# define _STDIO_H       1
28
# include <features.h>
29
 
30
__BEGIN_DECLS
31
 
32
# define __need_size_t
33
# define __need_NULL
34
# include <stddef.h>
35
 
36
# include <bits/types.h>
37
# define __need_FILE
38
# define __need___FILE
39
#endif /* Don't need FILE.  */
40
 
41
 
42
#if !defined __FILE_defined && defined __need_FILE
43
 
44
__BEGIN_NAMESPACE_STD
45
/* The opaque type of streams.  This is the definition used elsewhere.  */
46
typedef struct __STDIO_FILE_STRUCT FILE;
47
__END_NAMESPACE_STD
48
#if defined __USE_LARGEFILE64 || defined __USE_SVID || defined __USE_POSIX \
49
    || defined __USE_BSD || defined __USE_ISOC99 || defined __USE_XOPEN \
50
    || defined __USE_POSIX2
51
__USING_NAMESPACE_STD(FILE)
52
#endif
53
 
54
# define __FILE_defined 1
55
#endif /* FILE not defined.  */
56
#undef  __need_FILE
57
 
58
 
59
#if !defined ____FILE_defined && defined __need___FILE
60
 
61
/* The opaque type of streams.  This is the definition used elsewhere.  */
62
typedef struct __STDIO_FILE_STRUCT __FILE;
63
 
64
# define ____FILE_defined       1
65
#endif /* __FILE not defined.  */
66
#undef  __need___FILE
67
 
68
 
69
#ifdef  _STDIO_H
70
#undef _STDIO_USES_IOSTREAM
71
 
72
#include <bits/uClibc_stdio.h>
73
 
74
/* This define avoids name pollution if we're using GNU stdarg.h */
75
# define __need___va_list
76
#include <stdarg.h>
77
 
78
/* The type of the second argument to `fgetpos' and `fsetpos'.  */
79
__BEGIN_NAMESPACE_STD
80
#ifndef __USE_FILE_OFFSET64
81
typedef __STDIO_fpos_t fpos_t;
82
#else
83
typedef __STDIO_fpos64_t fpos_t;
84
#endif
85
__END_NAMESPACE_STD
86
#ifdef __USE_LARGEFILE64
87
typedef __STDIO_fpos64_t fpos64_t;
88
#endif
89
 
90
/* The possibilities for the third argument to `setvbuf'.  */
91
#define _IOFBF __STDIO_IOFBF            /* Fully buffered.  */
92
#define _IOLBF __STDIO_IOLBF            /* Line buffered.  */
93
#define _IONBF __STDIO_IONBF            /* No buffering.  */
94
 
95
 
96
/* Default buffer size.  */
97
#ifndef BUFSIZ
98
# define BUFSIZ __STDIO_BUFSIZ
99
#endif
100
 
101
 
102
/* End of file character.
103
   Some things throughout the library rely on this being -1.  */
104
#ifndef EOF
105
# define EOF (-1)
106
#endif
107
 
108
 
109
/* The possibilities for the third argument to `fseek'.
110
   These values should not be changed.  */
111
#define SEEK_SET        0        /* Seek from beginning of file.  */
112
#define SEEK_CUR        1       /* Seek from current position.  */
113
#define SEEK_END        2       /* Seek from end of file.  */
114
 
115
 
116
#if defined __USE_SVID || defined __USE_XOPEN
117
/* Default path prefix for `tempnam' and `tmpnam'.  */
118
# define P_tmpdir       "/tmp"
119
#endif
120
 
121
 
122
/* Get the values:
123
   L_tmpnam     How long an array of chars must be to be passed to `tmpnam'.
124
   TMP_MAX      The minimum number of unique filenames generated by tmpnam
125
                (and tempnam when it uses tmpnam's name space),
126
                or tempnam (the two are separate).
127
   L_ctermid    How long an array to pass to `ctermid'.
128
   L_cuserid    How long an array to pass to `cuserid'.
129
   FOPEN_MAX    Minimum number of files that can be open at once.
130
   FILENAME_MAX Maximum length of a filename.  */
131
#include <bits/stdio_lim.h>
132
 
133
 
134
/* Standard streams.  */
135
extern FILE *stdin;             /* Standard input stream.  */
136
extern FILE *stdout;        /* Standard output stream.  */
137
extern FILE *stderr;        /* Standard error output stream.  */
138
/* C89/C99 say they're macros.  Make them happy.  */
139
#define stdin stdin
140
#define stdout stdout
141
#define stderr stderr
142
 
143
__BEGIN_NAMESPACE_STD
144
/* Remove file FILENAME.  */
145
extern int remove (__const char *__filename) __THROW;
146
/* Rename file OLD to NEW.  */
147
extern int rename (__const char *__old, __const char *__new) __THROW;
148
__END_NAMESPACE_STD
149
 
150
 
151
__BEGIN_NAMESPACE_STD
152
/* Create a temporary file and open it read/write.
153
 
154
   This function is a possible cancellation points and therefore not
155
   marked with __THROW.  */
156
#ifndef __USE_FILE_OFFSET64
157
extern FILE *tmpfile (void);
158
#else
159
# ifdef __REDIRECT
160
extern FILE *__REDIRECT (tmpfile, (void), tmpfile64);
161
# else
162
#  define tmpfile tmpfile64
163
# endif
164
#endif
165
 
166
#ifdef __USE_LARGEFILE64
167
extern FILE *tmpfile64 (void);
168
#endif
169
 
170
/* Generate a temporary filename.  */
171
extern char *tmpnam (char *__s) __THROW;
172
__END_NAMESPACE_STD
173
 
174
#ifdef __USE_MISC
175
/* This is the reentrant variant of `tmpnam'.  The only difference is
176
   that it does not allow S to be NULL.  */
177
extern char *tmpnam_r (char *__s) __THROW;
178
#endif
179
 
180
 
181
#if defined __USE_SVID || defined __USE_XOPEN
182
/* Generate a unique temporary filename using up to five characters of PFX
183
   if it is not NULL.  The directory to put this file in is searched for
184
   as follows: First the environment variable "TMPDIR" is checked.
185
   If it contains the name of a writable directory, that directory is used.
186
   If not and if DIR is not NULL, that value is checked.  If that fails,
187
   P_tmpdir is tried and finally "/tmp".  The storage for the filename
188
   is allocated by `malloc'.  */
189
extern char *tempnam (__const char *__dir, __const char *__pfx)
190
     __THROW __attribute_malloc__;
191
#endif
192
 
193
 
194
__BEGIN_NAMESPACE_STD
195
/* Close STREAM.
196
 
197
   This function is a possible cancellation point and therefore not
198
   marked with __THROW.  */
199
extern int fclose (FILE *__stream);
200
/* Flush STREAM, or all streams if STREAM is NULL.
201
 
202
   This function is a possible cancellation point and therefore not
203
   marked with __THROW.  */
204
extern int fflush (FILE *__stream);
205
__END_NAMESPACE_STD
206
 
207
#ifdef __USE_MISC
208
/* Faster versions when locking is not required.
209
 
210
   This function is not part of POSIX and therefore no official
211
   cancellation point.  But due to similarity with an POSIX interface
212
   or due to the implementation it is a cancellation point and
213
   therefore not marked with __THROW.  */
214
extern int fflush_unlocked (FILE *__stream);
215
#endif
216
 
217
#ifdef __USE_GNU
218
/* Close all streams.
219
 
220
   This function is not part of POSIX and therefore no official
221
   cancellation point.  But due to similarity with an POSIX interface
222
   or due to the implementation it is a cancellation point and
223
   therefore not marked with __THROW.  */
224
extern int fcloseall (void);
225
#endif
226
 
227
 
228
__BEGIN_NAMESPACE_STD
229
#ifndef __USE_FILE_OFFSET64
230
/* Open a file and create a new stream for it.
231
 
232
   This function is a possible cancellation point and therefore not
233
   marked with __THROW.  */
234
extern FILE *fopen (__const char *__restrict __filename,
235
                    __const char *__restrict __modes);
236
/* Open a file, replacing an existing stream with it.
237
 
238
   This function is a possible cancellation point and therefore not
239
   marked with __THROW.  */
240
extern FILE *freopen (__const char *__restrict __filename,
241
                      __const char *__restrict __modes,
242
                      FILE *__restrict __stream);
243
#else
244
# ifdef __REDIRECT
245
extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
246
                                 __const char *__restrict __modes), fopen64);
247
extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
248
                                   __const char *__restrict __modes,
249
                                   FILE *__restrict __stream), freopen64);
250
# else
251
#  define fopen fopen64
252
#  define freopen freopen64
253
# endif
254
#endif
255
__END_NAMESPACE_STD
256
#ifdef __USE_LARGEFILE64
257
extern FILE *fopen64 (__const char *__restrict __filename,
258
                      __const char *__restrict __modes);
259
extern FILE *freopen64 (__const char *__restrict __filename,
260
                        __const char *__restrict __modes,
261
                        FILE *__restrict __stream);
262
#endif
263
 
264
#ifdef  __USE_POSIX
265
/* Create a new stream that refers to an existing system file descriptor.  */
266
extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
267
#endif
268
 
269
#ifdef  __USE_GNU
270
#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
271
/* Create a new stream that refers to the given magic cookie,
272
   and uses the given functions for input and output.  */
273
extern FILE *fopencookie (void *__restrict __magic_cookie,
274
                          __const char *__restrict __modes,
275
                          _IO_cookie_io_functions_t __io_funcs) __THROW;
276
 
277
/* Create a new stream that refers to a memory buffer.  */
278
extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;
279
 
280
/* Open a stream that writes into a malloc'd buffer that is expanded as
281
   necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
282
   and the number of characters written on fflush or fclose.  */
283
extern FILE *open_memstream (char **__restrict __bufloc,
284
                             size_t *__restrict __sizeloc) __THROW;
285
#endif
286
#endif
287
 
288
 
289
__BEGIN_NAMESPACE_STD
290
/* If BUF is NULL, make STREAM unbuffered.
291
   Else make it use buffer BUF, of size BUFSIZ.  */
292
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
293
/* Make STREAM use buffering mode MODE.
294
   If BUF is not NULL, use N bytes of it for buffering;
295
   else allocate an internal buffer N bytes long.  */
296
extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
297
                    int __modes, size_t __n) __THROW;
298
__END_NAMESPACE_STD
299
 
300
#ifdef  __USE_BSD
301
/* If BUF is NULL, make STREAM unbuffered.
302
   Else make it use SIZE bytes of BUF for buffering.  */
303
extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
304
                       size_t __size) __THROW;
305
 
306
/* Make STREAM line-buffered.  */
307
extern void setlinebuf (FILE *__stream) __THROW;
308
#endif
309
 
310
 
311
__BEGIN_NAMESPACE_STD
312
/* Write formatted output to STREAM.
313
 
314
   This function is a possible cancellation point and therefore not
315
   marked with __THROW.  */
316
extern int fprintf (FILE *__restrict __stream,
317
                    __const char *__restrict __format, ...);
318
/* Write formatted output to stdout.
319
 
320
   This function is a possible cancellation point and therefore not
321
   marked with __THROW.  */
322
extern int printf (__const char *__restrict __format, ...);
323
/* Write formatted output to S.  */
324
extern int sprintf (char *__restrict __s,
325
                    __const char *__restrict __format, ...) __THROW;
326
 
327
/* Write formatted output to S from argument list ARG.
328
 
329
   This function is a possible cancellation point and therefore not
330
   marked with __THROW.  */
331
//extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
332
//                   __gnuc_va_list __arg);
333
/* Write formatted output to stdout from argument list ARG.
334
 
335
   This function is a possible cancellation point and therefore not
336
   marked with __THROW.  */
337
//extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
338
/* Write formatted output to S from argument list ARG.  */
339
//extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
340
//                   __gnuc_va_list __arg) __THROW;
341
__END_NAMESPACE_STD
342
 
343
#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
344
__BEGIN_NAMESPACE_C99
345
/* Maximum chars of output to write in MAXLEN.  */
346
extern int snprintf (char *__restrict __s, size_t __maxlen,
347
                     __const char *__restrict __format, ...)
348
     __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
349
 
350
//extern int vsnprintf (char *__restrict __s, size_t __maxlen,
351
//                    __const char *__restrict __format, __gnuc_va_list __arg)
352
//     __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
353
__END_NAMESPACE_C99
354
#endif
355
 
356
#ifdef __USE_GNU
357
/* Write formatted output to a string dynamically allocated with `malloc'.
358
   Store the address of the string in *PTR.  */
359
//extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
360
//                    __gnuc_va_list __arg)
361
//     __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
362
#if 0 /* uClibc: disabled */
363
extern int __asprintf (char **__restrict __ptr,
364
                       __const char *__restrict __fmt, ...)
365
     __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
366
#endif
367
extern int asprintf (char **__restrict __ptr,
368
                     __const char *__restrict __fmt, ...)
369
     __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
370
 
371
/* Write formatted output to a file descriptor.
372
 
373
   These functions are not part of POSIX and therefore no official
374
   cancellation point.  But due to similarity with an POSIX interface
375
   or due to the implementation they are cancellation points and
376
   therefore not marked with __THROW.  */
377
//extern int vdprintf (int __fd, __const char *__restrict __fmt,
378
//                   __gnuc_va_list __arg)
379
     __attribute__ ((__format__ (__printf__, 2, 0)));
380
extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
381
     __attribute__ ((__format__ (__printf__, 2, 3)));
382
#endif
383
 
384
 
385
__BEGIN_NAMESPACE_STD
386
/* Read formatted input from STREAM.
387
 
388
   This function is a possible cancellation point and therefore not
389
   marked with __THROW.  */
390
extern int fscanf (FILE *__restrict __stream,
391
                   __const char *__restrict __format, ...);
392
/* Read formatted input from stdin.
393
 
394
   This function is a possible cancellation point and therefore not
395
   marked with __THROW.  */
396
extern int scanf (__const char *__restrict __format, ...);
397
/* Read formatted input from S.  */
398
extern int sscanf (__const char *__restrict __s,
399
                   __const char *__restrict __format, ...) __THROW;
400
__END_NAMESPACE_STD
401
 
402
#ifdef  __USE_ISOC99
403
__BEGIN_NAMESPACE_C99
404
/* Read formatted input from S into argument list ARG.
405
 
406
   This function is a possible cancellation point and therefore not
407
   marked with __THROW.  */
408
//extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
409
//                  __gnuc_va_list __arg)
410
//     __attribute__ ((__format__ (__scanf__, 2, 0)));
411
 
412
/* Read formatted input from stdin into argument list ARG.
413
 
414
   This function is a possible cancellation point and therefore not
415
   marked with __THROW.  */
416
//extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
417
//     __attribute__ ((__format__ (__scanf__, 1, 0)));
418
 
419
/* Read formatted input from S into argument list ARG.  */
420
//extern int vsscanf (__const char *__restrict __s,
421
//                  __const char *__restrict __format, __gnuc_va_list __arg)
422
//     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
423
__END_NAMESPACE_C99
424
#endif /* Use ISO C9x.  */
425
 
426
 
427
__BEGIN_NAMESPACE_STD
428
/* Read a character from STREAM.
429
 
430
   These functions are possible cancellation points and therefore not
431
   marked with __THROW.  */
432
extern int fgetc (FILE *__stream);
433
extern int getc (FILE *__stream);
434
 
435
/* Read a character from stdin.
436
 
437
   This function is a possible cancellation point and therefore not
438
   marked with __THROW.  */
439
extern int getchar (void);
440
__END_NAMESPACE_STD
441
 
442
/* The C standard explicitly says this is a macro, so we always do the
443
   optimization for it.  */
444
#define getc(_fp) __GETC(_fp)
445
 
446
#if defined __USE_POSIX || defined __USE_MISC
447
/* These are defined in POSIX.1:1996.
448
 
449
   These functions are possible cancellation points and therefore not
450
   marked with __THROW.  */
451
extern int getc_unlocked (FILE *__stream);
452
extern int getchar_unlocked (void);
453
 
454
/* SUSv3 allows getc_unlocked to be a macro */
455
#define getc_unlocked(_fp) __GETC_UNLOCKED(_fp)
456
#endif /* Use POSIX or MISC.  */
457
 
458
#ifdef __USE_MISC
459
/* Faster version when locking is not necessary.
460
 
461
   This function is not part of POSIX and therefore no official
462
   cancellation point.  But due to similarity with an POSIX interface
463
   or due to the implementation it is a cancellation point and
464
   therefore not marked with __THROW.  */
465
extern int fgetc_unlocked (FILE *__stream);
466
#endif /* Use MISC.  */
467
 
468
 
469
__BEGIN_NAMESPACE_STD
470
/* Write a character to STREAM.
471
 
472
   These functions are possible cancellation points and therefore not
473
   marked with __THROW.
474
 
475
   These functions is a possible cancellation point and therefore not
476
   marked with __THROW.  */
477
extern int fputc (int __c, FILE *__stream);
478
extern int putc (int __c, FILE *__stream);
479
 
480
/* Write a character to stdout.
481
 
482
   This function is a possible cancellation point and therefore not
483
   marked with __THROW.  */
484
extern int putchar (int __c);
485
__END_NAMESPACE_STD
486
 
487
/* The C standard explicitly says this can be a macro,
488
   so we always do the optimization for it.  */
489
#define putc(_ch, _fp) __PUTC(_ch, _fp)
490
 
491
#ifdef __USE_MISC
492
/* Faster version when locking is not necessary.
493
 
494
   This function is not part of POSIX and therefore no official
495
   cancellation point.  But due to similarity with an POSIX interface
496
   or due to the implementation it is a cancellation point and
497
   therefore not marked with __THROW.  */
498
extern int fputc_unlocked (int __c, FILE *__stream);
499
#endif /* Use MISC.  */
500
 
501
#if defined __USE_POSIX || defined __USE_MISC
502
/* These are defined in POSIX.1:1996.
503
 
504
   These functions are possible cancellation points and therefore not
505
   marked with __THROW.  */
506
extern int putc_unlocked (int __c, FILE *__stream);
507
extern int putchar_unlocked (int __c);
508
 
509
/* SUSv3 allows putc_unlocked to be a macro */
510
#define putc_unlocked(_ch, _fp) __PUTC_UNLOCKED(_ch, _fp)
511
#endif /* Use POSIX or MISC.  */
512
 
513
 
514
#if defined __USE_SVID || defined __USE_MISC \
515
    || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
516
/* Get a word (int) from STREAM.  */
517
extern int getw (FILE *__stream);
518
 
519
/* Write a word (int) to STREAM.  */
520
extern int putw (int __w, FILE *__stream);
521
#endif
522
 
523
 
524
__BEGIN_NAMESPACE_STD
525
/* Get a newline-terminated string of finite length from STREAM.
526
 
527
   This function is a possible cancellation point and therefore not
528
   marked with __THROW.  */
529
extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream);
530
 
531
/* Get a newline-terminated string from stdin, removing the newline.
532
   DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.
533
 
534
   This function is a possible cancellation point and therefore not
535
   marked with __THROW.  */
536
extern char *gets (char *__s);
537
__END_NAMESPACE_STD
538
 
539
#ifdef __USE_GNU
540
/* This function does the same as `fgets' but does not lock the stream.
541
 
542
   This function is not part of POSIX and therefore no official
543
   cancellation point.  But due to similarity with an POSIX interface
544
   or due to the implementation it is a cancellation point and
545
   therefore not marked with __THROW.  */
546
extern char *fgets_unlocked (char *__restrict __s, int __n,
547
                             FILE *__restrict __stream);
548
#endif
549
 
550
 
551
#ifdef  __USE_GNU
552
/* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
553
   (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
554
   NULL), pointing to *N characters of space.  It is realloc'd as
555
   necessary.  Returns the number of characters read (not including the
556
   null terminator), or -1 on error or EOF.
557
 
558
   These functions are not part of POSIX and therefore no official
559
   cancellation point.  But due to similarity with an POSIX interface
560
   or due to the implementation they are cancellation points and
561
   therefore not marked with __THROW.  */
562
#if 0 /* uClibc: disabled */
563
extern __ssize_t __getdelim (char **__restrict __lineptr,
564
                               size_t *__restrict __n, int __delimiter,
565
                               FILE *__restrict __stream);
566
#endif
567
extern __ssize_t getdelim (char **__restrict __lineptr,
568
                             size_t *__restrict __n, int __delimiter,
569
                             FILE *__restrict __stream);
570
 
571
/* Like `getdelim', but reads up to a newline.
572
 
573
   This function is not part of POSIX and therefore no official
574
   cancellation point.  But due to similarity with an POSIX interface
575
   or due to the implementation it is a cancellation point and
576
   therefore not marked with __THROW.  */
577
extern __ssize_t getline (char **__restrict __lineptr,
578
                            size_t *__restrict __n,
579
                            FILE *__restrict __stream);
580
#endif
581
 
582
 
583
__BEGIN_NAMESPACE_STD
584
/* Write a string to STREAM.
585
 
586
   This function is a possible cancellation points and therefore not
587
   marked with __THROW.  */
588
extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
589
 
590
/* Write a string, followed by a newline, to stdout.
591
 
592
   This function is a possible cancellation points and therefore not
593
   marked with __THROW.  */
594
extern int puts (__const char *__s);
595
 
596
 
597
/* Push a character back onto the input buffer of STREAM.
598
 
599
   This function is a possible cancellation points and therefore not
600
   marked with __THROW.  */
601
extern int ungetc (int __c, FILE *__stream);
602
 
603
 
604
/* Read chunks of generic data from STREAM.
605
 
606
   This function is a possible cancellation points and therefore not
607
   marked with __THROW.  */
608
extern size_t fread (void *__restrict __ptr, size_t __size,
609
                     size_t __n, FILE *__restrict __stream);
610
/* Write chunks of generic data to STREAM.
611
 
612
   This function is a possible cancellation points and therefore not
613
   marked with __THROW.  */
614
extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
615
                      size_t __n, FILE *__restrict __s);
616
__END_NAMESPACE_STD
617
 
618
#ifdef __USE_GNU
619
/* This function does the same as `fputs' but does not lock the stream.
620
 
621
   This function is not part of POSIX and therefore no official
622
   cancellation point.  But due to similarity with an POSIX interface
623
   or due to the implementation it is a cancellation point and
624
   therefore not marked with __THROW.  */
625
extern int fputs_unlocked (__const char *__restrict __s,
626
                           FILE *__restrict __stream);
627
#endif
628
 
629
#ifdef __USE_MISC
630
/* Faster versions when locking is not necessary.
631
 
632
   These functions are not part of POSIX and therefore no official
633
   cancellation point.  But due to similarity with an POSIX interface
634
   or due to the implementation they are cancellation points and
635
   therefore not marked with __THROW.  */
636
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
637
                              size_t __n, FILE *__restrict __stream);
638
extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
639
                               size_t __n, FILE *__restrict __stream);
640
#endif
641
 
642
 
643
__BEGIN_NAMESPACE_STD
644
/* Seek to a certain position on STREAM.
645
 
646
   This function is a possible cancellation point and therefore not
647
   marked with __THROW.  */
648
extern int fseek (FILE *__stream, long int __off, int __whence);
649
/* Return the current position of STREAM.
650
 
651
   This function is a possible cancellation point and therefore not
652
   marked with __THROW.  */
653
extern long int ftell (FILE *__stream);
654
/* Rewind to the beginning of STREAM.
655
 
656
   This function is a possible cancellation point and therefore not
657
   marked with __THROW.  */
658
extern void rewind (FILE *__stream);
659
__END_NAMESPACE_STD
660
 
661
/* The Single Unix Specification, Version 2, specifies an alternative,
662
   more adequate interface for the two functions above which deal with
663
   file offset.  `long int' is not the right type.  These definitions
664
   are originally defined in the Large File Support API.  */
665
 
666
#if defined __USE_LARGEFILE || defined __USE_XOPEN2K
667
# ifndef __USE_FILE_OFFSET64
668
/* Seek to a certain position on STREAM.
669
 
670
   This function is a possible cancellation point and therefore not
671
   marked with __THROW.  */
672
extern int fseeko (FILE *__stream, __off_t __off, int __whence);
673
/* Return the current position of STREAM.
674
 
675
   This function is a possible cancellation point and therefore not
676
   marked with __THROW.  */
677
extern __off_t ftello (FILE *__stream);
678
# else
679
#  ifdef __REDIRECT
680
extern int __REDIRECT (fseeko,
681
                       (FILE *__stream, __off64_t __off, int __whence),
682
                       fseeko64);
683
extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
684
#  else
685
#   define fseeko fseeko64
686
#   define ftello ftello64
687
#  endif
688
# endif
689
#endif
690
 
691
__BEGIN_NAMESPACE_STD
692
#ifndef __USE_FILE_OFFSET64
693
/* Get STREAM's position.
694
 
695
   This function is a possible cancellation point and therefore not
696
   marked with __THROW.  */
697
extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
698
/* Set STREAM's position.
699
 
700
   This function is a possible cancellation point and therefore not
701
   marked with __THROW.  */
702
extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
703
#else
704
# ifdef __REDIRECT
705
extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
706
                                 fpos_t *__restrict __pos), fgetpos64);
707
extern int __REDIRECT (fsetpos,
708
                       (FILE *__stream, __const fpos_t *__pos), fsetpos64);
709
# else
710
#  define fgetpos fgetpos64
711
#  define fsetpos fsetpos64
712
# endif
713
#endif
714
__END_NAMESPACE_STD
715
 
716
#ifdef __USE_LARGEFILE64
717
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
718
extern __off64_t ftello64 (FILE *__stream);
719
extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
720
extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
721
#endif
722
 
723
__BEGIN_NAMESPACE_STD
724
/* Clear the error and EOF indicators for STREAM.  */
725
extern void clearerr (FILE *__stream) __THROW;
726
/* Return the EOF indicator for STREAM.  */
727
extern int feof (FILE *__stream) __THROW;
728
/* Return the error indicator for STREAM.  */
729
extern int ferror (FILE *__stream) __THROW;
730
__END_NAMESPACE_STD
731
 
732
#ifdef __USE_MISC
733
/* Faster versions when locking is not required.  */
734
extern void clearerr_unlocked (FILE *__stream) __THROW;
735
extern int feof_unlocked (FILE *__stream) __THROW;
736
extern int ferror_unlocked (FILE *__stream) __THROW;
737
#endif
738
 
739
 
740
__BEGIN_NAMESPACE_STD
741
/* Print a message describing the meaning of the value of errno.
742
 
743
   This function is a possible cancellation point and therefore not
744
   marked with __THROW.  */
745
extern void perror (__const char *__s);
746
__END_NAMESPACE_STD
747
 
748
#ifdef __UCLIBC_HAS_SYS_ERRLIST__
749
/* These variables normally should not be used directly.  The `strerror'
750
   function provides all the needed functionality.  */
751
#ifdef  __USE_BSD
752
extern int sys_nerr;
753
extern __const char *__const sys_errlist[];
754
#endif
755
#endif /* __UCLIBC_HAS_SYS_ERRLIST__ */
756
 
757
 
758
#ifdef  __USE_POSIX
759
/* Return the system file descriptor for STREAM.  */
760
extern int fileno (FILE *__stream) __THROW;
761
#endif /* Use POSIX.  */
762
 
763
#ifdef __USE_MISC
764
/* Faster version when locking is not required.  */
765
extern int fileno_unlocked (FILE *__stream) __THROW;
766
#endif
767
 
768
 
769
#if (defined __USE_POSIX2 || defined __USE_SVID  || defined __USE_BSD || \
770
     defined __USE_MISC)
771
/* Create a new stream connected to a pipe running the given command.
772
 
773
   This function is a possible cancellation point and therefore not
774
   marked with __THROW.  */
775
extern FILE *popen (__const char *__command, __const char *__modes);
776
 
777
/* Close a stream opened by popen and return the status of its child.
778
 
779
   This function is a possible cancellation point and therefore not
780
   marked with __THROW.  */
781
extern int pclose (FILE *__stream);
782
#endif
783
 
784
 
785
#ifdef  __USE_POSIX
786
/* Return the name of the controlling terminal.  */
787
extern char *ctermid (char *__s) __THROW;
788
#endif /* Use POSIX.  */
789
 
790
 
791
#ifdef __USE_XOPEN
792
/* Return the name of the current user.  */
793
extern char *cuserid (char *__s);
794
#endif /* Use X/Open, but not issue 6.  */
795
 
796
 
797
#if 0 /* def    __USE_GNU uClibc note: not supported */
798
struct obstack;                 /* See <obstack.h>.  */
799
 
800
/* Write formatted output to an obstack.  */
801
extern int obstack_printf (struct obstack *__restrict __obstack,
802
                           __const char *__restrict __format, ...)
803
     __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
804
extern int obstack_vprintf (struct obstack *__restrict __obstack,
805
                            __const char *__restrict __format,
806
                            __gnuc_va_list __args)
807
     __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
808
#endif /* Use GNU.  */
809
 
810
 
811
#if defined __USE_POSIX || defined __USE_MISC
812
/* These are defined in POSIX.1:1996.  */
813
 
814
/* Acquire ownership of STREAM.  */
815
extern void flockfile (FILE *__stream) __THROW;
816
 
817
/* Try to acquire ownership of STREAM but do not block if it is not
818
   possible.  */
819
extern int ftrylockfile (FILE *__stream) __THROW;
820
 
821
/* Relinquish the ownership granted for STREAM.  */
822
extern void funlockfile (FILE *__stream) __THROW;
823
#endif /* POSIX || misc */
824
 
825
#if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
826
/* The X/Open standard requires some functions and variables to be
827
   declared here which do not belong into this header.  But we have to
828
   follow.  In GNU mode we don't do this nonsense.  */
829
# define __need_getopt
830
# include <bits/getopt.h>
831
#endif  /* X/Open, but not issue 6 and not for GNU.  */
832
 
833
/* If we are compiling with optimizing read this file.  It contains
834
   several optimizing inline functions and macros.  */
835
#define fgetc(_fp)                   __FGETC(_fp)
836
#define fputc(_ch, _fp)              __FPUTC(_ch, _fp)
837
 
838
#ifdef __USE_MISC
839
#define fgetc_unlocked(_fp)          __FGETC_UNLOCKED(_fp)
840
#define fputc_unlocked(_ch, _fp)     __FPUTC_UNLOCKED(_ch, _fp)
841
#endif
842
 
843
#ifndef __STDIO_GETC_MACRO
844
#define __stdin stdin
845
#endif
846
#define getchar()                    __GETC(__stdin)
847
 
848
#ifndef __STDIO_PUTC_MACRO
849
#define __stdout stdout
850
#endif
851
#define putchar(_ch)                 __PUTC((_ch), __stdout)
852
 
853
#if defined __USE_POSIX || defined __USE_MISC
854
#define getchar_unlocked()           __GETC_UNLOCKED(__stdin)
855
#define putchar_unlocked(_ch)        __PUTC_UNLOCKED((_ch), __stdout)
856
#endif
857
 
858
/* Clear the error and EOF indicators for STREAM.  */
859
#define clearerr(_fp)                __CLEARERR(_fp)
860
#define feof(_fp)                    __FEOF(_fp)
861
#define ferror(_fp)                  __FERROR(_fp)
862
 
863
#ifdef __USE_MISC
864
#define clearerr_unlocked(_fp)       __CLEARERR_UNLOCKED(_fp)
865
#define feof_unlocked(_fp)           __FEOF_UNLOCKED(_fp)
866
#define ferror_unlocked(_fp)         __FERROR_UNLOCKED(_fp)
867
#endif
868
 
869
__END_DECLS
870
 
871
#endif /* <stdio.h> included.  */
872
 
873
#endif /* !_STDIO_H */

powered by: WebSVN 2.1.0

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