OSDN Git Service

Last portion of libc_hidden_proto removal.
[uclinux-h8/uClibc.git] / include / stdio.h
1 /*
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 libc_hidden_proto(remove)
147 /* Rename file OLD to NEW.  */
148 extern int rename (__const char *__old, __const char *__new) __THROW;
149 __END_NAMESPACE_STD
150
151
152 __BEGIN_NAMESPACE_STD
153 /* Create a temporary file and open it read/write.
154
155    This function is a possible cancellation points and therefore not
156    marked with __THROW.  */
157 #ifndef __USE_FILE_OFFSET64
158 extern FILE *tmpfile (void) __wur;
159 #else
160 # ifdef __REDIRECT
161 extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur;
162 # else
163 #  define tmpfile tmpfile64
164 # endif
165 #endif
166
167 #ifdef __USE_LARGEFILE64
168 extern FILE *tmpfile64 (void) __wur;
169 #endif
170
171 /* Generate a temporary filename.  */
172 extern char *tmpnam (char *__s) __THROW __wur;
173 __END_NAMESPACE_STD
174
175 #ifdef __USE_MISC
176 /* This is the reentrant variant of `tmpnam'.  The only difference is
177    that it does not allow S to be NULL.  */
178 extern char *tmpnam_r (char *__s) __THROW __wur;
179 #endif
180
181
182 #if defined __USE_SVID || defined __USE_XOPEN
183 /* Generate a unique temporary filename using up to five characters of PFX
184    if it is not NULL.  The directory to put this file in is searched for
185    as follows: First the environment variable "TMPDIR" is checked.
186    If it contains the name of a writable directory, that directory is used.
187    If not and if DIR is not NULL, that value is checked.  If that fails,
188    P_tmpdir is tried and finally "/tmp".  The storage for the filename
189    is allocated by `malloc'.  */
190 extern char *tempnam (__const char *__dir, __const char *__pfx)
191      __THROW __attribute_malloc__ __wur;
192 #endif
193
194
195 __BEGIN_NAMESPACE_STD
196 /* Close STREAM.
197
198    This function is a possible cancellation point and therefore not
199    marked with __THROW.  */
200 extern int fclose (FILE *__stream);
201 libc_hidden_proto(fclose)
202 /* Flush STREAM, or all streams if STREAM is NULL.
203
204    This function is a possible cancellation point and therefore not
205    marked with __THROW.  */
206 extern int fflush (FILE *__stream);
207 libc_hidden_proto(fflush)
208 __END_NAMESPACE_STD
209
210 #ifdef __USE_MISC
211 /* Faster versions when locking is not required.
212
213    This function is not part of POSIX and therefore no official
214    cancellation point.  But due to similarity with an POSIX interface
215    or due to the implementation it is a cancellation point and
216    therefore not marked with __THROW.  */
217 extern int fflush_unlocked (FILE *__stream);
218 libc_hidden_proto(fflush_unlocked)
219 #endif
220
221 #ifdef __USE_GNU
222 /* Close all streams.
223
224    This function is not part of POSIX and therefore no official
225    cancellation point.  But due to similarity with an POSIX interface
226    or due to the implementation it is a cancellation point and
227    therefore not marked with __THROW.  */
228 extern int fcloseall (void);
229 #endif
230
231
232 __BEGIN_NAMESPACE_STD
233 #ifndef __USE_FILE_OFFSET64
234 /* Open a file and create a new stream for it.
235
236    This function is a possible cancellation point and therefore not
237    marked with __THROW.  */
238 extern FILE *fopen (__const char *__restrict __filename,
239                     __const char *__restrict __modes) __wur;
240 libc_hidden_proto(fopen)
241 /* Open a file, replacing an existing stream with it.
242
243    This function is a possible cancellation point and therefore not
244    marked with __THROW.  */
245 extern FILE *freopen (__const char *__restrict __filename,
246                       __const char *__restrict __modes,
247                       FILE *__restrict __stream) __wur;
248 #else
249 # ifdef __REDIRECT
250 extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
251                                  __const char *__restrict __modes), fopen64)
252   __wur;
253 extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
254                                    __const char *__restrict __modes,
255                                    FILE *__restrict __stream), freopen64)
256   __wur;
257 # else
258 #  define fopen fopen64
259 #  define freopen freopen64
260 # endif
261 #endif
262 __END_NAMESPACE_STD
263 #ifdef __USE_LARGEFILE64
264 extern FILE *fopen64 (__const char *__restrict __filename,
265                       __const char *__restrict __modes) __wur;
266 libc_hidden_proto(fopen64)
267 extern FILE *freopen64 (__const char *__restrict __filename,
268                         __const char *__restrict __modes,
269                         FILE *__restrict __stream) __wur;
270 #endif
271
272 #ifdef  __USE_POSIX
273 /* Create a new stream that refers to an existing system file descriptor.  */
274 extern FILE *fdopen (int __fd, __const char *__modes) __THROW __wur;
275 libc_hidden_proto(fdopen)
276 #endif
277
278 #ifdef  __USE_GNU
279 #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
280 /* Create a new stream that refers to the given magic cookie,
281    and uses the given functions for input and output.  */
282 extern FILE *fopencookie (void *__restrict __magic_cookie,
283                           __const char *__restrict __modes,
284                           _IO_cookie_io_functions_t __io_funcs) __THROW __wur;
285 libc_hidden_proto(fopencookie)
286
287 /* Create a new stream that refers to a memory buffer.  */
288 extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
289   __THROW __wur;
290
291 /* Open a stream that writes into a malloc'd buffer that is expanded as
292    necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
293    and the number of characters written on fflush or fclose.  */
294 extern FILE *open_memstream (char **__restrict __bufloc,
295                              size_t *__restrict __sizeloc) __THROW __wur;
296 libc_hidden_proto(open_memstream)
297 #endif
298 #endif
299
300
301 __BEGIN_NAMESPACE_STD
302 /* If BUF is NULL, make STREAM unbuffered.
303    Else make it use buffer BUF, of size BUFSIZ.  */
304 extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
305 /* Make STREAM use buffering mode MODE.
306    If BUF is not NULL, use N bytes of it for buffering;
307    else allocate an internal buffer N bytes long.  */
308 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
309                     int __modes, size_t __n) __THROW;
310 libc_hidden_proto(setvbuf)
311 __END_NAMESPACE_STD
312
313 #ifdef  __USE_BSD
314 /* If BUF is NULL, make STREAM unbuffered.
315    Else make it use SIZE bytes of BUF for buffering.  */
316 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
317                        size_t __size) __THROW;
318
319 /* Make STREAM line-buffered.  */
320 extern void setlinebuf (FILE *__stream) __THROW;
321 #endif
322
323
324 __BEGIN_NAMESPACE_STD
325 /* Write formatted output to STREAM.
326
327    This function is a possible cancellation point and therefore not
328    marked with __THROW.  */
329 extern int fprintf (FILE *__restrict __stream,
330                     __const char *__restrict __format, ...);
331 libc_hidden_proto(fprintf)
332 /* Write formatted output to stdout.
333
334    This function is a possible cancellation point and therefore not
335    marked with __THROW.  */
336 extern int printf (__const char *__restrict __format, ...);
337 libc_hidden_proto(printf)
338 /* Write formatted output to S.  */
339 extern int sprintf (char *__restrict __s,
340                     __const char *__restrict __format, ...) __THROW;
341 libc_hidden_proto(sprintf)
342
343 /* Write formatted output to S from argument list ARG.
344
345    This function is a possible cancellation point and therefore not
346    marked with __THROW.  */
347 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
348                      __gnuc_va_list __arg);
349 libc_hidden_proto(vfprintf)
350 /* Write formatted output to stdout from argument list ARG.
351
352    This function is a possible cancellation point and therefore not
353    marked with __THROW.  */
354 extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
355 /* Write formatted output to S from argument list ARG.  */
356 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
357                      __gnuc_va_list __arg) __THROW;
358 __END_NAMESPACE_STD
359
360 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
361 __BEGIN_NAMESPACE_C99
362 /* Maximum chars of output to write in MAXLEN.  */
363 extern int snprintf (char *__restrict __s, size_t __maxlen,
364                      __const char *__restrict __format, ...)
365      __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
366 libc_hidden_proto(snprintf)
367
368 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
369                       __const char *__restrict __format, __gnuc_va_list __arg)
370      __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
371 libc_hidden_proto(vsnprintf)
372 __END_NAMESPACE_C99
373 #endif
374
375 #ifdef __USE_GNU
376 /* Write formatted output to a string dynamically allocated with `malloc'.
377    Store the address of the string in *PTR.  */
378 extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
379                       __gnuc_va_list __arg)
380      __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
381 libc_hidden_proto(vasprintf)
382 #if 0 /* uClibc: disabled */
383 extern int __asprintf (char **__restrict __ptr,
384                        __const char *__restrict __fmt, ...)
385      __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
386 #endif
387 extern int asprintf (char **__restrict __ptr,
388                      __const char *__restrict __fmt, ...)
389      __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
390 libc_hidden_proto(asprintf)
391
392 /* Write formatted output to a file descriptor.
393
394    These functions are not part of POSIX and therefore no official
395    cancellation point.  But due to similarity with an POSIX interface
396    or due to the implementation they are cancellation points and
397    therefore not marked with __THROW.  */
398 extern int vdprintf (int __fd, __const char *__restrict __fmt,
399                      __gnuc_va_list __arg)
400      __attribute__ ((__format__ (__printf__, 2, 0)));
401 libc_hidden_proto(vdprintf)
402 extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
403      __attribute__ ((__format__ (__printf__, 2, 3)));
404 #endif
405
406
407 __BEGIN_NAMESPACE_STD
408 /* Read formatted input from STREAM.
409
410    This function is a possible cancellation point and therefore not
411    marked with __THROW.  */
412 extern int fscanf (FILE *__restrict __stream,
413                    __const char *__restrict __format, ...) __wur;
414 libc_hidden_proto(fscanf)
415 /* Read formatted input from stdin.
416
417    This function is a possible cancellation point and therefore not
418    marked with __THROW.  */
419 extern int scanf (__const char *__restrict __format, ...) __wur;
420 /* Read formatted input from S.  */
421 extern int sscanf (__const char *__restrict __s,
422                    __const char *__restrict __format, ...) __THROW;
423 libc_hidden_proto(sscanf)
424 __END_NAMESPACE_STD
425
426 #ifdef  __USE_ISOC99
427 __BEGIN_NAMESPACE_C99
428 /* Read formatted input from S into argument list ARG.
429
430    This function is a possible cancellation point and therefore not
431    marked with __THROW.  */
432 extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
433                     __gnuc_va_list __arg)
434      __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
435 libc_hidden_proto(vfscanf)
436
437 /* Read formatted input from stdin into argument list ARG.
438
439    This function is a possible cancellation point and therefore not
440    marked with __THROW.  */
441 extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
442      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
443 libc_hidden_proto(vscanf)
444
445 /* Read formatted input from S into argument list ARG.  */
446 extern int vsscanf (__const char *__restrict __s,
447                     __const char *__restrict __format, __gnuc_va_list __arg)
448      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
449 libc_hidden_proto(vsscanf)
450 __END_NAMESPACE_C99
451 #endif /* Use ISO C9x.  */
452
453
454 __BEGIN_NAMESPACE_STD
455 /* Read a character from STREAM.
456
457    These functions are possible cancellation points and therefore not
458    marked with __THROW.  */
459 extern int fgetc (FILE *__stream);
460 libc_hidden_proto(fgetc)
461 extern int getc (FILE *__stream);
462
463 /* Read a character from stdin.
464
465    This function is a possible cancellation point and therefore not
466    marked with __THROW.  */
467 extern int getchar (void);
468 __END_NAMESPACE_STD
469
470 /* The C standard explicitly says this is a macro, so we always do the
471    optimization for it.  */
472 #define getc(_fp) __GETC(_fp)
473
474 #if defined __USE_POSIX || defined __USE_MISC
475 /* These are defined in POSIX.1:1996.
476
477    These functions are possible cancellation points and therefore not
478    marked with __THROW.  */
479 extern int getc_unlocked (FILE *__stream);
480 libc_hidden_proto(getc_unlocked)
481 extern int getchar_unlocked (void);
482 libc_hidden_proto(getchar_unlocked)
483
484 /* SUSv3 allows getc_unlocked to be a macro */
485 #define getc_unlocked(_fp) __GETC_UNLOCKED(_fp)
486 #endif /* Use POSIX or MISC.  */
487
488 #ifdef __USE_MISC
489 /* Faster version when locking is not necessary.
490
491    This function is not part of POSIX and therefore no official
492    cancellation point.  But due to similarity with an POSIX interface
493    or due to the implementation it is a cancellation point and
494    therefore not marked with __THROW.  */
495 extern int fgetc_unlocked (FILE *__stream);
496 libc_hidden_proto(fgetc_unlocked)
497 #endif /* Use MISC.  */
498
499
500 __BEGIN_NAMESPACE_STD
501 /* Write a character to STREAM.
502
503    These functions are possible cancellation points and therefore not
504    marked with __THROW.
505
506    These functions is a possible cancellation point and therefore not
507    marked with __THROW.  */
508 extern int fputc (int __c, FILE *__stream);
509 libc_hidden_proto(fputc)
510 extern int putc (int __c, FILE *__stream);
511 libc_hidden_proto(putc)
512
513 /* Write a character to stdout.
514
515    This function is a possible cancellation point and therefore not
516    marked with __THROW.  */
517 extern int putchar (int __c);
518 __END_NAMESPACE_STD
519
520 /* The C standard explicitly says this can be a macro,
521    so we always do the optimization for it.  */
522 #define putc(_ch, _fp) __PUTC(_ch, _fp)
523
524 #ifdef __USE_MISC
525 /* Faster version when locking is not necessary.
526
527    This function is not part of POSIX and therefore no official
528    cancellation point.  But due to similarity with an POSIX interface
529    or due to the implementation it is a cancellation point and
530    therefore not marked with __THROW.  */
531 extern int fputc_unlocked (int __c, FILE *__stream);
532 libc_hidden_proto(fputc_unlocked)
533 #endif /* Use MISC.  */
534
535 #if defined __USE_POSIX || defined __USE_MISC
536 /* These are defined in POSIX.1:1996.
537
538    These functions are possible cancellation points and therefore not
539    marked with __THROW.  */
540 extern int putc_unlocked (int __c, FILE *__stream);
541 libc_hidden_proto(putc_unlocked)
542 extern int putchar_unlocked (int __c);
543
544 /* SUSv3 allows putc_unlocked to be a macro */
545 #define putc_unlocked(_ch, _fp) __PUTC_UNLOCKED(_ch, _fp)
546 #endif /* Use POSIX or MISC.  */
547
548
549 #if defined __USE_SVID || defined __USE_MISC \
550     || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
551 /* Get a word (int) from STREAM.  */
552 extern int getw (FILE *__stream);
553
554 /* Write a word (int) to STREAM.  */
555 extern int putw (int __w, FILE *__stream);
556 #endif
557
558
559 __BEGIN_NAMESPACE_STD
560 /* Get a newline-terminated string of finite length from STREAM.
561
562    This function is a possible cancellation point and therefore not
563    marked with __THROW.  */
564 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
565      __wur;
566 libc_hidden_proto(fgets)
567
568 /* Get a newline-terminated string from stdin, removing the newline.
569    DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.
570
571    This function is a possible cancellation point and therefore not
572    marked with __THROW.  */
573 extern char *gets (char *__s) __wur;
574 __END_NAMESPACE_STD
575
576 #ifdef __USE_GNU
577 /* This function does the same as `fgets' but does not lock the stream.
578
579    This function is not part of POSIX and therefore no official
580    cancellation point.  But due to similarity with an POSIX interface
581    or due to the implementation it is a cancellation point and
582    therefore not marked with __THROW.  */
583 extern char *fgets_unlocked (char *__restrict __s, int __n,
584                              FILE *__restrict __stream) __wur;
585 libc_hidden_proto(fgets_unlocked)
586 #endif
587
588
589 #ifdef  __USE_GNU
590 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
591    (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
592    NULL), pointing to *N characters of space.  It is realloc'd as
593    necessary.  Returns the number of characters read (not including the
594    null terminator), or -1 on error or EOF.
595
596    These functions are not part of POSIX and therefore no official
597    cancellation point.  But due to similarity with an POSIX interface
598    or due to the implementation they are cancellation points and
599    therefore not marked with __THROW.  */
600 #if 0 /* uClibc: disabled */
601 extern __ssize_t __getdelim (char **__restrict __lineptr,
602                                size_t *__restrict __n, int __delimiter,
603                                FILE *__restrict __stream) __wur;
604 #endif
605 extern __ssize_t getdelim (char **__restrict __lineptr,
606                              size_t *__restrict __n, int __delimiter,
607                              FILE *__restrict __stream) __wur;
608 libc_hidden_proto(getdelim)
609
610 /* Like `getdelim', but reads up to a newline.
611
612    This function is not part of POSIX and therefore no official
613    cancellation point.  But due to similarity with an POSIX interface
614    or due to the implementation it is a cancellation point and
615    therefore not marked with __THROW.  */
616 extern __ssize_t getline (char **__restrict __lineptr,
617                             size_t *__restrict __n,
618                             FILE *__restrict __stream) __wur;
619 libc_hidden_proto(getline)
620 #endif
621
622
623 __BEGIN_NAMESPACE_STD
624 /* Write a string to STREAM.
625
626    This function is a possible cancellation points and therefore not
627    marked with __THROW.  */
628 extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
629 libc_hidden_proto(fputs)
630
631 /* Write a string, followed by a newline, to stdout.
632
633    This function is a possible cancellation points and therefore not
634    marked with __THROW.  */
635 extern int puts (__const char *__s);
636
637
638 /* Push a character back onto the input buffer of STREAM.
639
640    This function is a possible cancellation points and therefore not
641    marked with __THROW.  */
642 extern int ungetc (int __c, FILE *__stream);
643 libc_hidden_proto(ungetc)
644
645
646 /* Read chunks of generic data from STREAM.
647
648    This function is a possible cancellation points and therefore not
649    marked with __THROW.  */
650 extern size_t fread (void *__restrict __ptr, size_t __size,
651                      size_t __n, FILE *__restrict __stream) __wur;
652 libc_hidden_proto(fread)
653 /* Write chunks of generic data to STREAM.
654
655    This function is a possible cancellation points and therefore not
656    marked with __THROW.  */
657 extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
658                       size_t __n, FILE *__restrict __s) __wur;
659 libc_hidden_proto(fwrite)
660 __END_NAMESPACE_STD
661
662 #ifdef __USE_GNU
663 /* This function does the same as `fputs' but does not lock the stream.
664
665    This function is not part of POSIX and therefore no official
666    cancellation point.  But due to similarity with an POSIX interface
667    or due to the implementation it is a cancellation point and
668    therefore not marked with __THROW.  */
669 extern int fputs_unlocked (__const char *__restrict __s,
670                            FILE *__restrict __stream);
671 libc_hidden_proto(fputs_unlocked)
672 #endif
673
674 #ifdef __USE_MISC
675 /* Faster versions when locking is not necessary.
676
677    These functions are not part of POSIX and therefore no official
678    cancellation point.  But due to similarity with an POSIX interface
679    or due to the implementation they are cancellation points and
680    therefore not marked with __THROW.  */
681 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
682                               size_t __n, FILE *__restrict __stream) __wur;
683 libc_hidden_proto(fread_unlocked)
684 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
685                                size_t __n, FILE *__restrict __stream) __wur;
686 libc_hidden_proto(fwrite_unlocked)
687 #endif
688
689
690 __BEGIN_NAMESPACE_STD
691 /* Seek to a certain position on STREAM.
692
693    This function is a possible cancellation point and therefore not
694    marked with __THROW.  */
695 extern int fseek (FILE *__stream, long int __off, int __whence);
696 libc_hidden_proto(fseek)
697 /* Return the current position of STREAM.
698
699    This function is a possible cancellation point and therefore not
700    marked with __THROW.  */
701 extern long int ftell (FILE *__stream) __wur;
702 libc_hidden_proto(ftell)
703 /* Rewind to the beginning of STREAM.
704
705    This function is a possible cancellation point and therefore not
706    marked with __THROW.  */
707 extern void rewind (FILE *__stream);
708 libc_hidden_proto(rewind)
709 __END_NAMESPACE_STD
710
711 /* The Single Unix Specification, Version 2, specifies an alternative,
712    more adequate interface for the two functions above which deal with
713    file offset.  `long int' is not the right type.  These definitions
714    are originally defined in the Large File Support API.  */
715
716 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
717 # ifndef __USE_FILE_OFFSET64
718 /* Seek to a certain position on STREAM.
719
720    This function is a possible cancellation point and therefore not
721    marked with __THROW.  */
722 extern int fseeko (FILE *__stream, __off_t __off, int __whence);
723 /* Return the current position of STREAM.
724
725    This function is a possible cancellation point and therefore not
726    marked with __THROW.  */
727 extern __off_t ftello (FILE *__stream) __wur;
728 # else
729 #  ifdef __REDIRECT
730 extern int __REDIRECT (fseeko,
731                        (FILE *__stream, __off64_t __off, int __whence),
732                        fseeko64);
733 extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
734 #  else
735 #   define fseeko fseeko64
736 #   define ftello ftello64
737 #  endif
738 # endif
739 #endif
740
741 __BEGIN_NAMESPACE_STD
742 #ifndef __USE_FILE_OFFSET64
743 /* Get STREAM's position.
744
745    This function is a possible cancellation point and therefore not
746    marked with __THROW.  */
747 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
748 /* Set STREAM's position.
749
750    This function is a possible cancellation point and therefore not
751    marked with __THROW.  */
752 extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
753 #else
754 # ifdef __REDIRECT
755 extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
756                                  fpos_t *__restrict __pos), fgetpos64);
757 extern int __REDIRECT (fsetpos,
758                        (FILE *__stream, __const fpos_t *__pos), fsetpos64);
759 # else
760 #  define fgetpos fgetpos64
761 #  define fsetpos fsetpos64
762 # endif
763 #endif
764 __END_NAMESPACE_STD
765
766 #ifdef __USE_LARGEFILE64
767 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
768 libc_hidden_proto(fseeko64)
769 extern __off64_t ftello64 (FILE *__stream) __wur;
770 libc_hidden_proto(ftello64)
771 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
772 extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
773 #endif
774
775 __BEGIN_NAMESPACE_STD
776 /* Clear the error and EOF indicators for STREAM.  */
777 extern void clearerr (FILE *__stream) __THROW;
778 /* Return the EOF indicator for STREAM.  */
779 extern int feof (FILE *__stream) __THROW __wur;
780 /* Return the error indicator for STREAM.  */
781 extern int ferror (FILE *__stream) __THROW __wur;
782 __END_NAMESPACE_STD
783
784 #ifdef __USE_MISC
785 /* Faster versions when locking is not required.  */
786 extern void clearerr_unlocked (FILE *__stream) __THROW;
787 extern int feof_unlocked (FILE *__stream) __THROW __wur;
788 extern int ferror_unlocked (FILE *__stream) __THROW __wur;
789 #endif
790
791
792 __BEGIN_NAMESPACE_STD
793 /* Print a message describing the meaning of the value of errno.
794
795    This function is a possible cancellation point and therefore not
796    marked with __THROW.  */
797 extern void perror (__const char *__s);
798 libc_hidden_proto(perror)
799 __END_NAMESPACE_STD
800
801 #ifdef __UCLIBC_HAS_SYS_ERRLIST__
802 /* These variables normally should not be used directly.  The `strerror'
803    function provides all the needed functionality.  */
804 #ifdef  __USE_BSD
805 extern int sys_nerr;
806 extern __const char *__const sys_errlist[];
807 #endif
808 #endif /* __UCLIBC_HAS_SYS_ERRLIST__ */
809
810
811 #ifdef  __USE_POSIX
812 /* Return the system file descriptor for STREAM.  */
813 extern int fileno (FILE *__stream) __THROW __wur;
814 libc_hidden_proto(fileno)
815 #endif /* Use POSIX.  */
816
817 #ifdef __USE_MISC
818 /* Faster version when locking is not required.  */
819 extern int fileno_unlocked (FILE *__stream) __THROW __wur;
820 libc_hidden_proto(fileno_unlocked)
821 #endif
822
823
824 #if (defined __USE_POSIX2 || defined __USE_SVID  || defined __USE_BSD || \
825      defined __USE_MISC)
826 /* Create a new stream connected to a pipe running the given command.
827
828    This function is a possible cancellation point and therefore not
829    marked with __THROW.  */
830 extern FILE *popen (__const char *__command, __const char *__modes) __wur;
831
832 /* Close a stream opened by popen and return the status of its child.
833
834    This function is a possible cancellation point and therefore not
835    marked with __THROW.  */
836 extern int pclose (FILE *__stream);
837 #endif
838
839
840 #ifdef  __USE_POSIX
841 /* Return the name of the controlling terminal.  */
842 extern char *ctermid (char *__s) __THROW;
843 #endif /* Use POSIX.  */
844
845
846 #ifdef __USE_XOPEN
847 /* Return the name of the current user.  */
848 extern char *cuserid (char *__s);
849 #endif /* Use X/Open, but not issue 6.  */
850
851
852 #if 0 /* def    __USE_GNU uClibc note: not supported */
853 struct obstack;                 /* See <obstack.h>.  */
854
855 /* Write formatted output to an obstack.  */
856 extern int obstack_printf (struct obstack *__restrict __obstack,
857                            __const char *__restrict __format, ...)
858      __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
859 extern int obstack_vprintf (struct obstack *__restrict __obstack,
860                             __const char *__restrict __format,
861                             __gnuc_va_list __args)
862      __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
863 #endif /* Use GNU.  */
864
865
866 #if defined __USE_POSIX || defined __USE_MISC
867 /* These are defined in POSIX.1:1996.  */
868
869 /* Acquire ownership of STREAM.  */
870 extern void flockfile (FILE *__stream) __THROW;
871
872 /* Try to acquire ownership of STREAM but do not block if it is not
873    possible.  */
874 extern int ftrylockfile (FILE *__stream) __THROW __wur;
875
876 /* Relinquish the ownership granted for STREAM.  */
877 extern void funlockfile (FILE *__stream) __THROW;
878 #endif /* POSIX || misc */
879
880 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
881 /* The X/Open standard requires some functions and variables to be
882    declared here which do not belong into this header.  But we have to
883    follow.  In GNU mode we don't do this nonsense.  */
884 # define __need_getopt
885 # include <bits/getopt.h>
886 #endif  /* X/Open, but not issue 6 and not for GNU.  */
887
888 /* If we are compiling with optimizing read this file.  It contains
889    several optimizing inline functions and macros.  */
890 #define fgetc(_fp)                   __FGETC(_fp)
891 #define fputc(_ch, _fp)              __FPUTC(_ch, _fp)
892
893 #ifdef __USE_MISC
894 #define fgetc_unlocked(_fp)          __FGETC_UNLOCKED(_fp)
895 #define fputc_unlocked(_ch, _fp)     __FPUTC_UNLOCKED(_ch, _fp)
896 #endif
897
898 #ifndef __STDIO_GETC_MACRO
899 #define __stdin stdin
900 #endif
901 #define getchar()                    __GETC(__stdin)
902
903 #ifndef __STDIO_PUTC_MACRO
904 #define __stdout stdout
905 #endif
906 #define putchar(_ch)                 __PUTC((_ch), __stdout)
907
908 #if defined __USE_POSIX || defined __USE_MISC
909 #define getchar_unlocked()           __GETC_UNLOCKED(__stdin)
910 #define putchar_unlocked(_ch)        __PUTC_UNLOCKED((_ch), __stdout)
911 #endif
912
913 /* Clear the error and EOF indicators for STREAM.  */
914 #define clearerr(_fp)                __CLEARERR(_fp)
915 #define feof(_fp)                    __FEOF(_fp)
916 #define ferror(_fp)                  __FERROR(_fp)
917
918 #ifdef __USE_MISC
919 #define clearerr_unlocked(_fp)       __CLEARERR_UNLOCKED(_fp)
920 #define feof_unlocked(_fp)           __FEOF_UNLOCKED(_fp)
921 #define ferror_unlocked(_fp)         __FERROR_UNLOCKED(_fp)
922 #endif
923
924 __END_DECLS
925
926 #endif /* <stdio.h> included.  */
927
928 #endif /* !_STDIO_H */