10 #define ANSI_RED "\x1b[31m"
11 #define ANSI_GREEN "\x1b[32m"
12 #define ANSI_YELLOW "\x1b[33m"
13 #define ANSI_BLUE "\x1b[34m"
14 #define ANSI_MAGENTA "\x1b[35m"
15 #define ANSI_CYAN "\x1b[36m"
16 #define ASNI_WHITE "\x1b[37m"
17 #define ANSI_RESET "\x1b[0m"
20 #define STDIN_FILENO 0
21 #define STDOUT_FILENO 1
22 #define STDERR_FILENO 2
24 #if defined(__GNUC__) || defined(__clang__)
25 #define CHECK_PRINTF_FMT(a, b) __attribute__ ((format (printf, a, b)))
27 #define CHECK_PRINTF_FMT(...)
34 CHECK_PRINTF_FMT(1, 3)
void cprintf(const
char *color, const
char *fmt, ...);
49 char fpeek( FILE *stream );
51 char fspeek( FILE *stream,
long int offset,
int position );
52 int frpeek( FILE *stream,
char c );
53 int frdpeek( FILE *stream,
char d );
55 void fcopy( FILE *dest, FILE *src );
56 bool fexists(
const char *file );
57 bool fmove(
char *oldpath,
char *newpath );
60 bool dexists(
const char *path );
64 void sgets(
char* str,
int n);
Shared types and functions, accounts for GNU Linux and MacOS specifications.
int fcounts(FILE *stream)
Character count of current line of buffer.
Definition: io.c:107
bool fexists(const char *file)
Checks if file exists.
Definition: io.c:240
int frpeek(FILE *stream, char c)
A recursive peek that goes to end of line or EOF to get # of occurences.
Definition: io.c:62
CHECK_PRINTF_FMT(1, 2)
Makes writing error to stderr slightly simpler.
Filesystem * rsNewFilesystem(char *path)
Create a Filesystem object.
Definition: io.c:355
void rsFreeFilesystem(Filesystem *fs)
Terminates a Filesystem object.
Definition: io.c:375
char fspeek(FILE *stream, long int offset, int position)
View a character at position without moving pointer; Peeks a seek.
Definition: io.c:43
bool fmove(char *oldpath, char *newpath)
Move data from oldpath file to newpath.
Definition: io.c:198
int frdpeek(FILE *stream, char d)
A recursive peek that goes till the delimter d.
Definition: io.c:83
void fcopy(FILE *dest, FILE *src)
Copies data from src file to dest file.
Definition: io.c:125
char fpeek(FILE *stream)
View the next character in stream, doesn't move pointer.
Definition: io.c:22
const char * ExtractFileExtension(const char *filename)
Returns file extension.
Definition: io.c:141
const char * ExtractFileName(const char *path)
Returns filename.
Definition: io.c:168
bool PromptYesOrNo(const char *question)
Prompts the user with a yes or no question.
Definition: io.c:292
wchar_t fpeek_wc(FILE *stream)
Same as fpeek but for wchar_t.
Definition: io.c:33
void sgets(char *str, int n)
A safe way to read input that ensures no misc LF or breaks in read string.
Definition: io.c:275
bool dexists(const char *path)
Checks if directory exists.
Definition: io.c:252