1 // daemon/mk_blob.c
2 // This file is part of Anyterm; see http://anyterm.org/
3 // (C) 2008 Philip Endecott
4
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19
20 #include <stdio.h>
21 #include <stdlib.h>
22
23
main(int argc,char * argv[])24 int main(int argc, char* argv[])
25 {
26 if (argc!=2) {
27 fprintf(stderr,"usage: mk_blob fn\n");
28 exit(1);
29 }
30 const char* fn = argv[1];
31
32 printf("const char _binary_%s_start[] = {\n",fn);
33 int l=0;
34 while (1) {
35 int c = getchar();
36 if (c==EOF) {
37 break;
38 }
39 printf("0x%02x, ",c);
40 ++l;
41 if (l%32==0) {
42 printf("\n");
43 }
44 }
45 printf("\n};\n");
46 printf("const char _binary_%s_end[] = {};\n",fn);
47 exit(0);
48 }
49
50