Declarations for the string core, stdio, stdlib, unistd, errno, sys/types, and the raw syscall interface; the FILE layout stays private in src/internal.h. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <[email protected]>
47 lines
989 B
C
47 lines
989 B
C
/*
|
|
* stdio.h — standard I/O for nulsl-libc.
|
|
*
|
|
* Minimal for now: unbuffered writes to a file descriptor, plus ENOSYS
|
|
* stubs for the buffered/formatting machinery that is still to come.
|
|
* A FILE is just a file descriptor until we grow a real buffering layer.
|
|
*/
|
|
|
|
#ifndef _NULSL_STDIO_H
|
|
#define _NULSL_STDIO_H
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define EOF (-1)
|
|
|
|
#define SEEK_SET 0
|
|
#define SEEK_CUR 1
|
|
#define SEEK_END 2
|
|
|
|
typedef struct nulsl_file FILE;
|
|
|
|
extern FILE *stdin;
|
|
extern FILE *stdout;
|
|
extern FILE *stderr;
|
|
|
|
/* Real, unbuffered. */
|
|
int puts(const char *s);
|
|
int putchar(int c);
|
|
|
|
/* Stubs (see docs/architecture.md for the roadmap). */
|
|
int printf(const char *fmt, ...);
|
|
FILE *fopen(const char *path, const char *mode);
|
|
int fclose(FILE *f);
|
|
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *f);
|
|
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *f);
|
|
int fflush(FILE *f);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _NULSL_STDIO_H */
|