2012-07-31 14:16:03 +02:00
|
|
|
/*******************************************************************************
|
2011-08-05 14:25:00 +02:00
|
|
|
|
2013-07-10 15:26:01 +02:00
|
|
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
2011-08-05 14:25:00 +02:00
|
|
|
|
2013-07-10 15:26:01 +02:00
|
|
|
This file is part of the Sortix C Library.
|
2011-08-05 14:25:00 +02:00
|
|
|
|
2013-07-10 15:26:01 +02:00
|
|
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
option) any later version.
|
2011-08-05 14:25:00 +02:00
|
|
|
|
2013-07-10 15:26:01 +02:00
|
|
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
2011-08-05 14:25:00 +02:00
|
|
|
|
2013-07-10 15:26:01 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
2011-08-05 14:25:00 +02:00
|
|
|
|
2013-07-10 15:26:01 +02:00
|
|
|
stdio.h
|
|
|
|
Standard buffered input/output.
|
2011-08-05 14:25:00 +02:00
|
|
|
|
2012-07-31 14:16:03 +02:00
|
|
|
*******************************************************************************/
|
2011-08-05 14:25:00 +02:00
|
|
|
|
2013-04-21 22:46:44 +02:00
|
|
|
#ifndef _STDIO_H
|
|
|
|
#define _STDIO_H 1
|
2011-08-05 14:25:00 +02:00
|
|
|
|
|
|
|
#include <features.h>
|
2012-02-24 17:34:50 +01:00
|
|
|
#include <sortix/seek.h>
|
2012-05-28 16:58:25 +02:00
|
|
|
#if __STRICT_ANSI__
|
|
|
|
#define __need___va_list
|
|
|
|
#endif
|
|
|
|
#include <stdarg.h>
|
2011-08-05 14:25:00 +02:00
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
|
|
@include(off_t.h)
|
|
|
|
@include(size_t.h)
|
|
|
|
@include(ssize_t.h)
|
|
|
|
@include(NULL.h)
|
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-24 04:08:10 +01:00
|
|
|
@include(FILE.h)
|
|
|
|
|
|
|
|
struct _fpos_t;
|
|
|
|
typedef struct _fpos_t fpos_t;
|
|
|
|
|
2011-08-05 14:25:00 +02:00
|
|
|
/* TODO: Implement L_ctermid */
|
|
|
|
#if __POSIX_OBSOLETE <= 200801
|
|
|
|
/* TODO: Implement L_tmpnam */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* 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)
|
|
|
|
|
2012-09-29 00:53:50 +02:00
|
|
|
/* FILENAME_MAX, FOPEN_MAX, TMP_MAX are not defined because libc and Sortix
|
2011-08-05 14:25:00 +02:00
|
|
|
do not have these restrictions. */
|
|
|
|
|
|
|
|
/* Default path prefix for `tempnam' and `tmpnam'. */
|
|
|
|
#if __POSIX_OBSOLETE <= 200801
|
|
|
|
#define P_tmpdir "/tmp"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern FILE* stdin;
|
|
|
|
extern FILE* stdout;
|
|
|
|
extern FILE* stderr;
|
|
|
|
|
|
|
|
/* C89/C99 say they're macros. Make them happy. */
|
|
|
|
#define stdin stdin
|
|
|
|
#define stdout stdout
|
|
|
|
#define stderr stderr
|
|
|
|
|
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-24 04:08:10 +01:00
|
|
|
extern void clearerr(FILE* stream);
|
|
|
|
extern int fclose(FILE* stream);
|
2011-12-30 01:23:00 +01:00
|
|
|
extern FILE* fdopen(int fildes, const char* mode);
|
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-24 04:08:10 +01:00
|
|
|
extern int feof(FILE* stream);
|
|
|
|
extern int ferror(FILE* stream);
|
|
|
|
extern int fflush(FILE* stream);
|
|
|
|
extern int fileno(FILE* stream);
|
2011-12-30 00:55:59 +01:00
|
|
|
extern int fgetc(FILE* stream);
|
2012-03-06 13:15:02 +01:00
|
|
|
extern char* fgets(char* restrict s, int n, FILE* restrict stream);
|
2011-12-30 01:23:00 +01:00
|
|
|
extern FILE* fopen(const char* restrict filename, const char* restrict mode);
|
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-24 04:08:10 +01:00
|
|
|
extern int fprintf(FILE* restrict stream, const char* restrict format, ...);
|
2011-12-30 00:55:59 +01:00
|
|
|
extern int fputc(int c, FILE* stream);
|
2012-03-06 13:24:10 +01:00
|
|
|
extern int fputs(const char* restrict s, FILE* restrict stream);
|
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-24 04:08:10 +01:00
|
|
|
extern size_t fread(void* restrict ptr, size_t size, size_t nitems, FILE* restrict stream);
|
2012-09-07 20:36:27 +02:00
|
|
|
extern FILE* freopen(const char* restrict filename, const char *restrict mode, FILE* restrict stream);
|
|
|
|
extern int fscanf(FILE* restrict stream, const char* restrict format, ... );
|
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-24 04:08:10 +01:00
|
|
|
extern int fseek(FILE* stream, long offset, int whence);
|
2011-12-30 01:23:00 +01:00
|
|
|
extern int fseeko(FILE* stream, off_t offset, int whence);
|
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-24 04:08:10 +01:00
|
|
|
extern long ftell(FILE* stream);
|
2011-12-30 01:23:00 +01:00
|
|
|
extern off_t ftello(FILE* stream);
|
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-24 04:08:10 +01:00
|
|
|
extern size_t fwrite(const void* restrict ptr, size_t size, size_t nitems, FILE* restrict stream);
|
2011-12-30 01:03:24 +01:00
|
|
|
extern int getc(FILE* stream);
|
2011-12-30 01:06:27 +01:00
|
|
|
extern int getchar(void);
|
2012-02-13 01:07:02 +01:00
|
|
|
extern ssize_t getdelim(char** restrict lineptr, size_t* restrict n, int delimiter, FILE* restrict stream);
|
|
|
|
extern ssize_t getline(char** restrict lineptr, size_t* restrict n, FILE* restrict stream);
|
2011-11-26 11:00:45 +01:00
|
|
|
extern void perror(const char* s);
|
2011-08-05 14:25:00 +02:00
|
|
|
extern int printf(const char* restrict format, ...);
|
2011-12-30 01:03:24 +01:00
|
|
|
extern int putc(int c, FILE* stream);
|
2011-12-30 01:06:27 +01:00
|
|
|
extern int putchar(int c);
|
2012-02-13 01:07:02 +01:00
|
|
|
extern int puts(const char* str);
|
2011-12-30 01:11:33 +01:00
|
|
|
extern int remove(const char* path);
|
2012-09-07 20:36:27 +02:00
|
|
|
extern int rename(const char* oldname, const char* newname);
|
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-24 04:08:10 +01:00
|
|
|
extern void rewind(FILE* stream);
|
2012-01-09 00:31:42 +01:00
|
|
|
extern int snprintf(char* restrict s, size_t n, const char* restrict format, ...);
|
2012-09-07 20:36:27 +02:00
|
|
|
extern void setbuf(FILE* restrict stream, char* restrict buf);
|
2012-02-13 01:07:02 +01:00
|
|
|
extern char* sortix_gets(void);
|
|
|
|
extern int sortix_puts(const char* str);
|
2012-01-09 00:31:42 +01:00
|
|
|
extern int sprintf(char* restrict s, const char* restrict format, ...);
|
2012-09-07 20:36:27 +02:00
|
|
|
extern int scanf(const char* restrict format, ...);
|
2012-03-05 16:01:43 +01:00
|
|
|
extern int sscanf(const char* restrict s, const char* restrict format, ...);
|
2012-05-29 00:04:57 +02:00
|
|
|
extern int ungetc(int c, FILE* stream);
|
2012-05-28 16:58:25 +02:00
|
|
|
extern int vfprintf(FILE* restrict stream, const char* restrict format, __gnuc_va_list ap);
|
2012-09-07 20:36:27 +02:00
|
|
|
extern int vfscanf(FILE* restrict stream, const char* restrict format, __gnuc_va_list arg);
|
2012-05-28 16:58:25 +02:00
|
|
|
extern int vprintf(const char* restrict format, __gnuc_va_list ap);
|
2012-09-07 20:36:27 +02:00
|
|
|
extern int vscanf(const char* restrict format, __gnuc_va_list arg);
|
2012-05-28 16:58:25 +02:00
|
|
|
extern int vsnprintf(char* restrict, size_t, const char* restrict, __gnuc_va_list);
|
|
|
|
extern int vsprintf(char* restrict s, const char* restrict format, __gnuc_va_list ap);
|
2012-09-07 20:36:27 +02:00
|
|
|
extern int vsscanf(const char* restrict s, const char* restrict format, __gnuc_va_list arg);
|
2011-08-05 14:25:00 +02:00
|
|
|
|
2012-09-29 00:53:50 +02:00
|
|
|
/* TODO: These are not implemented in sortix libc yet. */
|
2012-02-11 18:50:12 +01:00
|
|
|
#if defined(__SORTIX_SHOW_UNIMPLEMENTED)
|
2011-08-05 14:25:00 +02:00
|
|
|
extern char* ctermid(char* s);
|
|
|
|
extern FILE *fmemopen(void* restrict buf, size_t size, const char* restrict mode);
|
|
|
|
extern FILE* open_memstream(char** bufp, size_t* sizep);
|
|
|
|
extern FILE* popen(const char* command, const char* mode);
|
|
|
|
extern FILE* tmpfile(void);
|
|
|
|
extern int dprintf(int fildes, const char* restrict format, ...);
|
|
|
|
extern int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
|
|
|
|
extern int fsetpos(FILE* stream, const fpos_t* pos);
|
|
|
|
extern int ftrylockfile(FILE* file);
|
|
|
|
extern int getchar_unlocked(void);
|
|
|
|
extern int getc_unlocked(FILE* stream);
|
|
|
|
extern int pclose(FILE* steam);
|
|
|
|
extern int putchar_unlocked(int c);
|
|
|
|
extern int putc_unlocked(int c, FILE* steam);
|
|
|
|
extern int renameat(int oldfd, const char* oldname, int newfd, const char* newname);
|
|
|
|
extern int setvbuf(FILE* restrict stream, char* restrict buf, int type, size_t size);
|
2012-05-28 16:58:25 +02:00
|
|
|
extern int vdprintf(int fildes, const char* restrict format, __gnuc_va_list ap);
|
2011-08-05 14:25:00 +02:00
|
|
|
extern void flockfile(FILE* file);
|
|
|
|
extern void funlockfile(FILE* file);
|
|
|
|
|
|
|
|
#if __POSIX_OBSOLETE <= 200801
|
|
|
|
extern char* tmpnam(char* s);
|
|
|
|
extern char* tempnam(const char* dir, const char* pfx);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2012-02-11 18:50:12 +01:00
|
|
|
#if defined(_SORTIX_SOURCE)
|
2012-03-12 00:38:48 +01:00
|
|
|
#include <stdio_ext.h>
|
|
|
|
#define fbufsize __fbufsize
|
|
|
|
#define freading __freading
|
|
|
|
#define fwriting __fwriting
|
|
|
|
#define freadable __freadable
|
|
|
|
#define fwritable __fwritable
|
|
|
|
#define flbf __flbf
|
|
|
|
#define fpurge __fpurge
|
|
|
|
#define fpending __fpending
|
|
|
|
#define flushlbf _flushlbf
|
|
|
|
#define fsetlocking __fsetlocking
|
2012-03-12 00:53:14 +01:00
|
|
|
void fseterr(FILE* fp);
|
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-24 04:08:10 +01:00
|
|
|
void fregister(FILE* fp);
|
|
|
|
void funregister(FILE* fp);
|
|
|
|
FILE* fnewfile(void);
|
|
|
|
int fcloseall(void);
|
2012-05-21 12:52:27 +02:00
|
|
|
int fpipe(FILE* pipes[2]);
|
2012-07-31 14:16:03 +02:00
|
|
|
/* Internally used by standard library. */
|
2012-09-29 00:53:50 +02:00
|
|
|
#if defined(LIBC_LIBRARY)
|
2012-07-31 14:16:03 +02:00
|
|
|
extern FILE* _firstfile;
|
|
|
|
#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-24 04:08:10 +01:00
|
|
|
#endif
|
|
|
|
|
2012-08-19 00:50:02 +02:00
|
|
|
#if (defined(_SOURCE_SOURCE) && __SORTIX_STDLIB_REDIRECTS) || \
|
|
|
|
defined(_WANT_SORTIX_GETS)
|
|
|
|
extern char* gets(void) asm ("sortix_gets");
|
2012-02-13 01:07:02 +01:00
|
|
|
#else
|
|
|
|
/* traditional gets(3) is no longer POSIX, hence removed. */
|
|
|
|
#endif
|
|
|
|
|
2012-09-22 21:09:33 +02:00
|
|
|
#if defined(_SORTIX_SOURCE) || defined(_WANT_SORTIX_VPRINTF_CALLBACK)
|
|
|
|
extern size_t vprintf_callback(size_t (*callback)(void*, const char*, size_t),
|
|
|
|
void* user,
|
|
|
|
const char* restrict format,
|
|
|
|
__gnuc_va_list ap);
|
|
|
|
#endif
|
|
|
|
|
2011-08-05 14:25:00 +02:00
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif
|