make stdio.h be pretty

This commit is contained in:
bumbread 2022-06-27 13:58:24 +11:00
parent 3a41ec9245
commit 4176a3b485
1 changed files with 64 additions and 43 deletions

View File

@ -47,57 +47,78 @@ typedef size_t fpos_t;
#define TMP_MAX INT_MAX #define TMP_MAX INT_MAX
#endif #endif
extern FILE *stdout, *stderr, *stdin; extern FILE *stdout;
extern FILE *stderr;
extern FILE *stdin;
// File manipulation
int remove(const char *filename); int remove(const char *filename);
int rename(const char *oldname, const char *newname); int rename(const char *oldname, const char *newname);
FILE *tmpfile(void); FILE *tmpfile(void);
char *tmpnam(char *s); char *tmpnam(char *s);
int fclose(FILE *stream);
int fflush(FILE *stream); // Opening and closing files
FILE *fopen(const char * restrict filename, const char * restrict mode); FILE *fopen (const char *restrict filename, const char *restrict mode);
FILE *freopen(const char * restrict filename, const char * restrict mode, FILE * restrict stream); FILE *freopen(const char *restrict filename, const char *restrict mode, FILE *restrict stream);
void setbuf(FILE * restrict stream, char * restrict buf); int fclose (FILE *stream);
int setvbuf(FILE * restrict stream, char * restrict buf, int mode, size_t size);
int fprintf(FILE * restrict stream, const char * restrict format, ...); // I/O buffering control
int fscanf(FILE * restrict stream, const char * restrict format, ...); void setbuf (FILE *restrict stream, char *restrict buf);
int printf(const char * restrict format, ...); int setvbuf (FILE *restrict stream, char *restrict buf, int mode, size_t size);
int scanf(const char * restrict format, ...); int fflush (FILE *stream);
int snprintf(char * restrict s, size_t n, const char * restrict format, ...);
int sprintf(char * restrict s, const char * restrict format, ...); // String formatted print
int sscanf(const char * restrict s, const char * restrict format, ...); int vsnprintf(char *restrict s, size_t n, const char *restrict format, va_list arg);
int vfprintf(FILE * restrict stream, const char * restrict format, va_list arg); int vsprintf (char *restrict s, const char *restrict format, va_list arg);
int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg); int snprintf (char *restrict s, size_t n, const char *restrict format, ...);
int vprintf(const char * restrict format, va_list arg); int sprintf (char *restrict s, const char *restrict format, ...);
int vscanf(const char * restrict format, va_list arg);
int vsnprintf(char * restrict s, size_t n, const char * restrict format, va_list arg); // File formatted print
int vsprintf(char * restrict s, const char * restrict format, va_list arg); int vfprintf (FILE *restrict stream, const char *restrict format, va_list arg);
int vsscanf(const char * restrict s, const char * restrict format, va_list arg); int fprintf (FILE *restrict stream, const char *restrict format, ...);
int fgetc(FILE *stream); int vprintf (const char *restrict format, va_list arg);
char *fgets(char * restrict s, int n, FILE * restrict stream); int printf (const char *restrict format, ...);
int fputc(int c, FILE *stream);
int fputs(const char * restrict s, FILE * restrict stream); // String formatted scan
int getc(FILE *stream); int vsscanf(const char *restrict s, const char *restrict format, va_list arg);
int getchar(void); int vscanf (const char *restrict format, va_list arg);
int putc(int c, FILE *stream); int sscanf (const char *restrict s, const char *restrict format, ...);
int putchar(int c);
int puts(const char *s); // String formatted scan
int ungetc(int c, FILE *stream); int vfscanf(FILE *restrict stream, const char *restrict format, va_list arg);
size_t fread(void * restrict ptr, size_t size, size_t nmemb, FILE * restrict stream); int fscanf (FILE *restrict stream, const char *restrict format, ...);
size_t fwrite(const void * restrict ptr, size_t size, size_t nmemb, FILE * restrict stream); int scanf (const char *restrict format, ...);
int fgetpos(FILE * restrict stream, fpos_t * restrict pos);
int fseek(FILE *stream, long int offset, int whence); // File reading
int fsetpos(FILE *stream, const fpos_t *pos); int fgetc (FILE *stream);
long int ftell(FILE *stream); int getc (FILE *stream);
void rewind(FILE *stream); int getchar(void);
int ungetc (int c, FILE *stream);
char *fgets (char *restrict s, int n, FILE *restrict stream);
size_t fread (void *restrict ptr, size_t size, size_t nmemb, FILE *restrict stream);
int fputc (int c, FILE *stream);
int putc (int c, FILE *stream);
int putchar(int c);
int fputs (const char *restrict s, FILE *restrict stream);
int puts (const char *s);
size_t fwrite (const void *restrict ptr, size_t size, size_t nmemb, FILE *restrict stream);
int fgetpos (FILE *restrict stream, fpos_t *restrict pos);
int fseek (FILE *stream, long int offset, int whence);
int fsetpos (FILE *stream, const fpos_t *pos);
long int ftell (FILE *stream);
void rewind (FILE *stream);
void clearerr(FILE *stream); void clearerr(FILE *stream);
int feof(FILE *stream); int feof (FILE *stream);
int ferror(FILE *stream); int ferror (FILE *stream);
void perror(const char *s); void perror (const char *s);
#if __STDC_WANT_LIB_EXT1__ == 1 #if __STDC_WANT_LIB_EXT1__ == 1
#define L_tmpnam_s L_tmpnam #define L_tmpnam_s L_tmpnam
#define TMP_MAX_S TMP_MAX #define TMP_MAX_S TMP_MAX
errno_t tmpfile_s(FILE * restrict * restrict streamptr);
errno_t tmpnam_s(char *s, rsize_t maxsize); errno_t tmpfile_s(FILE *restrict *restrict streamptr);
errno_t tmpnam_s (char *s, rsize_t maxsize);
#endif #endif