/*1* Unloved program to convert a binary on stdin to a C include on stdout2*3* Jan 1999 Matt Mackall <[email protected]>4*5* This software may be used and distributed according to the terms6* of the GNU General Public License, incorporated herein by reference.7*/89#include <stdio.h>1011int main(int argc, char *argv[])12{13int ch, total=0;1415if (argc > 1)16printf("const char %s[] %s=\n",17argv[1], argc > 2 ? argv[2] : "");1819do {20printf("\t\"");21while ((ch = getchar()) != EOF)22{23total++;24printf("\\x%02x",ch);25if (total % 16 == 0)26break;27}28printf("\"\n");29} while (ch != EOF);3031if (argc > 1)32printf("\t;\n\nconst int %s_size = %d;\n", argv[1], total);3334return 0;35}363738