ObjFW  Artifact [a4ff5f4233]

Artifact a4ff5f4233cb7501a7e30846e1ee304625c42ee7b88816e57e2bf0cdcf4e925b:


#!/bin/sh
if test $# != 3; then
	echo "Usage: $0 source_file filename output.m" 1>&2
	exit 1
fi

exec 1>$3

cat <<EOF
#include <stddef.h>
#include <stdint.h>

extern void OFRegisterEmbeddedFile(const char *, const uint8_t *, size_t);

static const uint8_t bytes[] = {
EOF
od -vtx1 $1 | sed '/^[^ ][^ ]*$/d;s/  */ /g;s/ $//g;s/^[^ ][^ ]* //;s/ /, 0x/g;s/^/	0x/;s/$/,/'
cat <<EOF
};

static void __attribute__((__constructor__))
ctor(void)
{
	OFRegisterEmbeddedFile("$2", bytes, sizeof(bytes));
}
EOF