Update.
[glibc.git] / libio / stdio.h
bloba835fed6cc8d94aec175e598fa14787de46792d4
1 /* Define ISO C stdio on top of C++ iostreams.
2 Copyright (C) 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 * ISO C Standard: 4.9 INPUT/OUTPUT <stdio.h>
23 #ifndef _STDIO_H
25 #if !defined __need_FILE
26 # define _STDIO_H 1
27 # include <features.h>
29 __BEGIN_DECLS
31 # define __need_size_t
32 # define __need_NULL
33 # include <stddef.h>
35 # include <bits/types.h>
36 #endif /* Don't need FILE. */
37 #undef __need_FILE
40 #ifndef __FILE_defined
42 /* The opaque type of streams. */
43 typedef struct _IO_FILE FILE;
45 # define __FILE_defined 1
46 #endif /* FILE not defined. */
49 #ifdef _STDIO_H
50 #define _STDIO_USES_IOSTREAM
52 #include <libio.h>
54 #ifdef __cplusplus
55 # define __STDIO_INLINE inline
56 #else
57 # define __STDIO_INLINE extern __inline
58 #endif
60 /* The type of the second argument to `fgetpos' and `fsetpos'. */
61 #ifndef __USE_FILE_OFFSET64
62 typedef _G_fpos_t fpos_t;
63 #else
64 typedef _G_fpos64_t fpos_t;
65 #endif
66 #ifdef __USE_LARGEFILE64
67 typedef _G_fpos64_t fpos64_t;
68 #endif
70 /* Generate a unique file name (and possibly open it with mode "w+b"). */
71 extern char *__stdio_gen_tempname __P ((char *__buf, size_t __bufsize,
72 __const char *__dir,
73 __const char *__pfx,
74 int __dir_search,
75 size_t *__lenptr,
76 FILE **__streamptr,
77 int __large_file));
80 /* Print out MESSAGE on the error output and abort. */
81 extern void __libc_fatal __P ((__const char *__message))
82 __attribute__ ((__noreturn__));
85 /* The possibilities for the third argument to `setvbuf'. */
86 #define _IOFBF 0 /* Fully buffered. */
87 #define _IOLBF 1 /* Line buffered. */
88 #define _IONBF 2 /* No buffering. */
91 /* Default buffer size. */
92 #ifndef BUFSIZ
93 # define BUFSIZ _IO_BUFSIZ
94 #endif
97 /* End of file character.
98 Some things throughout the library rely on this being -1. */
99 #ifndef EOF
100 # define EOF (-1)
101 #endif
104 /* The possibilities for the third argument to `fseek'.
105 These values should not be changed. */
106 #define SEEK_SET 0 /* Seek from beginning of file. */
107 #define SEEK_CUR 1 /* Seek from current position. */
108 #define SEEK_END 2 /* Seek from end of file. */
111 #ifdef __USE_SVID
112 /* Default path prefix for `tempnam' and `tmpnam'. */
113 # define P_tmpdir "/tmp"
114 #endif
117 /* Get the values:
118 L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
119 TMP_MAX The minimum number of unique filenames generated by tmpnam
120 (and tempnam when it uses tmpnam's name space),
121 or tempnam (the two are separate).
122 L_ctermid How long an array to pass to `ctermid'.
123 L_cuserid How long an array to pass to `cuserid'.
124 FOPEN_MAX Minimum number of files that can be open at once.
125 FILENAME_MAX Maximum length of a filename. */
126 #include <bits/stdio_lim.h>
129 /* Standard streams. */
130 extern FILE *stdin, *stdout, *stderr;
131 /* Refer to the real names by default. */
132 #define stdin _IO_stdin
133 #define stdout _IO_stdout
134 #define stderr _IO_stderr
137 /* Remove file FILENAME. */
138 extern int remove __P ((__const char *__filename));
139 /* Rename file OLD to NEW. */
140 extern int rename __P ((__const char *__old, __const char *__new));
143 /* Create a temporary file and open it read/write. */
144 #ifndef __USE_FILE_OFFSET64
145 extern FILE *tmpfile __P ((void));
146 #else
147 extern FILE *tmpfile __P ((void)) __asm__ ("tmpfile64");
148 #endif
149 #ifdef __USE_LARGEFILE64
150 extern FILE *tmpfile64 __P ((void));
151 #endif
152 /* Generate a temporary filename. */
153 extern char *tmpnam __P ((char *__s));
155 #ifdef __USE_MISC
156 /* This is the reentrant variant of `tmpnam'. The only difference is
157 that it does not allow S to be NULL. */
158 extern char *tmpnam_r __P ((char *__s));
159 #endif
162 #if defined __USE_SVID || defined __USE_XOPEN
163 /* Generate a unique temporary filename using up to five characters of PFX
164 if it is not NULL. The directory to put this file in is searched for
165 as follows: First the environment variable "TMPDIR" is checked.
166 If it contains the name of a writable directory, that directory is used.
167 If not and if DIR is not NULL, that value is checked. If that fails,
168 P_tmpdir is tried and finally "/tmp". The storage for the filename
169 is allocated by `malloc'. */
170 extern char *tempnam __P ((__const char *__dir, __const char *__pfx));
171 #endif
174 /* Close STREAM. */
175 extern int fclose __P ((FILE *__stream));
176 /* Flush STREAM, or all streams if STREAM is NULL. */
177 extern int fflush __P ((FILE *__stream));
179 #ifdef __USE_MISC
180 /* Faster versions when locking is not required. */
181 extern int fclose_unlocked __P ((FILE *__stream));
182 extern int fflush_unlocked __P ((FILE *__stream));
183 #endif
185 #ifdef __USE_GNU
186 /* Close all streams. */
187 extern int __fcloseall __P ((void));
188 extern int fcloseall __P ((void));
189 #endif
192 /* Open a file and create a new stream for it. */
193 #ifndef __USE_FILE_OFFSET64
194 extern FILE *fopen __P ((__const char *__filename, __const char *__modes));
195 #else
196 extern FILE *fopen __P ((__const char *__filename, __const char *__modes))
197 __asm__ ("fopen64");
198 #endif
199 #ifdef __USE_LARGEFILE64
200 extern FILE *fopen64 __P ((__const char *__filename, __const char *__modes));
201 #endif
202 /* Open a file, replacing an existing stream with it. */
203 #ifndef __USE_FILE_OFFSET64
204 extern FILE *freopen __P ((__const char *__restrict __filename,
205 __const char *__restrict __modes,
206 FILE *__restrict __stream));
207 #else
208 extern FILE *freopen __P ((__const char *__restrict __filename,
209 __const char *__restrict __modes,
210 FILE *__restrict __stream)) __asm__ ("freopen64");
211 #endif
212 #ifdef __USE_LARGEFILE64
213 extern FILE *freopen64 __P ((__const char *__restrict __filename,
214 __const char *__restrict __modes,
215 FILE *__restrict __stream));
216 #endif
218 #ifdef __USE_POSIX
219 /* Create a new stream that refers to an existing system file descriptor. */
220 extern FILE *fdopen __P ((int __fd, __const char *__modes));
221 #endif
223 #ifdef __USE_GNU
224 /* Create a new stream that refers to the given magic cookie,
225 and uses the given functions for input and output. */
226 extern FILE *fopencookie __P ((void *__magic_cookie, __const char *__modes,
227 _IO_cookie_io_functions_t __io_funcs));
229 /* Open a stream that writes into a malloc'd buffer that is expanded as
230 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
231 and the number of characters written on fflush or fclose. */
232 extern FILE *open_memstream __P ((char **__bufloc, size_t *__sizeloc));
233 #endif
236 /* If BUF is NULL, make STREAM unbuffered.
237 Else make it use buffer BUF, of size BUFSIZ. */
238 extern void setbuf __P ((FILE *__restrict __stream, char *__restrict __buf));
239 /* Make STREAM use buffering mode MODE.
240 If BUF is not NULL, use N bytes of it for buffering;
241 else allocate an internal buffer N bytes long. */
242 extern int setvbuf __P ((FILE *__restrict __stream, char *__restrict __buf,
243 int __modes, size_t __n));
245 #ifdef __USE_BSD
246 /* If BUF is NULL, make STREAM unbuffered.
247 Else make it use SIZE bytes of BUF for buffering. */
248 extern void setbuffer __P ((FILE *__stream, char *__buf, size_t __size));
250 /* Make STREAM line-buffered. */
251 extern void setlinebuf __P ((FILE *__stream));
252 #endif
255 /* Write formatted output to STREAM. */
256 extern int fprintf __P ((FILE *__restrict __stream,
257 __const char *__restrict __format, ...));
258 /* Write formatted output to stdout. */
259 extern int printf __P ((__const char *__restrict __format, ...));
260 /* Write formatted output to S. */
261 extern int sprintf __P ((char *__restrict __s,
262 __const char *__restrict __format, ...));
264 /* Write formatted output to S from argument list ARG. */
265 extern int vfprintf __P ((FILE *__restrict __s,
266 __const char *__restrict __format,
267 _G_va_list __arg));
268 /* Write formatted output to stdout from argument list ARG. */
269 extern int vprintf __P ((__const char *__restrict __format,
270 _G_va_list __arg));
271 /* Write formatted output to S from argument list ARG. */
272 extern int vsprintf __P ((char *__restrict __s,
273 __const char *__restrict __format,
274 _G_va_list __arg));
276 #ifdef __OPTIMIZE__
277 __STDIO_INLINE int
278 vprintf (__const char *__restrict __fmt, _G_va_list __arg)
280 return vfprintf (stdout, __fmt, __arg);
282 #endif /* Optimizing. */
284 #if defined __USE_BSD || defined __USE_ISOC9X
285 /* Maximum chars of output to write in MAXLEN. */
286 extern int __snprintf __P ((char *__restrict __s, size_t __maxlen,
287 __const char *__restrict __format, ...))
288 __attribute__ ((__format__ (__printf__, 3, 4)));
289 extern int snprintf __P ((char *__restrict __s, size_t __maxlen,
290 __const char *__restrict __format, ...))
291 __attribute__ ((__format__ (__printf__, 3, 4)));
293 extern int __vsnprintf __P ((char *__restrict __s, size_t __maxlen,
294 __const char *__restrict __format,
295 _G_va_list __arg))
296 __attribute__ ((__format__ (__printf__, 3, 0)));
297 extern int vsnprintf __P ((char *__restrict __s, size_t __maxlen,
298 __const char *__restrict __format,
299 _G_va_list __arg))
300 __attribute__ ((__format__ (__printf__, 3, 0)));
301 #endif
303 #ifdef __USE_GNU
304 /* Write formatted output to a string dynamically allocated with `malloc'.
305 Store the address of the string in *PTR. */
306 extern int vasprintf __P ((char **__restrict __ptr,
307 __const char *__restrict __f, _G_va_list __arg))
308 __attribute__ ((__format__ (__printf__, 2, 0)));
309 extern int asprintf __P ((char **__restrict __ptr,
310 __const char *__restrict __fmt, ...))
311 __attribute__ ((__format__ (__printf__, 2, 3)));
313 /* Write formatted output to a file descriptor. */
314 extern int vdprintf __P ((int __fd, __const char *__restrict __fmt,
315 _G_va_list __arg))
316 __attribute__ ((__format__ (__printf__, 2, 0)));
317 extern int dprintf __P ((int __fd, __const char *__restrict __fmt, ...))
318 __attribute__ ((__format__ (__printf__, 2, 3)));
319 #endif
322 /* Read formatted input from STREAM. */
323 extern int fscanf __P ((FILE *__restrict __stream,
324 __const char *__restrict __format, ...));
325 /* Read formatted input from stdin. */
326 extern int scanf __P ((__const char *__restrict __format, ...));
327 /* Read formatted input from S. */
328 extern int sscanf __P ((__const char *__restrict __s,
329 __const char *__restrict __format, ...));
331 #ifdef __USE_GNU
332 /* Read formatted input from S into argument list ARG. */
333 extern int __vfscanf __P ((FILE *__restrict __s,
334 __const char *__restrict __format,
335 _G_va_list __arg))
336 __attribute__ ((__format__ (__scanf__, 2, 0)));
337 extern int vfscanf __P ((FILE *__restrict __s,
338 __const char *__restrict __format,
339 _G_va_list __arg))
340 __attribute__ ((__format__ (__scanf__, 2, 0)));
342 /* Read formatted input from stdin into argument list ARG. */
343 extern int __vscanf __P ((__const char *__restrict __format,
344 _G_va_list __arg))
345 __attribute__ ((__format__ (__scanf__, 1, 0)));
346 extern int vscanf __P ((__const char *__restrict __format, _G_va_list __arg))
347 __attribute__ ((__format__ (__scanf__, 1, 0)));
349 /* Read formatted input from S into argument list ARG. */
350 extern int __vsscanf __P ((__const char *__restrict __s,
351 __const char *__restrict __format,
352 _G_va_list __arg))
353 __attribute__ ((__format__ (__scanf__, 2, 0)));
354 extern int vsscanf __P ((__const char *__restrict __s,
355 __const char *__restrict __format,
356 _G_va_list __arg))
357 __attribute__ ((__format__ (__scanf__, 2, 0)));
358 #endif /* Use GNU. */
361 /* Read a character from STREAM. */
362 extern int fgetc __P ((FILE *__stream));
363 extern int getc __P ((FILE *__stream));
365 /* Read a character from stdin. */
366 extern int getchar __P ((void));
368 /* The C standard explicitly says this is a macro, so we always do the
369 optimization for it. */
370 #define getc(_fp) _IO_getc (_fp)
372 #ifdef __OPTIMIZE__
373 __STDIO_INLINE int
374 getchar (void)
376 return _IO_getc (stdin);
378 #endif /* Optimizing. */
380 #if defined __USE_POSIX || defined __USE_MISC
381 /* These are defined in POSIX.1:1996. */
382 extern int getc_unlocked __P ((FILE *__stream));
383 extern int getchar_unlocked __P ((void));
385 # ifdef __OPTIMIZE__
386 __STDIO_INLINE int
387 getc_unlocked (FILE *__fp)
389 return _IO_getc_unlocked (__fp);
392 __STDIO_INLINE int
393 getchar_unlocked (void)
395 return _IO_getc_unlocked (stdin);
397 # endif /* Optimizing. */
398 #endif /* Use POSIX or MISC. */
401 /* Write a character to STREAM. */
402 extern int fputc __P ((int __c, FILE *__stream));
403 extern int putc __P ((int __c, FILE *__stream));
405 /* Write a character to stdout. */
406 extern int putchar __P ((int __c));
408 /* The C standard explicitly says this can be a macro,
409 so we always do the optimization for it. */
410 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
412 #ifdef __OPTIMIZE__
413 __STDIO_INLINE int
414 putchar (int __c)
416 return _IO_putc (__c, stdout);
418 #endif
420 #ifdef __USE_MISC
421 /* Faster version when locking is not necessary. */
422 extern int fputc_unlocked __P ((int __c, FILE *__stream));
424 # ifdef __OPTIMIZE__
425 __STDIO_INLINE int
426 fputc_unlocked (int __c, FILE *__stream)
428 return _IO_putc_unlocked (__c, __stream);
430 # endif /* Optimizing. */
431 #endif /* Use MISC. */
433 #if defined __USE_POSIX || defined __USE_MISC
434 /* These are defined in POSIX.1:1996. */
435 extern int putc_unlocked __P ((int __c, FILE *__stream));
436 extern int putchar_unlocked __P ((int __c));
438 # ifdef __OPTIMIZE__
439 __STDIO_INLINE int
440 putc_unlocked (int __c, FILE *__stream)
442 return _IO_putc_unlocked (__c, __stream);
445 __STDIO_INLINE int
446 putchar_unlocked (int __c)
448 return _IO_putc_unlocked (__c, stdout);
450 # endif /* Optimizing. */
451 #endif /* Use POSIX or MISc. */
454 #if defined __USE_SVID || defined __USE_MISC
455 /* Get a word (int) from STREAM. */
456 extern int getw __P ((FILE *__stream));
458 /* Write a word (int) to STREAM. */
459 extern int putw __P ((int __w, FILE *__stream));
460 #endif
463 /* Get a newline-terminated string of finite length from STREAM. */
464 extern char *fgets __P ((char *__restrict __s, int __n,
465 FILE *__restrict __stream));
467 /* Get a newline-terminated string from stdin, removing the newline.
468 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. */
469 extern char *gets __P ((char *__s));
472 #ifdef __USE_GNU
473 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
474 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
475 NULL), pointing to *N characters of space. It is realloc'd as
476 necessary. Returns the number of characters read (not including the
477 null terminator), or -1 on error or EOF. */
478 _IO_ssize_t __getdelim __P ((char **__lineptr, size_t *__n,
479 int __delimiter, FILE *__stream));
480 _IO_ssize_t getdelim __P ((char **__lineptr, size_t *__n,
481 int __delimiter, FILE *__stream));
483 /* Like `getdelim', but reads up to a newline. */
484 _IO_ssize_t __getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
485 _IO_ssize_t getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
487 # ifdef __OPTIMIZE__
488 __STDIO_INLINE _IO_ssize_t
489 getline (char **__lineptr, size_t *__n, FILE *__stream)
491 return __getdelim (__lineptr, __n, '\n', __stream);
493 # endif /* Optimizing. */
494 #endif
497 /* Write a string to STREAM. */
498 extern int fputs __P ((__const char *__restrict __s,
499 FILE *__restrict __stream));
500 /* Write a string, followed by a newline, to stdout. */
501 extern int puts __P ((__const char *__s));
504 /* Push a character back onto the input buffer of STREAM. */
505 extern int ungetc __P ((int __c, FILE *__stream));
508 /* Read chunks of generic data from STREAM. */
509 extern size_t fread __P ((void *__restrict __ptr, size_t __size,
510 size_t __n, FILE *__restrict __stream));
511 /* Write chunks of generic data to STREAM. */
512 extern size_t fwrite __P ((__const void *__restrict __ptr, size_t __size,
513 size_t __n, FILE *__restrict __s));
515 #ifdef __USE_MISC
516 /* Faster versions when locking is not necessary. */
517 extern size_t fread_unlocked __P ((void *__restrict __ptr, size_t __size,
518 size_t __n, FILE *__restrict __stream));
519 extern size_t fwrite_unlocked __P ((__const void *__restrict __ptr,
520 size_t __size, size_t __n,
521 FILE *__restrict __stream));
522 #endif
525 /* Seek to a certain position on STREAM. */
526 extern int fseek __P ((FILE *__stream, long int __off, int __whence));
527 /* Return the current position of STREAM. */
528 extern long int ftell __P ((FILE *__stream));
529 /* Rewind to the beginning of STREAM. */
530 extern void rewind __P ((FILE *__stream));
532 #if (defined __USE_LARGEFILE || defined __USE_LARGEFILE64 \
533 || defined __USE_FILE_OFFSET64)
534 /* The Single Unix Specification, Version 2, specifies an alternative,
535 more adequate interface for the two functions above which deal with
536 file offset. `long int' is not the right type. These definitions
537 are originally defined in the Large File Support API. */
539 /* Types needed in these functions. */
540 # ifndef off_t
541 # ifndef __USE_FILE_OFFSET64
542 typedef __off_t off_t;
543 # else
544 typedef __off64_t off_t;
545 # endif
546 # define off_t off_t
547 # endif
549 # if defined __USE_LARGEFILE64 && !defined off64_t
550 typedef __off64_t off64_t;
551 # define off64_t off64_t
552 # endif
554 /* Seek to a certain position on STREAM. */
555 # ifndef __USE_FILE_OFFSET64
556 extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence));
557 # else
558 extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence))
559 __asm__ ("fseeko64");
560 # endif
561 # ifdef __USE_LARGEFILE64
562 extern int fseeko64 __P ((FILE *__stream, __off64_t __off, int __whence));
563 # endif
565 /* Return the current position of STREAM. */
566 # ifndef __USE_FILE_OFFSET64
567 extern __off_t ftello __P ((FILE *__stream));
568 # else
569 extern __off_t ftello __P ((FILE *__stream)) __asm__ ("ftello");
570 # endif
571 # ifdef __USE_LARGEFILE64
572 extern __off64_t ftello64 __P ((FILE *__stream));
573 # endif
574 #endif
576 /* Get STREAM's position. */
577 #ifndef __USE_FILE_OFFSET64
578 extern int fgetpos __P ((FILE *__restrict __stream,
579 fpos_t *__restrict __pos));
580 #else
581 extern int fgetpos __P ((FILE *__restrict __stream,
582 fpos_t *__restrict __pos)) __asm__ ("fgetpos64");
583 #endif
584 #ifdef __USE_LARGEFILE64
585 extern int fgetpos64 __P ((FILE *__restrict __stream,
586 fpos64_t *__restrict __pos));
587 #endif
588 /* Set STREAM's position. */
589 #ifndef __USE_FILE_OFFSET64
590 extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos));
591 #else
592 extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos))
593 __asm__ ("fsetpos64");
594 #endif
595 #ifdef __USE_LARGEFILE64
596 extern int fsetpos64 __P ((FILE *__stream, __const fpos64_t *__pos));
597 #endif
600 /* Clear the error and EOF indicators for STREAM. */
601 extern void clearerr __P ((FILE *__stream));
602 /* Return the EOF indicator for STREAM. */
603 extern int feof __P ((FILE *__stream));
604 /* Return the error indicator for STREAM. */
605 extern int ferror __P ((FILE *__stream));
607 #ifdef __USE_MISC
608 /* Faster versions when locking is not required. */
609 extern void clearerr_unlocked __P ((FILE *__stream));
610 extern int feof_unlocked __P ((FILE *__stream));
611 extern int ferror_unlocked __P ((FILE *__stream));
613 # ifdef __OPTIMIZE__
614 __STDIO_INLINE int
615 feof_unlocked (FILE *__stream)
617 return _IO_feof_unlocked (__stream);
620 __STDIO_INLINE int
621 ferror_unlocked (FILE *__stream)
623 return _IO_ferror_unlocked (__stream);
625 # endif /* Optimizing. */
626 #endif
629 /* Print a message describing the meaning of the value of errno. */
630 extern void perror __P ((__const char *__s));
632 /* These variables normally should not be used directly. The `strftime'
633 function provides all the needed functionality. */
634 #ifdef __USE_BSD
635 extern int sys_nerr;
636 extern __const char *__const sys_errlist[];
637 #endif
638 #ifdef __USE_GNU
639 extern int _sys_nerr;
640 extern __const char *__const _sys_errlist[];
641 #endif
644 #ifdef __USE_POSIX
645 /* Return the system file descriptor for STREAM. */
646 extern int fileno __P ((FILE *__stream));
647 #endif /* Use POSIX. */
649 #ifdef __USE_MISC
650 /* Faster version when locking is not required. */
651 extern int fileno_unlocked __P ((FILE *__stream));
652 #endif
655 #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
656 defined __USE_MISC)
657 /* Create a new stream connected to a pipe running the given command. */
658 extern FILE *popen __P ((__const char *__command, __const char *__modes));
660 /* Close a stream opened by popen and return the status of its child. */
661 extern int pclose __P ((FILE *__stream));
662 #endif
665 #ifdef __USE_POSIX
666 /* Return the name of the controlling terminal. */
667 extern char *ctermid __P ((char *__s));
668 #endif /* Use POSIX. */
671 #ifdef __USE_XOPEN
672 /* Return the name of the current user. */
673 extern char *cuserid __P ((char *__s));
674 #endif /* Use X/Open. */
677 #ifdef __USE_GNU
678 struct obstack; /* See <obstack.h>. */
680 /* Write formatted output to an obstack. */
681 extern int obstack_printf __P ((struct obstack *__obstack,
682 __const char *__format, ...));
683 extern int obstack_vprintf __P ((struct obstack *__obstack,
684 __const char *__format,
685 _G_va_list __args));
686 #endif /* Use GNU. */
689 #if defined __USE_POSIX || defined __USE_MISC
690 /* These are defined in POSIX.1:1996. */
692 /* Acquire ownership of STREAM. */
693 extern void flockfile __P ((FILE *__stream));
695 /* Try to acquire ownership of STREAM but do not block if it is not
696 possible. */
697 extern int ftrylockfile __P ((FILE *__stream));
699 /* Relinquish the ownership granted for STREAM. */
700 extern void funlockfile __P ((FILE *__stream));
701 #endif /* POSIX || misc */
703 __END_DECLS
705 /* Define helper macro. */
706 #undef __STDIO_INLINE
708 #endif /* <stdio.h> included. */
710 #endif /* !_STDIO_H */