xref: /haiku/src/system/libroot/posix/glibc/include/stdio_private.h (revision 69c4f5d707723661f43a90623eade65c228ccee9)
15af32e75SAxel Dörfler #ifndef _STDIO_H
25af32e75SAxel Dörfler # if defined __need_FILE || defined __need___FILE
35af32e75SAxel Dörfler #  include <libio/stdio.h>
45af32e75SAxel Dörfler # else
55af32e75SAxel Dörfler #  include <libio/stdio.h>
65af32e75SAxel Dörfler 
75af32e75SAxel Dörfler /* Now define the internal interfaces.  */
85af32e75SAxel Dörfler extern int __fcloseall (void);
95af32e75SAxel Dörfler extern int __snprintf (char *__restrict __s, size_t __maxlen,
105af32e75SAxel Dörfler 		       __const char *__restrict __format, ...)
115af32e75SAxel Dörfler      __attribute__ ((__format__ (__printf__, 3, 4)));
125af32e75SAxel Dörfler extern int __vsnprintf (char *__restrict __s, size_t __maxlen,
135af32e75SAxel Dörfler 			__const char *__restrict __format, _G_va_list __arg)
145af32e75SAxel Dörfler      __attribute__ ((__format__ (__printf__, 3, 0)));
155af32e75SAxel Dörfler extern int __vfscanf (FILE *__restrict __s,
165af32e75SAxel Dörfler 		      __const char *__restrict __format,
175af32e75SAxel Dörfler 		      _G_va_list __arg)
185af32e75SAxel Dörfler      __attribute__ ((__format__ (__scanf__, 2, 0)));
195af32e75SAxel Dörfler libc_hidden_proto (__vfscanf)
205af32e75SAxel Dörfler extern int __vscanf (__const char *__restrict __format,
215af32e75SAxel Dörfler 		     _G_va_list __arg)
225af32e75SAxel Dörfler      __attribute__ ((__format__ (__scanf__, 1, 0)));
235af32e75SAxel Dörfler extern _IO_ssize_t __getline (char **__lineptr, size_t *__n,
245af32e75SAxel Dörfler 			      FILE *__stream);
255af32e75SAxel Dörfler extern int __vsscanf (__const char *__restrict __s,
265af32e75SAxel Dörfler 		      __const char *__restrict __format,
275af32e75SAxel Dörfler 		      _G_va_list __arg)
285af32e75SAxel Dörfler      __attribute__ ((__format__ (__scanf__, 2, 0)));
295af32e75SAxel Dörfler 
30*69c4f5d7SAugustin Cavalier extern int __printf_fp (FILE *fp,
31*69c4f5d7SAugustin Cavalier 	 const struct printf_info *info,
32*69c4f5d7SAugustin Cavalier 	 const void *const *args);
33*69c4f5d7SAugustin Cavalier extern int __printf_fphex (FILE *fp,
34*69c4f5d7SAugustin Cavalier 	const struct printf_info *info,
35*69c4f5d7SAugustin Cavalier 	const void *const *args);
36*69c4f5d7SAugustin Cavalier 
375af32e75SAxel Dörfler /* Prototypes for compatibility functions.  */
385af32e75SAxel Dörfler extern FILE *__new_tmpfile (void);
395af32e75SAxel Dörfler extern FILE *__old_tmpfile (void);
405af32e75SAxel Dörfler 
415af32e75SAxel Dörfler 
425af32e75SAxel Dörfler 
435af32e75SAxel Dörfler #  define __need_size_t
445af32e75SAxel Dörfler #  include <stddef.h>
455af32e75SAxel Dörfler /* Generate a unique file name (and possibly open it).  */
465af32e75SAxel Dörfler extern int __path_search (char *__tmpl, size_t __tmpl_len,
475af32e75SAxel Dörfler 			  __const char *__dir, __const char *__pfx,
485af32e75SAxel Dörfler 			  int __try_tempdir);
495af32e75SAxel Dörfler 
505af32e75SAxel Dörfler extern int __gen_tempname (char *__tmpl, int __kind);
515af32e75SAxel Dörfler /* The __kind argument to __gen_tempname may be one of: */
525af32e75SAxel Dörfler #  define __GT_FILE	0	/* create a file */
535af32e75SAxel Dörfler #  define __GT_BIGFILE	1	/* create a file, using open64 */
545af32e75SAxel Dörfler #  define __GT_DIR	2	/* create a directory */
555af32e75SAxel Dörfler #  define __GT_NOCREATE	3	/* just find a name not currently in use */
565af32e75SAxel Dörfler 
575af32e75SAxel Dörfler /* Print out MESSAGE on the error output and abort.  */
585af32e75SAxel Dörfler extern void __libc_fatal (__const char *__message)
595af32e75SAxel Dörfler      __attribute__ ((__noreturn__));
605af32e75SAxel Dörfler 
615af32e75SAxel Dörfler /* Acquire ownership of STREAM.  */
625af32e75SAxel Dörfler extern void __flockfile (FILE *__stream);
635af32e75SAxel Dörfler 
645af32e75SAxel Dörfler /* Relinquish the ownership granted for STREAM.  */
655af32e75SAxel Dörfler extern void __funlockfile (FILE *__stream);
665af32e75SAxel Dörfler 
675af32e75SAxel Dörfler /* Try to acquire ownership of STREAM but do not block if it is not
685af32e75SAxel Dörfler    possible.  */
695af32e75SAxel Dörfler extern int __ftrylockfile (FILE *__stream);
705af32e75SAxel Dörfler 
715af32e75SAxel Dörfler extern int __getc_unlocked (FILE *__fp);
725af32e75SAxel Dörfler extern wint_t __getwc_unlocked (FILE *__fp);
735af32e75SAxel Dörfler 
745af32e75SAxel Dörfler 
755af32e75SAxel Dörfler extern __const char *__const _sys_errlist_internal[] attribute_hidden;
765af32e75SAxel Dörfler extern int _sys_nerr_internal attribute_hidden;
775af32e75SAxel Dörfler 
785af32e75SAxel Dörfler extern int __asprintf_internal (char **__restrict __ptr,
795af32e75SAxel Dörfler 				__const char *__restrict __fmt, ...)
805af32e75SAxel Dörfler      attribute_hidden __attribute__ ((__format__ (__printf__, 2, 3)));
815af32e75SAxel Dörfler #  if !defined NOT_IN_libc && !defined _ISOMAC
825af32e75SAxel Dörfler #    define __asprintf(ptr, fmt, args...) \
835af32e75SAxel Dörfler   INTUSE(__asprintf) (ptr, fmt, ##args)
845af32e75SAxel Dörfler 
855af32e75SAxel Dörfler extern _IO_FILE *_IO_new_fopen __P((const char*, const char*));
865af32e75SAxel Dörfler #   define fopen(fname, mode) _IO_new_fopen (fname, mode)
875af32e75SAxel Dörfler extern _IO_FILE *_IO_new_fdopen __P((int, const char*));
885af32e75SAxel Dörfler #   define fdopen(fd, mode) _IO_new_fdopen (fd, mode)
895af32e75SAxel Dörfler extern int _IO_new_fclose __P((_IO_FILE*));
905af32e75SAxel Dörfler #   define fclose(fp) _IO_new_fclose (fp)
915af32e75SAxel Dörfler extern int _IO_fputs __P((const char*, _IO_FILE*));
925af32e75SAxel Dörfler libc_hidden_proto (_IO_fputs)
935af32e75SAxel Dörfler #   define fputs(str, fp) _IO_fputs (str, fp)
945af32e75SAxel Dörfler extern int _IO_new_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
955af32e75SAxel Dörfler #   define fsetpos(fp, posp) _IO_new_fsetpos (fp, posp)
965af32e75SAxel Dörfler extern int _IO_new_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
975af32e75SAxel Dörfler #   define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
985af32e75SAxel Dörfler #  endif
995af32e75SAxel Dörfler 
1005af32e75SAxel Dörfler libc_hidden_proto (dprintf)
1015af32e75SAxel Dörfler libc_hidden_proto (fprintf)
1025af32e75SAxel Dörfler libc_hidden_proto (vfprintf)
1035af32e75SAxel Dörfler libc_hidden_proto (sprintf)
1045af32e75SAxel Dörfler libc_hidden_proto (sscanf)
1055af32e75SAxel Dörfler libc_hidden_proto (fwrite)
1065af32e75SAxel Dörfler libc_hidden_proto (perror)
1075af32e75SAxel Dörfler libc_hidden_proto (remove)
1085af32e75SAxel Dörfler libc_hidden_proto (rewind)
1095af32e75SAxel Dörfler libc_hidden_proto (fileno)
1105af32e75SAxel Dörfler libc_hidden_proto (fwrite)
1115af32e75SAxel Dörfler libc_hidden_proto (fseek)
1125af32e75SAxel Dörfler libc_hidden_proto (fflush_unlocked)
1135af32e75SAxel Dörfler libc_hidden_proto (fread_unlocked)
1145af32e75SAxel Dörfler libc_hidden_proto (fwrite_unlocked)
1155af32e75SAxel Dörfler libc_hidden_proto (fgets_unlocked)
1165af32e75SAxel Dörfler libc_hidden_proto (fputs_unlocked)
1175af32e75SAxel Dörfler libc_hidden_proto (open_memstream)
1185af32e75SAxel Dörfler 
1195af32e75SAxel Dörfler # endif
1205af32e75SAxel Dörfler 
1215af32e75SAxel Dörfler #endif
122