Upload files to "/"

This commit is contained in:
pathetic 2025-05-12 23:01:59 +02:00
parent e2d498ecc4
commit 50c928f6f6
3 changed files with 76 additions and 0 deletions

52
nstdo.h Normal file
View file

@ -0,0 +1,52 @@
#ifndef MINI_STDIO_H
#define MINI_STDIO_H
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned long size_t;
typedef long off_t;
#define O_RDONLY 0
#define O_WRONLY 1
#define O_RDWR 2
#define O_CREAT 64
#define O_TRUNC 512
#define O_APPEND 1024
#define O_CLOEXEC 02000000
typedef __builtin_va_list va_list;
#define va_start(ap,last) __builtin_va_start(ap,last)
#define va_arg(ap,type) __builtin_va_arg(ap,type)
#define va_end(ap) __builtin_va_end(ap)
#define SYS_READ 0
#define SYS_WRITE 1
#define SYS_OPEN 2
#define SYS_CLOSE 3
#define SYS_LSEEK 8
static inline long _syscall3(long nr,long a1,long a2,long a3){long ret;asm volatile("syscall":"=a"(ret):"a"(nr),"D"(a1),"S"(a2),"d"(a3):"rcx","r11","memory");return ret;}
#ifndef MY_BUFSIZ
#define MY_BUFSIZ 4096
#endif
typedef struct{int fd;char buf[MY_BUFSIZ];size_t pos;size_t len;int mode;}MY_FILE;
MY_FILE* my_fopen(const char* path,int flags,int mode);
int my_fclose(MY_FILE* f);
size_t my_fread(void* ptr,size_t size,size_t nmemb,MY_FILE* f);
size_t my_fwrite(const void* ptr,size_t size,size_t nmemb,MY_FILE* f);
int my_putc(int c,MY_FILE* f);
int my_puts(const char* s,MY_FILE* f);
off_t my_seek(MY_FILE* f,off_t offset,int whence);
int my_printf(MY_FILE* f,const char* fmt,...);
int my_vprintf(MY_FILE* f,const char* fmt,va_list ap);
#ifdef __cplusplus
}
#endif
#endif