init
This commit is contained in:
parent
8e41b63cc1
commit
32b02a1691
14
Makefile
Normal file
14
Makefile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#
|
||||||
|
# Makefile
|
||||||
|
#
|
||||||
|
|
||||||
|
include config.mk
|
||||||
|
|
||||||
|
.PHONY: all install clean
|
||||||
|
|
||||||
|
all:
|
||||||
|
@echo "Run 'make install' to install util.h to PREFIX."
|
||||||
|
|
||||||
|
install:
|
||||||
|
install include/util.h $(PREFIX)/include -m 644
|
||||||
|
|
BIN
build/util.a
Normal file
BIN
build/util.a
Normal file
Binary file not shown.
16
build/util.h
Executable file
16
build/util.h
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef UTIL_H_
|
||||||
|
#define UTIL_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Aliases for concise data types
|
||||||
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
#endif
|
BIN
build/util.o
Normal file
BIN
build/util.o
Normal file
Binary file not shown.
8
config.mk
Normal file
8
config.mk
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
# config.mk
|
||||||
|
#
|
||||||
|
|
||||||
|
CC = /bin/gcc
|
||||||
|
AR = /bin/ar
|
||||||
|
|
||||||
|
CFLAGS = -O2 -pipe -fstack-protector-strong -static -pie -std=c99
|
39
include/util.h
Normal file
39
include/util.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#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
|
Loading…
Reference in New Issue
Block a user