From 32b02a169167be709f03689e4245942ecdba55d2 Mon Sep 17 00:00:00 2001 From: Liam Waldron Date: Tue, 15 Apr 2025 17:45:50 -0400 Subject: [PATCH] init --- Makefile | 14 ++++++++++++++ build/util.a | Bin 0 -> 1988 bytes build/util.h | 16 ++++++++++++++++ build/util.o | Bin 0 -> 1848 bytes config.mk | 8 ++++++++ include/util.h | 39 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 77 insertions(+) create mode 100644 Makefile create mode 100644 build/util.a create mode 100755 build/util.h create mode 100644 build/util.o create mode 100644 config.mk create mode 100644 include/util.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4860a02 --- /dev/null +++ b/Makefile @@ -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 + diff --git a/build/util.a b/build/util.a new file mode 100644 index 0000000000000000000000000000000000000000..fa317d3391e99e33403280d1da224b4d94aca75a GIT binary patch literal 1988 zcmbtV&ubG=5S~q{t)<2)3dMTZf|VBZnGLB{(GscJ6-%i*EFqyBrNt5k-;)wsk*ctR998wPq+R0TqqX92G(S8GU~M0|K!H(&5VIo5e%9N z8;dWxnH7tu6q+SELOEKnTR-jX6JYMOetdY!+J5%!HLHrf)iXK|E}hbVDEs zM0)7^UXqQxY-bnAXg1t!lIsiIgGrLT!z{;QeZsvlca&w2C5@9zbmK?%;m7ykqoFF3 znw_=?L+01lylOpICO@dSo=3~tb(__Id-SpZ85WGnue}HsNCw^sPAB{%NCxszEBtkk z4DhHC{uW3EI6N!i=Rq>SA7T;SWE(&qNC(Q_s0GdvDL?Qcy&{(9t~x4kn*phc6F8)n ze4muph@42H%u*Jqa-&vr>zrC|1g_%IJLd;Z`H}V?*4NdV*I0ACV1rwrvAgnM*>h@c zXD9zxp(+8D(;QqtAOxNREPtOihG^E#8aAMGHI}Gm6ZuPsmezTJq H8R`1pz@Wb6 literal 0 HcmV?d00001 diff --git a/build/util.h b/build/util.h new file mode 100755 index 0000000..82fa5b6 --- /dev/null +++ b/build/util.h @@ -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 diff --git a/build/util.o b/build/util.o new file mode 100644 index 0000000000000000000000000000000000000000..fa590cbfffaa22ad042bbeabd85f293eafebc9da GIT binary patch literal 1848 zcmbtUOKTHR6h4zgTcyS*3cTN7HESa?RfOMvdGqH9&@?z;b|v z^C(5e0Gzyok?>D&3^1NPAfuZzCMU+mw>bGUa}eMW9yhYNSE;+%{Cavm`$4)P5C?!W z)Lhl1TEii))o~jwzfPWCb6l6|+I6}OpL>k404WxX%AcJOCP)U(1aBw&WsnTyqgMEv zAQ|9MBm5nZ3~=~X!rueQ0Dp)@_yXGi`ap(IUa#rfOQbyC4fTpxuCr<@-|70KYPN5a zTJk(nZaZ{BjWSc2q?X&wrqkloR@-+JkKP5(x0j!2|8Z+gb=-Exas3{*Kx1cRvF_SU zXSkF9G74Oc*-K7Lg*iaxB=q*q#3Tps%_@?hwWUASmi8xDW1Vn5iSn91r}@aW5JcYS zcv7K96zADN&ws7QT%l*|Y}uFfaUVpHT>lCO!Ih&)Y`@b!zD*QTFWTZD>{2v|?f2T3 zyF|iLC;C1I#FiZBk5MOLCv$C%;lD|~|3KFy_a*12!_;E~J(Km@Izj$V$xqhfpC2_p zpLIi-6U-0a=6mL6)Y@39s9#j}f%^|}{v1`mt?So^ JnW2%a{|olQsO$g$ literal 0 HcmV?d00001 diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..1784d2f --- /dev/null +++ b/config.mk @@ -0,0 +1,8 @@ +# +# config.mk +# + +CC = /bin/gcc +AR = /bin/ar + +CFLAGS = -O2 -pipe -fstack-protector-strong -static -pie -std=c99 diff --git a/include/util.h b/include/util.h new file mode 100644 index 0000000..2eb2b16 --- /dev/null +++ b/include/util.h @@ -0,0 +1,39 @@ +#ifndef UTIL_H_ +#define UTIL_H_ + +#include +#include +#include + +#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