/* bin2h -- embed a binary file as the C array clectio compiles in. * usage: bin2h > text.lz.h * Copyright (C) 2026 Ɓukasz Kasprzak. SPDX-License-Identifier: GPL-3.0-or-later */ #include int main(int argc, char **argv) { FILE *f; int c, n = 0; if (argc != 2 || !(f = fopen(argv[1], "rb"))) { fprintf(stderr, "usage: bin2h > out.h\n"); return 1; } printf("static const unsigned char text_lz[] = {"); while ((c = fgetc(f)) != EOF) { if (n % 20 == 0) printf("\n\t"); printf("%d,", c); n++; } printf("\n};\nstatic const unsigned text_lz_len = %d;\n", n); fclose(f); return 0; }