2020-01-18 09:38:21 +01:00
|
|
|
/*
|
2021-03-28 18:39:32 +02:00
|
|
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
2020-01-18 09:38:21 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2018-10-22 13:57:25 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2019-02-24 15:19:32 +01:00
|
|
|
#define _STDIO_H // Make GMP believe we exist.
|
|
|
|
|
|
2023-07-15 15:22:45 +02:00
|
|
|
// Includes essentially mandated by POSIX:
|
|
|
|
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
2021-08-14 19:07:36 +02:00
|
|
|
#include <Kernel/API/POSIX/stdio.h>
|
2020-09-18 09:49:51 +02:00
|
|
|
#include <bits/FILE.h>
|
2019-05-28 11:53:16 +02:00
|
|
|
#include <limits.h>
|
|
|
|
|
#include <stdarg.h>
|
2018-10-31 02:09:11 +01:00
|
|
|
#include <sys/cdefs.h>
|
2018-10-31 17:50:43 +01:00
|
|
|
#include <sys/types.h>
|
2018-10-22 13:57:25 +02:00
|
|
|
|
2019-11-08 21:39:31 +01:00
|
|
|
#define FILENAME_MAX 1024
|
2021-08-14 18:41:11 +02:00
|
|
|
#define FOPEN_MAX 1024
|
2019-03-27 01:40:55 +01:00
|
|
|
|
2018-10-31 02:09:11 +01:00
|
|
|
__BEGIN_DECLS
|
2019-05-28 11:53:16 +02:00
|
|
|
#ifndef EOF
|
|
|
|
|
# define EOF (-1)
|
2018-10-31 02:09:11 +01:00
|
|
|
#endif
|
|
|
|
|
|
2018-11-11 10:11:09 +01:00
|
|
|
#define _IOFBF 0
|
|
|
|
|
#define _IOLBF 1
|
|
|
|
|
#define _IONBF 2
|
2018-11-08 01:23:23 +01:00
|
|
|
|
2022-06-18 00:30:52 +08:00
|
|
|
#define L_ctermid 9
|
2019-05-29 07:20:04 -04:00
|
|
|
#define L_tmpnam 256
|
2021-06-21 11:56:44 +02:00
|
|
|
#define P_tmpdir "/tmp"
|
2019-05-29 07:20:04 -04:00
|
|
|
|
2018-10-31 02:09:11 +01:00
|
|
|
extern FILE* stdin;
|
|
|
|
|
extern FILE* stdout;
|
|
|
|
|
extern FILE* stderr;
|
|
|
|
|
|
2020-12-27 18:49:42 +11:00
|
|
|
typedef off_t fpos_t;
|
2019-02-25 10:05:32 +01:00
|
|
|
|
|
|
|
|
int fseek(FILE*, long offset, int whence);
|
2020-12-27 18:49:42 +11:00
|
|
|
int fseeko(FILE*, off_t offset, int whence);
|
2019-02-25 10:05:32 +01:00
|
|
|
int fgetpos(FILE*, fpos_t*);
|
2022-04-01 20:58:27 +03:00
|
|
|
int fsetpos(FILE*, fpos_t const*);
|
2019-02-25 10:05:32 +01:00
|
|
|
long ftell(FILE*);
|
2020-12-27 18:49:42 +11:00
|
|
|
off_t ftello(FILE*);
|
2018-10-31 17:50:43 +01:00
|
|
|
char* fgets(char* buffer, int size, FILE*);
|
2019-02-24 15:19:32 +01:00
|
|
|
int fputc(int ch, FILE*);
|
2018-10-31 17:50:43 +01:00
|
|
|
int fileno(FILE*);
|
|
|
|
|
int fgetc(FILE*);
|
2021-04-29 22:16:48 +02:00
|
|
|
int fgetc_unlocked(FILE*);
|
2018-10-31 17:50:43 +01:00
|
|
|
int getc(FILE*);
|
2019-11-16 04:39:36 -06:00
|
|
|
int getc_unlocked(FILE* stream);
|
2022-01-08 15:32:59 +01:00
|
|
|
int getchar(void);
|
2019-06-16 13:13:57 +01:00
|
|
|
ssize_t getdelim(char**, size_t*, int, FILE*);
|
|
|
|
|
ssize_t getline(char**, size_t*, FILE*);
|
2019-02-03 04:32:31 +01:00
|
|
|
int ungetc(int c, FILE*);
|
2022-04-01 20:58:27 +03:00
|
|
|
int remove(char const* pathname);
|
|
|
|
|
FILE* fdopen(int fd, char const* mode);
|
|
|
|
|
FILE* fopen(char const* pathname, char const* mode);
|
|
|
|
|
FILE* freopen(char const* pathname, char const* mode, FILE*);
|
|
|
|
|
FILE* fmemopen(void* buf, size_t size, char const* mode);
|
2019-11-16 04:39:36 -06:00
|
|
|
void flockfile(FILE* filehandle);
|
|
|
|
|
void funlockfile(FILE* filehandle);
|
2018-10-31 17:50:43 +01:00
|
|
|
int fclose(FILE*);
|
2018-10-31 19:49:22 +01:00
|
|
|
void rewind(FILE*);
|
|
|
|
|
void clearerr(FILE*);
|
2018-11-07 10:23:16 +01:00
|
|
|
int ferror(FILE*);
|
2018-10-31 19:49:22 +01:00
|
|
|
int feof(FILE*);
|
2018-11-05 14:56:05 +01:00
|
|
|
int fflush(FILE*);
|
2018-10-31 17:50:43 +01:00
|
|
|
size_t fread(void* ptr, size_t size, size_t nmemb, FILE*);
|
2021-04-29 22:16:48 +02:00
|
|
|
size_t fread_unlocked(void* ptr, size_t size, size_t nmemb, FILE*);
|
2022-04-01 20:58:27 +03:00
|
|
|
size_t fwrite(void const* ptr, size_t size, size_t nmemb, FILE*);
|
|
|
|
|
int vprintf(char const* fmt, va_list) __attribute__((format(printf, 1, 0)));
|
|
|
|
|
int vfprintf(FILE*, char const* fmt, va_list) __attribute__((format(printf, 2, 0)));
|
|
|
|
|
int vasprintf(char** strp, char const* fmt, va_list) __attribute__((format(printf, 2, 0)));
|
|
|
|
|
int vsprintf(char* buffer, char const* fmt, va_list) __attribute__((format(printf, 2, 0)));
|
|
|
|
|
int vsnprintf(char* buffer, size_t, char const* fmt, va_list) __attribute__((format(printf, 3, 0)));
|
|
|
|
|
int fprintf(FILE*, char const* fmt, ...) __attribute__((format(printf, 2, 3)));
|
|
|
|
|
int printf(char const* fmt, ...) __attribute__((format(printf, 1, 2)));
|
|
|
|
|
void dbgputstr(char const*, size_t);
|
|
|
|
|
int sprintf(char* buffer, char const* fmt, ...) __attribute__((format(printf, 2, 3)));
|
|
|
|
|
int asprintf(char** strp, char const* fmt, ...) __attribute__((format(printf, 2, 3)));
|
|
|
|
|
int snprintf(char* buffer, size_t, char const* fmt, ...) __attribute__((format(printf, 3, 4)));
|
2018-10-22 13:57:25 +02:00
|
|
|
int putchar(int ch);
|
2018-11-07 10:23:16 +01:00
|
|
|
int putc(int ch, FILE*);
|
2022-04-01 20:58:27 +03:00
|
|
|
int puts(char const*);
|
|
|
|
|
int fputs(char const*, FILE*);
|
|
|
|
|
void perror(char const*);
|
|
|
|
|
int scanf(char const* fmt, ...) __attribute__((format(scanf, 1, 2)));
|
|
|
|
|
int sscanf(char const* str, char const* fmt, ...) __attribute__((format(scanf, 2, 3)));
|
|
|
|
|
int fscanf(FILE*, char const* fmt, ...) __attribute__((format(scanf, 2, 3)));
|
|
|
|
|
int vscanf(char const*, va_list) __attribute__((format(scanf, 1, 0)));
|
|
|
|
|
int vfscanf(FILE*, char const*, va_list) __attribute__((format(scanf, 2, 0)));
|
|
|
|
|
int vsscanf(char const*, char const*, va_list) __attribute__((format(scanf, 2, 0)));
|
2018-11-11 10:11:09 +01:00
|
|
|
int setvbuf(FILE*, char* buf, int mode, size_t);
|
|
|
|
|
void setbuf(FILE*, char* buf);
|
2018-11-11 15:36:40 +01:00
|
|
|
void setlinebuf(FILE*);
|
2022-04-01 20:58:27 +03:00
|
|
|
int rename(char const* oldpath, char const* newpath);
|
2022-10-01 11:42:25 +00:00
|
|
|
int renameat(int olddirfd, char const* oldpath, int newdirfd, char const* newpath);
|
2022-01-08 15:32:59 +01:00
|
|
|
FILE* tmpfile(void);
|
2019-02-26 12:57:02 +01:00
|
|
|
char* tmpnam(char*);
|
2022-04-01 20:58:27 +03:00
|
|
|
FILE* popen(char const* command, char const* type);
|
2019-02-26 12:57:02 +01:00
|
|
|
int pclose(FILE*);
|
2022-06-18 00:30:52 +08:00
|
|
|
char* ctermid(char* s);
|
2018-10-22 13:57:25 +02:00
|
|
|
|
2018-10-31 02:09:11 +01:00
|
|
|
__END_DECLS
|