40 lines
572 B
C
40 lines
572 B
C
#ifndef UTIL_H_
|
|
#define UTIL_H_
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#define MAX_BUFFER_SIZE 128
|
|
|
|
/*
|
|
* Aliases for concise data types
|
|
*/
|
|
|
|
typedef void u1;
|
|
typedef char i8;
|
|
typedef unsigned int u16;
|
|
typedef int i16;
|
|
typedef unsigned long u32;
|
|
typedef long i32;
|
|
typedef unsigned long long u64;
|
|
typedef long long i64;
|
|
|
|
inline u1
|
|
die(i8 msg, i16 exitcode)
|
|
{
|
|
i8 buffer[128];
|
|
i8 *s = msg;
|
|
|
|
if (sizeof(s) > MAX_BUFFER_SIZE) {
|
|
return;
|
|
}
|
|
|
|
snprintf(buffer, MAX_BUFFER_SIZE, "%s\n\0, s);
|
|
|
|
fprintf(stderr, "%s\n", buffer);
|
|
exit(exitcode);
|
|
}
|
|
|
|
#endif
|