Relicense Sortix to the ISC license.
I hereby relicense all my work on Sortix under the ISC license as below.
All Sortix contributions by other people are already under this license,
are not substantial enough to be copyrightable, or have been removed.
All imported code from other projects is compatible with this license.
All GPL licensed code from other projects had previously been removed.
Copyright 2011-2016 Jonas 'Sortie' Termansen and contributors.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2016-03-02 17:38:16 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2011, 2012, 2013, 2014, 2015 Jonas 'Sortie' Termansen.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* stdio.h
|
|
|
|
* Standard buffered input/output.
|
|
|
|
*/
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-20 08:10:06 -04:00
|
|
|
#ifndef INCLUDE_STDIO_H
|
|
|
|
#define INCLUDE_STDIO_H
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-10-13 07:04:27 -04:00
|
|
|
#include <sys/cdefs.h>
|
2013-09-23 10:37:33 -04:00
|
|
|
|
|
|
|
#include <sys/__/types.h>
|
|
|
|
|
2012-02-24 11:34:50 -05:00
|
|
|
#include <sortix/seek.h>
|
2014-04-02 17:26:56 -04:00
|
|
|
#if __USE_SORTIX || __USE_POSIX
|
|
|
|
/* TODO: This gets too much from <stdarg.h> and not just va_list. Unfortunately
|
|
|
|
the <stdarg.h> header that comes with gcc has no way to just request
|
|
|
|
the declaration of va_list. Sortix libc should ship its own stdarg.h
|
|
|
|
header instead and have a <__/stdarg.h> header we can typedef from. */
|
|
|
|
#else
|
2012-05-28 10:58:25 -04:00
|
|
|
#define __need___va_list
|
|
|
|
#endif
|
|
|
|
#include <stdarg.h>
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2015-05-13 12:11:02 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
#if __USE_SORTIX || 2008 <= __USE_POSIX
|
2013-12-26 19:44:03 -05:00
|
|
|
#ifndef __off_t_defined
|
|
|
|
#define __off_t_defined
|
|
|
|
typedef __off_t off_t;
|
|
|
|
#endif
|
2014-04-02 17:26:56 -04:00
|
|
|
#endif
|
2013-12-26 19:44:03 -05:00
|
|
|
|
|
|
|
#ifndef __size_t_defined
|
|
|
|
#define __size_t_defined
|
|
|
|
#define __need_size_t
|
|
|
|
#include <stddef.h>
|
|
|
|
#endif
|
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
#if __USE_SORTIX || __USE_POSIX
|
2013-12-26 19:44:03 -05:00
|
|
|
#ifndef __ssize_t_defined
|
|
|
|
#define __ssize_t_defined
|
|
|
|
typedef __ssize_t ssize_t;
|
|
|
|
#endif
|
2014-04-02 17:26:56 -04:00
|
|
|
#endif
|
2013-12-26 19:44:03 -05:00
|
|
|
|
|
|
|
#ifndef NULL
|
|
|
|
#define __need_NULL
|
|
|
|
#include <stddef.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __FILE_defined
|
|
|
|
#define __FILE_defined
|
2015-05-10 17:41:10 -04:00
|
|
|
typedef struct __FILE FILE;
|
2013-12-26 19:44:03 -05:00
|
|
|
#endif
|
Implemented large parts of the stdio(3), including fprintf.
Made FILE an interface to various backends. This allows application writers
to override the standard FILE API functions with their own backends. This
is highly unportable - it'd be nice if a real standard existed for this.
glibc already does something like this internally, but AFAIK you can't hook
into it.
Added fdopen(3), fopen(3), fregister(3), funregister(3), fread(3),
fwrite(3), fseek(3), clearerr(3), ferror(3), feof(3), rewind(3), ftell(3),
fflush(3), fclose(3), fileno(3), fnewline(3), fcloseall(3), memset(3),
stdio(3), vfprintf(3), fprintf(3), and vprintf(3).
Added a file-descriptor backend to the FILE API.
fd's {0, 1, 2} are now initialized as stdin, stdout, and stderr when the
standard library initializes.
fcloseall(3) is now called on exit(3).
decl/intn_t_.h now @include(size_t.h) instead of declaring it itself.
Added <stdint.h>.
The following programs now flush stdout: cat(1), clear(1), editor(1),
init(1), mxsh(1).
printf(3) is now hooked up against vprintf(3), while Maxsi::PrintF
remains using the system call, for now.
2011-12-23 22:08:10 -05:00
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
#if __USE_SORTIX || 2008 <= __USE_POSIX
|
2013-04-21 18:29:58 -04:00
|
|
|
typedef off_t fpos_t;
|
2014-04-02 17:26:56 -04:00
|
|
|
#else
|
|
|
|
typedef __off_t fpos_t;
|
|
|
|
#endif
|
Implemented large parts of the stdio(3), including fprintf.
Made FILE an interface to various backends. This allows application writers
to override the standard FILE API functions with their own backends. This
is highly unportable - it'd be nice if a real standard existed for this.
glibc already does something like this internally, but AFAIK you can't hook
into it.
Added fdopen(3), fopen(3), fregister(3), funregister(3), fread(3),
fwrite(3), fseek(3), clearerr(3), ferror(3), feof(3), rewind(3), ftell(3),
fflush(3), fclose(3), fileno(3), fnewline(3), fcloseall(3), memset(3),
stdio(3), vfprintf(3), fprintf(3), and vprintf(3).
Added a file-descriptor backend to the FILE API.
fd's {0, 1, 2} are now initialized as stdin, stdout, and stderr when the
standard library initializes.
fcloseall(3) is now called on exit(3).
decl/intn_t_.h now @include(size_t.h) instead of declaring it itself.
Added <stdint.h>.
The following programs now flush stdout: cat(1), clear(1), editor(1),
init(1), mxsh(1).
printf(3) is now hooked up against vprintf(3), while Maxsi::PrintF
remains using the system call, for now.
2011-12-23 22:08:10 -05:00
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
#if __USE_SORTIX || __USE_POSIX
|
2011-08-05 08:25:00 -04:00
|
|
|
/* TODO: Implement L_ctermid */
|
2014-09-24 11:17:11 -04:00
|
|
|
/* L_tmpnam will not be implemented. */
|
2014-04-02 17:26:56 -04:00
|
|
|
#endif
|
2011-08-05 08:25:00 -04:00
|
|
|
|
|
|
|
/* The possibilities for the third argument to `setvbuf'. */
|
|
|
|
#define _IOFBF 0 /* Fully buffered. */
|
|
|
|
#define _IOLBF 1 /* Line buffered. */
|
|
|
|
#define _IONBF 2 /* No buffering. */
|
|
|
|
|
|
|
|
#define EOF (-1)
|
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
/* FILENAME_MAX, FOPEN_MAX are not defined because Sortix doesn't have these
|
|
|
|
restrictions. */
|
|
|
|
#if __USE_SORTIX || __USE_POSIX
|
|
|
|
/* TMP_MAX are not defined because Sortix doesn't have these restrictions. */
|
|
|
|
#endif
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
#if __USE_SORTIX || __USE_POSIX
|
2015-06-01 10:58:18 -04:00
|
|
|
/* P_tmpdir will not be implemented. */
|
2014-04-02 17:26:56 -04:00
|
|
|
#endif
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-10-01 09:33:53 -04:00
|
|
|
/* Size of <stdio.h> buffers. */
|
2016-09-12 14:51:59 -04:00
|
|
|
#define BUFSIZ 8192
|
2013-10-01 09:33:53 -04:00
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
/* Constants used by `fparsemode'. */
|
|
|
|
#if __USE_SORTIX
|
|
|
|
#define FILE_MODE_READ (1 << 0)
|
|
|
|
#define FILE_MODE_WRITE (1 << 1)
|
|
|
|
#define FILE_MODE_APPEND (1 << 2)
|
|
|
|
#define FILE_MODE_CREATE (1 << 3)
|
|
|
|
#define FILE_MODE_TRUNCATE (1 << 4)
|
|
|
|
#define FILE_MODE_BINARY (1 << 5)
|
|
|
|
#define FILE_MODE_EXCL (1 << 6)
|
|
|
|
#define FILE_MODE_CLOEXEC (1 << 7)
|
|
|
|
#endif
|
|
|
|
|
2015-11-19 18:07:29 -05:00
|
|
|
extern FILE* const stdin;
|
|
|
|
extern FILE* const stdout;
|
|
|
|
extern FILE* const stderr;
|
2011-08-05 08:25:00 -04:00
|
|
|
|
|
|
|
#define stdin stdin
|
|
|
|
#define stdout stdout
|
|
|
|
#define stderr stderr
|
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
/* Functions from C89. */
|
2013-09-22 18:47:26 -04:00
|
|
|
void clearerr(FILE* stream);
|
|
|
|
int fclose(FILE* stream);
|
|
|
|
int feof(FILE* stream);
|
|
|
|
int ferror(FILE* stream);
|
|
|
|
int fflush(FILE* stream);
|
|
|
|
int fgetc(FILE* stream);
|
|
|
|
int fgetpos(FILE* __restrict stream, fpos_t* __restrict pos);
|
|
|
|
char* fgets(char* __restrict s, int n, FILE* __restrict stream);
|
|
|
|
FILE* fopen(const char* __restrict filename, const char* __restrict mode);
|
2014-07-22 09:22:05 -04:00
|
|
|
int fprintf(FILE* __restrict stream, const char* __restrict format, ...)
|
|
|
|
__attribute__((__format__ (printf, 2, 3)));
|
2013-09-22 18:47:26 -04:00
|
|
|
int fputc(int c, FILE* stream);
|
2013-08-31 19:42:02 -04:00
|
|
|
int fputs(const char* __restrict, FILE* __restrict stream);
|
2013-09-22 18:47:26 -04:00
|
|
|
size_t fread(void* __restrict ptr, size_t size, size_t nitems, FILE* __restrict stream);
|
|
|
|
FILE* freopen(const char* __restrict filename, const char *__restrict mode, FILE* __restrict stream);
|
2014-07-22 09:22:05 -04:00
|
|
|
int fscanf(FILE* __restrict stream, const char* __restrict format, ... )
|
|
|
|
__attribute__((__format__ (scanf, 2, 3)));
|
2013-09-22 18:47:26 -04:00
|
|
|
int fseek(FILE* stream, long offset, int whence);
|
|
|
|
int fsetpos(FILE* stream, const fpos_t* pos);
|
|
|
|
long ftell(FILE* stream);
|
|
|
|
size_t fwrite(const void* __restrict ptr, size_t size, size_t nitems, FILE* __restrict stream);
|
|
|
|
int getc(FILE* stream);
|
|
|
|
int getchar(void);
|
2014-04-02 17:26:56 -04:00
|
|
|
#if __USE_C < 2011
|
|
|
|
/* gets will not be implemented. */
|
|
|
|
#endif
|
2013-09-22 18:47:26 -04:00
|
|
|
void perror(const char* s);
|
2014-07-22 09:22:05 -04:00
|
|
|
int printf(const char* __restrict format, ...)
|
|
|
|
__attribute__((__format__ (printf, 1, 2)));
|
2013-09-22 18:47:26 -04:00
|
|
|
int putc(int c, FILE* stream);
|
|
|
|
int putchar(int c);
|
|
|
|
int puts(const char* str);
|
|
|
|
int remove(const char* path);
|
|
|
|
int rename(const char* oldname, const char* newname);
|
|
|
|
void rewind(FILE* stream);
|
|
|
|
void setbuf(FILE* __restrict stream, char* __restrict buf);
|
|
|
|
int setvbuf(FILE* __restrict stream, char* __restrict buf, int type, size_t size);
|
2014-09-24 10:04:01 -04:00
|
|
|
#if !defined(__is_sortix_libc) /* not a warning inside libc */
|
|
|
|
__attribute__((__warning__("sprintf() is dangerous, use snprintf()")))
|
|
|
|
#endif
|
2014-07-22 09:22:05 -04:00
|
|
|
int sprintf(char* __restrict s, const char* __restrict format, ...)
|
|
|
|
__attribute__((__format__ (printf, 2, 3)));
|
|
|
|
int scanf(const char* __restrict format, ...)
|
|
|
|
__attribute__((__format__ (scanf, 1, 2)));
|
|
|
|
int sscanf(const char* __restrict s, const char* __restrict format, ...)
|
|
|
|
__attribute__((__format__ (scanf, 2, 3)));
|
2013-09-22 18:47:26 -04:00
|
|
|
FILE* tmpfile(void);
|
|
|
|
int ungetc(int c, FILE* stream);
|
2014-07-22 09:22:05 -04:00
|
|
|
int vfprintf(FILE* __restrict stream, const char* __restrict format, __gnuc_va_list ap)
|
|
|
|
__attribute__((__format__ (printf, 2, 0)));
|
2014-04-02 17:26:56 -04:00
|
|
|
int vprintf(const char* __restrict format, __gnuc_va_list ap)
|
|
|
|
__attribute__((__format__ (printf, 1, 0)));
|
2014-09-24 10:04:01 -04:00
|
|
|
#if !defined(__is_sortix_libc) /* not a warning inside libc */
|
|
|
|
__attribute__((__warning__("vsprintf() is dangerous, use vsnprintf()")))
|
|
|
|
#endif
|
2014-04-02 17:26:56 -04:00
|
|
|
int vsprintf(char* __restrict s, const char* __restrict format, __gnuc_va_list ap)
|
2014-07-22 09:22:05 -04:00
|
|
|
__attribute__((__format__ (printf, 2, 0)));
|
2014-04-02 17:26:56 -04:00
|
|
|
|
|
|
|
/* Functions from C99. */
|
|
|
|
#if __USE_SORTIX || 1999 <= __USE_C
|
|
|
|
int snprintf(char* __restrict s, size_t n, const char* __restrict format, ...)
|
|
|
|
__attribute__((__format__ (printf, 3, 4)));
|
2014-07-22 09:22:05 -04:00
|
|
|
int vfscanf(FILE* __restrict stream, const char* __restrict format, __gnuc_va_list arg)
|
|
|
|
__attribute__((__format__ (scanf, 2, 0)));
|
|
|
|
int vscanf(const char* __restrict format, __gnuc_va_list arg)
|
|
|
|
__attribute__((__format__ (scanf, 1, 0)));
|
|
|
|
int vsnprintf(char* __restrict, size_t, const char* __restrict, __gnuc_va_list)
|
|
|
|
__attribute__((__format__ (printf, 3, 0)));
|
|
|
|
int vsscanf(const char* __restrict s, const char* __restrict format, __gnuc_va_list arg)
|
|
|
|
__attribute__((__format__ (scanf, 2, 0)));
|
2014-04-02 17:26:56 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Functions from early POSIX. */
|
|
|
|
#if __USE_SORTIX || __USE_POSIX
|
|
|
|
int fileno(FILE* stream);
|
|
|
|
void flockfile(FILE* file);
|
|
|
|
FILE* fdopen(int fildes, const char* mode);
|
|
|
|
int ftrylockfile(FILE* file);
|
|
|
|
void funlockfile(FILE* file);
|
|
|
|
int getc_unlocked(FILE* stream);
|
|
|
|
int getchar_unlocked(void);
|
|
|
|
int putc_unlocked(int c, FILE* stream);
|
|
|
|
int putchar_unlocked(int c);
|
2014-09-24 11:17:11 -04:00
|
|
|
/* tmpnam will not be implemented. */
|
2014-04-02 17:26:56 -04:00
|
|
|
#endif
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
#if __USE_POSIX
|
|
|
|
/* TODO: ctermid */
|
2011-08-05 08:25:00 -04:00
|
|
|
#endif
|
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
#if __USE_XOPEN
|
|
|
|
/* tempnam will not be implemented. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Functions from less early POSIX. */
|
|
|
|
#if __USE_SORTIX || 199209L <= __USE_POSIX
|
|
|
|
int pclose(FILE* steam);
|
|
|
|
FILE* popen(const char* command, const char* mode);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Functions from POSIX 2001. */
|
|
|
|
#if __USE_SORTIX || 200112L <= __USE_POSIX
|
|
|
|
int fseeko(FILE* stream, off_t offset, int whence);
|
|
|
|
off_t ftello(FILE* stream);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Functions from POSIX 2008. */
|
|
|
|
#if __USE_SORTIX || 200809L <= __USE_POSIX
|
|
|
|
int dprintf(int fildes, const char* __restrict format, ...)
|
|
|
|
__attribute__((__format__ (printf, 2, 3)));
|
|
|
|
FILE* fmemopen(void* __restrict, size_t, const char* __restrict);
|
|
|
|
ssize_t getdelim(char** __restrict lineptr, size_t* __restrict n, int delimiter, FILE* __restrict stream);
|
2015-06-11 15:48:37 -04:00
|
|
|
FILE* open_memstream(char**, size_t*);
|
2014-04-02 17:26:56 -04:00
|
|
|
ssize_t getline(char** __restrict lineptr, size_t* __restrict n, FILE* __restrict stream);
|
|
|
|
int renameat(int oldfd, const char* oldname, int newfd, const char* newname);
|
|
|
|
int vdprintf(int fildes, const char* __restrict format, __gnuc_va_list ap)
|
|
|
|
__attribute__((__format__ (printf, 2, 0)));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Functions copied from elsewhere. */
|
2014-04-02 15:35:20 -04:00
|
|
|
#if __USE_SORTIX
|
2014-04-02 17:26:56 -04:00
|
|
|
int asprintf(char** __restrict, const char* __restrict, ...)
|
|
|
|
__attribute__((__format__ (printf, 2, 3)));
|
|
|
|
void clearerr_unlocked(FILE* stream);
|
|
|
|
int feof_unlocked(FILE* stream);
|
|
|
|
int ferror_unlocked(FILE* stream);
|
|
|
|
int fflush_unlocked(FILE* stream);
|
|
|
|
int fileno_unlocked(FILE* stream);
|
|
|
|
int fgetc_unlocked(FILE* stream);
|
|
|
|
char* fgets_unlocked(char* __restrict, int, FILE* __restrict);
|
|
|
|
int fputc_unlocked(int c, FILE* stream);
|
|
|
|
int fputs_unlocked(const char* __restrict, FILE* __restrict stream);
|
|
|
|
size_t fread_unlocked(void* __restrict ptr, size_t size, size_t nitems, FILE* __restrict stream);
|
|
|
|
size_t fwrite_unlocked(const void* __restrict ptr, size_t size, size_t nitems, FILE* __restrict stream);
|
|
|
|
int vasprintf(char** __restrict, const char* __restrict, __gnuc_va_list)
|
|
|
|
__attribute__((__format__ (printf, 2, 0)));
|
|
|
|
#endif
|
2014-02-27 14:57:14 -05:00
|
|
|
|
2014-04-02 17:26:56 -04:00
|
|
|
/* Functions that are Sortix extensions. */
|
|
|
|
#if __USE_SORTIX
|
|
|
|
int fparsemode(const char*);
|
|
|
|
int fpipe(FILE* pipes[2]);
|
|
|
|
int fprintf_unlocked(FILE* __restrict stream, const char* __restrict format, ...)
|
|
|
|
__attribute__((__format__ (printf, 2, 3)));
|
|
|
|
int fscanf_unlocked(FILE* __restrict stream, const char* __restrict format, ... )
|
|
|
|
__attribute__((__format__ (scanf, 2, 3)));
|
|
|
|
int fseeko_unlocked(FILE* stream, off_t offset, int whence);
|
|
|
|
off_t ftello_unlocked(FILE* stream);
|
|
|
|
int removeat(int dirrfd, const char* path);
|
|
|
|
int setvbuf_unlocked(FILE* __restrict stream, char* __restrict buf, int type, size_t size);
|
|
|
|
char* sortix_gets(void);
|
|
|
|
int sortix_puts(const char* str);
|
|
|
|
int ungetc_unlocked(int c, FILE* stream);
|
|
|
|
int vfprintf_unlocked(FILE* __restrict stream, const char* __restrict format, __gnuc_va_list ap)
|
|
|
|
__attribute__((__format__ (printf, 2, 0)));
|
|
|
|
int vfscanf_unlocked(FILE* __restrict stream, const char* __restrict format, __gnuc_va_list arg)
|
|
|
|
__attribute__((__format__ (scanf, 2, 0)));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Functions that are Sortix extensions used for libc internal purposes. */
|
|
|
|
#if __USE_SORTIX
|
|
|
|
int fflush_stop_reading(FILE* fp);
|
|
|
|
int fflush_stop_reading_unlocked(FILE* fp);
|
|
|
|
int fflush_stop_writing(FILE* fp);
|
|
|
|
int fflush_stop_writing_unlocked(FILE* fp);
|
|
|
|
void fdeletefile(FILE* fp);
|
|
|
|
void fregister(FILE* fp);
|
|
|
|
void fresetfile(FILE* fp);
|
|
|
|
void funregister(FILE* fp);
|
|
|
|
FILE* fnewfile(void);
|
|
|
|
int fshutdown(FILE* fp);
|
|
|
|
#endif
|
2014-02-27 14:57:14 -05:00
|
|
|
|
2014-08-13 13:15:20 -04:00
|
|
|
/* The backends for printf and scanf. */
|
2014-04-02 15:35:20 -04:00
|
|
|
#if __USE_SORTIX
|
2014-08-13 13:15:20 -04:00
|
|
|
int cbprintf(void*, size_t (*)(void*, const char*, size_t), const char*, ...)
|
|
|
|
__attribute__((__format__ (printf, 3, 4)));
|
|
|
|
int vcbprintf(void*, size_t (*)(void*, const char*, size_t), const char*, __gnuc_va_list ap)
|
2014-07-22 09:22:05 -04:00
|
|
|
__attribute__((__format__ (printf, 3, 0)));
|
2014-01-19 11:27:36 -05:00
|
|
|
int vscanf_callback(void* fp,
|
|
|
|
int (*fgetc)(void*),
|
|
|
|
int (*ungetc)(int, void*),
|
|
|
|
const char* __restrict format,
|
2014-07-22 09:22:05 -04:00
|
|
|
__gnuc_va_list ap)
|
|
|
|
__attribute__((__format__ (scanf, 4, 0)));
|
2012-09-22 15:09:33 -04:00
|
|
|
#endif
|
|
|
|
|
2015-05-13 12:11:02 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2015-11-19 18:07:29 -05:00
|
|
|
#if defined(__is_sortix_libc)
|
|
|
|
#include <FILE.h>
|
|
|
|
#endif
|
|
|
|
|
2011-08-05 08:25:00 -04:00
|
|
|
#endif
|