diff options
Diffstat (limited to 'prb_linux.h')
-rw-r--r-- | prb_linux.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/prb_linux.h b/prb_linux.h index 3acc229..64485d6 100644 --- a/prb_linux.h +++ b/prb_linux.h @@ -17,6 +17,27 @@ void sys_free(void *memory, u64 length) munmap(memory, length); } +void die(const char *error_string, ...) +{ + va_list args; + va_start(args, error_string); + fprintf(stderr, "error: "); + vfprintf(stderr, error_string, args); + fprintf(stderr, "\n"); + va_end(args); + _exit(1); +} + +void info(const char *format, ...) +{ + va_list args; + va_start(args, format); + printf("info: "); + vprintf(format, args); + printf("\n"); + va_end(args); +} + u64 sys_read_file(arena_t *arena, char **buffer, const char *filename) { FILE *file = fopen(filename, "rb"); |