serenity/LibC/stdio.h
Andreas Kling da3857b0c2 Add some simple write buffering to LibC's stdio.
Plumb it all the way to the VirtualConsole. Also fix /bin/cat to write()
the whole chunks we get from read() directly to stdout.
2018-11-08 01:23:47 +01:00

61 lines
1.3 KiB
C

#pragma once
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
#ifndef EOF
#define EOF (-1)
#endif
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define __STDIO_FILE_BUFFER_SIZE 128
struct __STDIO_FILE {
int fd;
int eof;
int error;
char read_buffer[__STDIO_FILE_BUFFER_SIZE];
size_t read_buffer_index;
char write_buffer[__STDIO_FILE_BUFFER_SIZE];
size_t write_buffer_index;
};
typedef struct __STDIO_FILE FILE;
extern FILE* stdin;
extern FILE* stdout;
extern FILE* stderr;
char* fgets(char* buffer, int size, FILE*);
int fileno(FILE*);
int fgetc(FILE*);
int getc(FILE*);
int getchar();
FILE* fdopen(int fd, const char* mode);
FILE* fopen(const char* pathname, const char* mode);
int fclose(FILE*);
void rewind(FILE*);
void clearerr(FILE*);
int ferror(FILE*);
int feof(FILE*);
int fflush(FILE*);
size_t fread(void* ptr, size_t size, size_t nmemb, FILE*);
size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE*);
int fprintf(FILE*, const char* fmt, ...);
int printf(const char* fmt, ...);
int sprintf(char* buffer, const char* fmt, ...);
int putchar(int ch);
int putc(int ch, FILE*);
int puts(const char*);
int fputs(const char*, FILE*);
void perror(const char*);
int sscanf (const char* buf, const char* fmt, ...);
int fscanf(FILE*, const char* fmt, ...);
__END_DECLS